Sha256: 9cab03582609d86f7c517223251b8276167830d671795949bc47d5128fc36517

Contents?: true

Size: 459 Bytes

Versions: 2

Compression:

Stored size: 459 Bytes

Contents

module ExpressAdmin
  class WidgetBox < ExpressTemplates::Components::Column
    emits -> {
      div._widget_box(id: "#{my[:id].to_s.dasherize}-box") {
        header.title(box_title)
        div._widget_body {
          _yield
        }
      }
    }

    protected

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

      def box_title
        "{{resource.persisted? ? 'Edit #{resource_name}' : 'New #{resource_name}'}}"
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
express_admin-1.2.1 app/components/express_admin/widget_box.rb
express_admin-1.2.0 app/components/express_admin/widget_box.rb