Class: Hyrax::PermissionBadge

Inherits:
Object
  • Object
show all
Includes:
ActionView::Helpers::TagHelper
Defined in:
app/presenters/hyrax/permission_badge.rb

Constant Summary collapse

VISIBILITY_LABEL_CLASS =
{
  authenticated: "label-info",
  embargo: "label-warning",
  lease: "label-warning",
  open: "label-success",
  restricted: "label-danger"
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(visibility) ⇒ PermissionBadge

Returns a new instance of PermissionBadge.

Parameters:

  • visibility (String)

    the current visibility



14
15
16
# File 'app/presenters/hyrax/permission_badge.rb', line 14

def initialize(visibility)
  @visibility = visibility
end

Instance Method Details

#renderObject

Draws a span tag with styles for a bootstrap label



19
20
21
# File 'app/presenters/hyrax/permission_badge.rb', line 19

def render
  (:span, text, class: "label #{dom_label_class}")
end