Sha256: 3d26ab33fc299ea327f830f1616cbcebe69d540341979fdbd5f9a24c7f6ae6f7

Contents?: true

Size: 976 Bytes

Versions: 30

Compression:

Stored size: 976 Bytes

Contents

class SchoolDatatable < AjaxDatatablesRails::Base
  def_delegators :@view, :link_to, :manage_school_path, :manage_bus_list_path

  def view_columns
    @view_columns ||= {
      id: { source: 'School.id', cond: :eq },
      name: { source: 'School.name' },
      city: { source: 'School.city' },
      state: { source: 'School.state' },
      questionnaire_count: { source: 'School.questionnaire_count', searchable: false }
    }
  end

  private

  def data
    records.map do |record|
      {
        link: link_to('<i class="fa fa-search"></i>'.html_safe, manage_school_path(record)),
        id: record.id,
        name: record.name,
        city: record.city,
        state: record.state,
        questionnaire_count: record.questionnaire_count,
        bus_list: record.bus_list ? link_to(record.bus_list.name, manage_bus_list_path(record.bus_list)) : ''
      }
    end
  end

  # rubocop:disable Style/AccessorMethodName
  def get_raw_records
    School.all
  end
end

Version data entries

30 entries across 30 versions & 1 rubygems

Version Path
hackathon_manager-0.6.6 app/datatables/school_datatable.rb
hackathon_manager-0.6.5 app/datatables/school_datatable.rb
hackathon_manager-0.6.4 app/datatables/school_datatable.rb
hackathon_manager-0.6.3 app/datatables/school_datatable.rb
hackathon_manager-0.6.2 app/datatables/school_datatable.rb
hackathon_manager-0.6.1 app/datatables/school_datatable.rb
hackathon_manager-0.6.0 app/datatables/school_datatable.rb
hackathon_manager-0.5.11 app/datatables/school_datatable.rb
hackathon_manager-0.5.10 app/datatables/school_datatable.rb
hackathon_manager-0.5.9 app/datatables/school_datatable.rb
hackathon_manager-0.5.8 app/datatables/school_datatable.rb
hackathon_manager-0.5.7 app/datatables/school_datatable.rb
hackathon_manager-0.5.6 app/datatables/school_datatable.rb
hackathon_manager-0.5.5 app/datatables/school_datatable.rb
hackathon_manager-0.5.4 app/datatables/school_datatable.rb
hackathon_manager-0.5.3 app/datatables/school_datatable.rb
hackathon_manager-0.5.2 app/datatables/school_datatable.rb
hackathon_manager-0.5.1 app/datatables/school_datatable.rb
hackathon_manager-0.5.0 app/datatables/school_datatable.rb
hackathon_manager-0.4.4 app/datatables/school_datatable.rb