Sha256: 45891a933a299673091319772566dd5c5743b6739cd8f7f0138d44bd2a96a67c
Contents?: true
Size: 961 Bytes
Versions: 48
Compression:
Stored size: 961 Bytes
Contents
module Hyrax class PermissionBadge include ActionView::Helpers::TagHelper VISIBILITY_LABEL_CLASS = { authenticated: "label-info", embargo: "label-warning", lease: "label-warning", open: "label-success", restricted: "label-danger" }.freeze # @param visibility [String] the current visibility def initialize(visibility) @visibility = visibility end # Draws a span tag with styles for a bootstrap label def render content_tag(:span, text, class: "label #{dom_label_class}") end private def dom_label_class VISIBILITY_LABEL_CLASS.fetch(@visibility.to_sym) end def text if registered? Institution.name else I18n.t("hyrax.visibility.#{@visibility}.text") end end def registered? @visibility == Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED end end end
Version data entries
48 entries across 48 versions & 1 rubygems