Sha256: 096b51cae96bda81b68f69e27551f9da869b37ee862206628def01c4137526f8
Contents?: true
Size: 668 Bytes
Versions: 48
Compression:
Stored size: 668 Bytes
Contents
module ExpressAdmin class WidgetBox < ExpressTemplates::Components::Configurable has_option :title, 'The title to be displayed.' contains -> (&block) { header(class: 'title') { box_title } div(class: 'widget-body') { block.call(self) if block } } before_build -> { set_attribute(:id, "#{config[:id].to_s.dasherize}-box") } protected def resource_title config[:id].to_s.titleize end def box_title config[:title] || (resource.persisted? ? "Edit #{resource_title}" : "New #{resource_title}") end def resource self.send(config[:id]) end end end
Version data entries
48 entries across 48 versions & 1 rubygems