Sha256: 3e17d2fff2a01ffd75eee19333da09db18f63f65a263f6088603b24765ba951f
Contents?: true
Size: 977 Bytes
Versions: 3
Compression:
Stored size: 977 Bytes
Contents
module Administrate module Page class Base def initialize(dashboard, options = {}) @dashboard = dashboard @options = options end def resource_name @resource_name ||= dashboard.class.to_s.scan(/(.+)Dashboard/).first.first.underscore end def resource_path @resource_path ||= resource_name.gsub("/", "_") end def association_includes dashboard.try(:association_includes) || [] end protected def attribute_field(dashboard, resource, attribute_name, page) value = get_attribute_value(resource, attribute_name) field = dashboard.attribute_type_for(attribute_name) field.new(attribute_name, value, page, resource: resource) end def get_attribute_value(resource, attribute_name) resource.public_send(attribute_name) rescue NameError nil end attr_reader :dashboard, :options end end end
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
administrate-0.11.0 | lib/administrate/page/base.rb |
semantic-administrate-0.10.1 | lib/administrate/page/base.rb |
semantic-administrate-0.10.0 | lib/administrate/page/base.rb |