<commit_before>ActiveAdmin.register Poi do
  belongs_to :region, :optional => true
  belongs_to :node_type, :optional => true

  actions :index, :show


  scope :fully_accessible
  scope :limited_accessible
  scope :not_accessible
  scope :unknown_accessibility
  scope :has_provider
  scope :has_photo

  filter :category, :as => :select, :collection => proc { Category.all.inject([]){|memo,r| memo << [r.name, r.id]; memo}.sort }
  filter :node_type, :as => :select, :collection => proc { NodeType.all.inject([]){|memo,r| memo << [r.name, r.id]; memo}.sort }
  filter :region, :as => :select, :collection => proc { Region.all.inject([]){|memo,r| memo << [r.name, r.id]; memo}.sort }
  filter :version
  filter :tags
  filter :created_at
  filter :updated_at

  controller do

    before_filter :set_per_page, :only => :index, :if => Proc.new { |controller| controller.request.format == 'text/csv' }

    def update
      region = resource
      region.update_attributes(params[:poi])
      super
    end

    private

    def set_per_page
      @per_page = params[:per_page].blank? ? max_csv_records : params[:per_page].to_i
    end

    def max_csv_records
      100
    end

  end

  csv :force_quotes => true do
    column :id
    column :name
    column :lat
    column :lon
    column :street
    column :housenumber
    column :postcode
    column :city
  end

  index do
    column :osm_id do |poi|
      link_to poi.osm_id, node_path(poi)
    end
    column :wheelchair do |poi|
      status_tag(poi.wheelchair, :class => poi.wheelchair)
    end
    column :version
    column :name
    column :node_type
    column :address do |p|
      span p.address
    end
    column :lat
    column :lon
    column :region
    column :photos, :sortable => true do |poi|
      link_to "Photos", admin_poi_photos_path(poi) if poi.photos.size > 0
    end
    default_actions
  end

  show :title => :headline do |poi|
    attributes_table do<commit_msg>Add wheelchair, type and category column.<commit_after>ActiveAdmin.register Poi do
  belongs_to :region, :optional => true
  belongs_to :node_type, :optional => true

  actions :index, :show


  scope :fully_accessible
  scope :limited_accessible
  scope :not_accessible
  scope :unknown_accessibility
  scope :has_provider
  scope :has_photo

  filter :category, :as => :select, :collection => proc { Category.all.inject([]){|memo,r| memo << [r.name, r.id]; memo}.sort }
  filter :node_type, :as => :select, :collection => proc { NodeType.all.inject([]){|memo,r| memo << [r.name, r.id]; memo}.sort }
  filter :region, :as => :select, :collection => proc { Region.all.inject([]){|memo,r| memo << [r.name, r.id]; memo}.sort }
  filter :version
  filter :tags
  filter :created_at
  filter :updated_at

  controller do

    before_filter :set_per_page, :only => :index, :if => Proc.new { |controller| controller.request.format == 'text/csv' }

    def update
      region = resource
      region.update_attributes(params[:poi])
      super
    end

    private

    def set_per_page
      @per_page = params[:per_page].blank? ? max_csv_records : params[:per_page].to_i
    end

    def max_csv_records
      100
    end

  end

  csv :force_quotes => true do
    column :id
    column :name
    column :lat
    column :lon
    column :street
    column :housenumber
    column :postcode
    column :city
    column :wheelchair
    column :type do |poi|
      poi.node_type.try(:identifier)
    end
    column :category do |poi|
      poi.category.try(:identifier)
    end
  end

  index do
    column :osm_id do |poi|
      link_to poi.osm_id, node_path(poi)
    end
    column :wheelchair do |poi|
      status_tag(poi.wheelchair, :class => poi.wheelchair)
    end
    column :version
    column :name
    column :node_type
    column :address do |p|
      span p.address
    end
    column :lat
    column :lon
    column :region
    column :photos, :sortable => true do |poi|
      link_to "Photos", admin_poi_photos_path(poi) if poi.photos.size > 0
    end
    default_actions
  end

  show :title => :headline do |poi|
    attributes_table do
{'fraction_non_alphanumeric': 0.11455788959452858, 'fraction_numerical': 0.0019540791402051783, 'mean_word_length': 3.0344827586206895, 'pattern_counts': {'":': 0, '<': 15, '<?xml version=': 0, '>': 33, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '59786', 'n_tokens_mistral': 1404, 'n_tokens_neox': 1360, 'n_words': 374}