Sha256: b20a5f8ad4a1fdcac24099a1137d7df584af52c07948ad0c8ec1a72c26f19bd4

Contents?: true

Size: 1.21 KB

Versions: 39

Compression:

Stored size: 1.21 KB

Contents

class <%= class_name %>Decorator < Tramway::Core::ApplicationDecorator
  # Associations you want to show in admin dashboard
  # decorate_associations :messages, :posts

  delegate_attributes(
<% attributes.each do |attr| -%>
        :<%= attr %>,
<% end -%>
  )

  class << self
    def collections
      # [ :all, :scope1, :scope2 ]
      [ :all ]
    end

    def list_attributes
      [
<% attributes.first(COLLECTION_ATTRIBUTE_LIMIT).each do |attr| -%>
        :<%= attr %>,
<% end -%>
      ]
    end

    def show_attributes
      [
<% attributes.each do |attr| -%>
        :<%= attr %>,
<% end -%>
      ]
    end

    def show_associations
      # Associations you want to show in admin dashboard
      # [ :messages ]
    end

    def list_filters
      # {
      #   filter_name: {
      #     type: :select,
      #     select_collection: filter_collection,
      #     query: lambda do |list, value|
      #       list.where some_attribute: value
      #     end
      #   },
      #   date_filter_name: {
      #     type: :dates,
      #     query: lambda do |list, begin_date, end_date|
      #       list.where 'created_at > ? AND created_at < ?', begin_date, end_date
      #     end
      #   }
      # }
    end
  end
end

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
tramway-admin-5.0 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.1.2.1 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.1.2 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.1.1.5 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.1.1.4 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.1.1.3 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.1.1.2 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.1.1.1 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.1.1 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.1.0.1 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.1 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.0.1.1 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.0.1 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.0.0.1 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-4.0 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-3.0.1.1 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-3.0.1 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-3.0 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-2.1.3.3 lib/tramway/admin/generators/templates/decorator.rb.erb
tramway-admin-2.1.3.2 lib/tramway/admin/generators/templates/decorator.rb.erb