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
-
#attributes ⇒ Object
Adding attributes hash to state to avoid having to pass it around.
-
#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.
-
#remove_access!(permission_template_access) ⇒ Void
This method is used to revoke access to an Admin Set and its workflows.
-
#update(attributes) ⇒ Hash{Symbol => String, Boolean}
rubocop:disable Metrics/MethodLength.
-
#update_management ⇒ Object
rubocop:enable Metrics/MethodLength.
- #visibility_options ⇒ Object
Constructor Details
#initialize(model) ⇒ PermissionTemplateForm
Returns a new instance of PermissionTemplateForm.
38 39 40 41 42 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 38 def initialize(model) super(model) # Ensure proper form options selected, based on model select_release_varies_option(model) end |
Instance Attribute Details
#attributes ⇒ Object
Adding attributes hash to state to avoid having to pass it around
24 25 26 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 24 def attributes @attributes end |
#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
26 27 28 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 26 def workflow_id @workflow_id || active_workflow.try(:id) end |
Instance Method Details
#embargo_options ⇒ Object
34 35 36 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 34 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 |
#remove_access!(permission_template_access) ⇒ Void
This method is used to revoke access to an Admin Set and its workflows
74 75 76 77 78 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 74 def remove_access!() construct_attributes_from_template_access!() admin_set.update_access_controls! update_workflow_responsibilities(remove_agent: true) end |
#update(attributes) ⇒ Hash{Symbol => String, Boolean}
rubocop:disable Metrics/MethodLength
48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 48 def update(attributes) @attributes = attributes return_info = { content_tab: tab_to_update } error_code = nil case return_info[:content_tab] when "participants" when "visibility" error_code = when "workflow" grant_workflow_roles end return_info[:error_code] = error_code if error_code return_info[:updated] = error_code ? false : true return_info end |
#update_management ⇒ Object
rubocop:enable Metrics/MethodLength
66 67 68 69 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 66 def update_management admin_set.update_access_controls! update_workflow_responsibilities end |
#visibility_options ⇒ Object
30 31 32 |
# File 'app/forms/hyrax/forms/permission_template_form.rb', line 30 def Widgets::AdminSetVisibility.new. end |