Module: CurationConcerns::AbilityHelper
- Included in:
- MainAppHelpers
- Defined in:
- app/helpers/curation_concerns/ability_helper.rb
Instance Method Summary collapse
-
#can_ever_create_works? ⇒ Boolean
Returns true if can create at least one type of work.
- #visibility_badge(value) ⇒ Object
- #visibility_options(variant) ⇒ Object
Instance Method Details
#can_ever_create_works? ⇒ Boolean
Returns true if can create at least one type of work
4 5 6 7 8 9 10 11 |
# File 'app/helpers/curation_concerns/ability_helper.rb', line 4 def can_ever_create_works? can = false CurationConcerns.config.curation_concerns.each do |curation_concern_type| break if can can = can?(:create, curation_concern_type) end can end |
#visibility_badge(value) ⇒ Object
29 30 31 32 |
# File 'app/helpers/curation_concerns/ability_helper.rb', line 29 def visibility_badge(value) klass = t("curation_concerns.visibility.#{value}.class", default: 'label-info') content_tag :span, visibility_text(value), class: "label #{klass}" end |
#visibility_options(variant) ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'app/helpers/curation_concerns/ability_helper.rb', line 13 def (variant) = [ Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PUBLIC, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_AUTHENTICATED, Hydra::AccessControls::AccessRight::VISIBILITY_TEXT_VALUE_PRIVATE ] case variant when :restrict .delete_at(0) .reverse! when :loosen .delete_at(2) end .map { |value| [visibility_text(value), value] } end |