Sha256: 4f80f58fbea4780c56b5dbc2db136749f401b4a718bb024a5b4f3d914f6556cc

Contents?: true

Size: 553 Bytes

Versions: 3

Compression:

Stored size: 553 Bytes

Contents

module ExpressAdmin
  class WidgetBox < ExpressTemplates::Components::Configurable
    emits -> (block) {
      div(class: 'widget-box', id: "#{config[:id].to_s.dasherize}-box") {
        header(class: 'title') { box_title }
        div(class: 'widget-body') {
          block.call(self) if block
        }
      }
    }

    protected

      def resource_name
        config[:id].to_s.titleize
      end

      def box_title
        config[:title] || (helpers.resource.persisted? ? "Edit #{resource_name}" : "New #{resource_name}")
      end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
express_admin-1.3.2 app/components/express_admin/widget_box.rb
express_admin-1.3.1 app/components/express_admin/widget_box.rb
express_admin-1.3.0 app/components/express_admin/widget_box.rb