Sha256: 359dcb2712823314483550d1dc663cc6093f5cd9c1dc801d946164908a519be4
Contents?: true
Size: 1.18 KB
Versions: 2
Compression:
Stored size: 1.18 KB
Contents
# -*- encoding : utf-8 -*- module RademadeAdmin module Model class Configuration attr_reader :parent_menu_item, :list_fields, :form_fields def initialize(controller_name) @controller_name = controller_name end def model_name @model_name ||= @controller_name.classify end def item_name @item_name ||= model_name.underscore.gsub('/', '_').humanize end def model_class @model_class ||= RademadeAdmin::LoaderService.const_get(model_name) end private def model(model_name) @model_name = model_name end def item(item_name) @item_name = item_name end def parent_menu(parent_menu_item) @parent_menu_item = parent_menu_item end def list(*field_options, &block) @list_fields = fields(*field_options, &block) end def form(*field_options, &block) @form_fields = fields(*field_options, &block) end def fields(*field_options, &block) model_fields = block_given? ? Fields.init_from_block(&block) : Fields.init_from_options(field_options) model_fields.fields end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rademade_admin-0.0.3 | lib/rademade_admin/model/configuration.rb |
rademade_admin-0.0.2 | lib/rademade_admin/model/configuration.rb |