Class: Hyrax::Forms::PermissionTemplateForm
- Inherits:
-
Object
- Object
- Hyrax::Forms::PermissionTemplateForm
- Includes:
- HydraEditor::Form
- Defined in:
- app/forms/hyrax/forms/permission_template_form.rb
Instance Attribute Summary collapse
-
#release_embargo ⇒ Object
Selected release embargo timeframe (if any) under release “Varies” option.
-
#release_varies ⇒ Object
Stores which radio button under release “Varies” option is selected.
- #workflow_id ⇒ Object
Instance Method Summary collapse
- #embargo_options ⇒ Object
-
#id ⇒ #to_s
def admin_set_id (because you might come looking for this method).
-
#initialize(model) ⇒ PermissionTemplateForm
constructor
A new instance of PermissionTemplateForm.
-
#update(attributes) ⇒ Hash{Symbol => String, Boolean}
{ :content_tab (for confirmation message), :updated (true/false), :error_code (for flash error lookup) }.
-
#update_management ⇒ Object
If management roles have been granted or removed, then copy this access to the edit permissions of the AdminSet and to the WorkflowResponsibilities of the active workflow.
- #visibility_options ⇒ Object
Constructor Details
#initialize(model) ⇒ PermissionTemplateForm
Returns a new instance of PermissionTemplateForm.
35 36 37 38 39 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 35 def initialize(model) super(model) # Ensure proper form options selected, based on model select_release_varies_option(model) end |
Instance Attribute Details
#release_embargo ⇒ Object
Selected release embargo timeframe (if any) under release “Varies” option
18 19 20 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 18 def @release_embargo end |
#release_varies ⇒ Object
Stores which radio button under release “Varies” option is selected
16 17 18 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 16 def release_varies @release_varies end |
#workflow_id ⇒ Object
23 24 25 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 23 def workflow_id @workflow_id || active_workflow.try(:id) end |
Instance Method Details
#embargo_options ⇒ Object
31 32 33 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 31 def Widgets::AdminSetEmbargoPeriod.new. end |
#id ⇒ #to_s
def admin_set_id (because you might come looking for this method)
13 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 13 delegate :id, to: :admin_set, prefix: :admin_set |
#update(attributes) ⇒ Hash{Symbol => String, Boolean}
Returns { :content_tab (for confirmation message), :updated (true/false),
:error_code (for flash error lookup) }.
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 44 def update(attributes) return_info = { content_tab: tab_to_update(attributes) } error_code = nil case return_info[:content_tab] when "participants" (attributes) when "visibility" error_code = (attributes) when "workflow" grant_workflow_roles(attributes) end return_info[:error_code] = error_code if error_code return_info[:updated] = error_code ? false : true return_info end |
#update_management ⇒ Object
If management roles have been granted or removed, then copy this access to the edit permissions of the AdminSet and to the WorkflowResponsibilities of the active workflow
63 64 65 66 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 63 def update_management admin_set.update_access_controls! update_workflow_approving_responsibilities end |
#visibility_options ⇒ Object
27 28 29 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 27 def Widgets::AdminSetVisibility.new. end |