Sha256: dc8854b6b210b00323fef653234b58c2aeccb6b6a40bcad6ab9c5279b91f6b85

Contents?: true

Size: 1.22 KB

Versions: 4

Compression:

Stored size: 1.22 KB

Contents

class <%= class_name %>Table < TableCloth::Base
  # To include actions on this table, uncomment this line
  # include TableCloth::Extensions::Actions

  # Define columns with the #column method
  # column :name, :email

  # Columns can be provided a block
  #
  # column :name do |object|
  #   object.downcase
  # end
  #
  # Columns can also have conditionals if you want.
  # The conditions are checked against the table's methods.
  # As a convience, the table has a #view method which will return the current view context.
  # This gives you access to current user, params, etc...
  #
  # column :email, if: :admin?
  #
  # def admin?
  #   view.current_user.admin?
  # end
  #
  # Actions give you the ability to create a column for any actions you'd like to provide.
  # Pass a block with an arity of 2, (object, view context).
  # You can add as many actions as you want.
  # Make sure you include the actions extension.
  #
  # actions do
  #   action {|object| link_to "Edit", edit_object_path(object) }
  #   action(if: :valid?) {|object| link_to "Invalidate", invalidate_object_path(object) }
  # end
  # 
  # If action provides an "if:" option, it will call that method on the object. It can also take a block with an arity of 1.
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
table_cloth-0.3.1.alpha1 lib/generators/templates/table.rb
table_cloth-0.3.0.beta3 lib/generators/templates/table.rb
table_cloth-0.3.0.beta2 lib/generators/templates/table.rb
table_cloth-0.3.0.beta1 lib/generators/templates/table.rb