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: "badge-info",
  embargo: "badge-warning",
  lease: "badge-warning",
  open: "badge-success",
  restricted: "badge-danger"
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(visibility) ⇒ PermissionBadge

Returns a new instance of PermissionBadge.

Parameters:

  • visibility (String)

    the current visibility



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

def initialize(visibility)
  @visibility = visibility
end

Instance Method Details

#renderObject

Draws a span tag with styles for a bootstrap label



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

def render
  tag.span(text, class: "badge #{dom_label_class}")
end