Class: CurationConcerns::WorkflowPresenter
- Inherits:
-
Object
- Object
- CurationConcerns::WorkflowPresenter
- Defined in:
- app/presenters/curation_concerns/workflow_presenter.rb
Instance Attribute Summary collapse
-
#current_ability ⇒ Object
readonly
Returns the value of attribute current_ability.
-
#solr_document ⇒ Object
readonly
Returns the value of attribute solr_document.
Instance Method Summary collapse
-
#actions ⇒ Object
Returns an array of tuples (key, label) appropriate for a radio group.
- #comments ⇒ Object
-
#initialize(solr_document, current_ability) ⇒ WorkflowPresenter
constructor
A new instance of WorkflowPresenter.
- #state ⇒ Object
-
#state_label ⇒ Object
TODO: maybe i18n here?.
Constructor Details
#initialize(solr_document, current_ability) ⇒ WorkflowPresenter
Returns a new instance of WorkflowPresenter.
3 4 5 6 |
# File 'app/presenters/curation_concerns/workflow_presenter.rb', line 3 def initialize(solr_document, current_ability) @solr_document = solr_document @current_ability = current_ability end |
Instance Attribute Details
#current_ability ⇒ Object (readonly)
Returns the value of attribute current_ability.
8 9 10 |
# File 'app/presenters/curation_concerns/workflow_presenter.rb', line 8 def current_ability @current_ability end |
#solr_document ⇒ Object (readonly)
Returns the value of attribute solr_document.
8 9 10 |
# File 'app/presenters/curation_concerns/workflow_presenter.rb', line 8 def solr_document @solr_document end |
Instance Method Details
#actions ⇒ Object
Returns an array of tuples (key, label) appropriate for a radio group
20 21 22 23 24 |
# File 'app/presenters/curation_concerns/workflow_presenter.rb', line 20 def actions return [] unless sipity_entity && current_ability actions = CurationConcerns::Workflow::PermissionQuery.scope_permitted_workflow_actions_available_for_current_state(entity: sipity_entity, user: current_ability.current_user) actions.map { |action| [action.name, action_label(action)] } end |
#comments ⇒ Object
26 27 28 29 |
# File 'app/presenters/curation_concerns/workflow_presenter.rb', line 26 def comments return [] unless sipity_entity sipity_entity.comments end |
#state ⇒ Object
10 11 12 |
# File 'app/presenters/curation_concerns/workflow_presenter.rb', line 10 def state sipity_entity.workflow_state_name if sipity_entity end |
#state_label ⇒ Object
TODO: maybe i18n here?
15 16 17 |
# File 'app/presenters/curation_concerns/workflow_presenter.rb', line 15 def state_label state end |