Sha256: 5678e72d6914737379378fa6ad99270d103783e685e4dafce25ab1a6ad4cf61f
Contents?: true
Size: 1.46 KB
Versions: 2
Compression:
Stored size: 1.46 KB
Contents
module ActiveAdmin module Pages class Index class Table < Renderer def to_html(page_config, collection) wrap_with_pagination(collection, :entry_name => active_admin_config.resource_name) do table_options = { :id => active_admin_config.plural_resource_name.underscore, :sortable => true, :class => "index_table" } TableBuilder.new(&page_config.block).to_html(self, collection, table_options) end end # # Extend the default ActiveAdmin::TableBuilder with some # methods for quickly displaying items on the index page # class TableBuilder < ::ActiveAdmin::TableBuilder # Display a column for the id def id column 'ID', :id end # Adds links to View, Edit and Delete def default_actions(options = {}) options = { :name => "" }.merge(options) column options[:name] do |resource| links = link_to "View", resource_path(resource) links += " | " links += link_to "Edit", edit_resource_path(resource) links += " | " links += link_to "Delete", resource_path(resource), :method => :delete, :confirm => "Are you sure you want to delete this?" links end end end # TableBuilder end # Table end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
activeadmin-0.1.1 | lib/active_admin/pages/index/table.rb |
activeadmin-0.1.0 | lib/active_admin/pages/index/table.rb |