Sha256: 6527539c11f6d8ff9ae8b852b9002aec77475194cc072ab1808dfe56268bfb6d

Contents?: true

Size: 576 Bytes

Versions: 4

Compression:

Stored size: 576 Bytes

Contents

module AdminIt
  class TilesContext < CollectionContext
    dsl do
      dsl_accessor :header do |value|
        field = fields.find { |f| f.field_name == value }
        field.nil? ? header : field.field_name
      end
    end

    class << self
      attr_reader :header

      protected

      def default_icon
        'th'
      end
    end

    def self.header
      fields.empty? ? nil : fields.first.name
    end

    def self.path
      AdminIt::Engine.routes
        .url_helpers.send("tiles_#{resource.plural}_path")
    end

    class_attr_reader :header
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
admin_it-1.0.11 lib/admin_it/context/tiles_context.rb
admin_it-1.0.10 lib/admin_it/context/tiles_context.rb
admin_it-1.0.9 lib/admin_it/context/tiles_context.rb
admin_it-1.0.8 lib/admin_it/context/tiles_context.rb