Module: Hyrax::WorkFormHelper
- Included in:
- HyraxHelperBehavior
- Defined in:
- app/helpers/hyrax/work_form_helper.rb
Instance Method Summary collapse
-
#admin_set_options ⇒ Array<Array<String, String, Hash>] options for the admin set drop down.
Array<Array<String, String, Hash>] options for the admin set drop down.
-
#form_file_set_select_for(parent:) ⇒ Array<Hash{String => String}>
Constructs a hash for a form ‘select`.
-
#form_progress_sections_for ⇒ Array<String>
This helper allows downstream applications and engines to add additional sections to be rendered after the visibility section in the Save Work panel on the work form.
-
#form_tab_label_for(form:, tab:) ⇒ String
This helper allows downstream applications and engines to change the label of tabs to be rendered on the work form.
-
#form_tabs_for(form:) ⇒ Array<String>
This helper allows downstream applications and engines to add/remove/reorder the tabs to be rendered on the work form.
Instance Method Details
#admin_set_options ⇒ Array<Array<String, String, Hash>] options for the admin set drop down.
this implementation hits database backends (solr) and is invoked from views. refactor to avoid
Returns Array<Array<String, String, Hash>] options for the admin set drop down.
8 9 10 11 12 13 |
# File 'app/helpers/hyrax/work_form_helper.rb', line 8 def return @admin_set_options. if @admin_set_options service = Hyrax::AdminSetService.new(controller) Hyrax::AdminSetOptionsPresenter.new(service). end |
#form_file_set_select_for(parent:) ⇒ Array<Hash{String => String}>
Constructs a hash for a form ‘select`.
89 90 91 92 93 94 95 96 97 98 99 |
# File 'app/helpers/hyrax/work_form_helper.rb', line 89 def form_file_set_select_for(parent:) return parent.select_files if parent.respond_to?(:select_files) return {} unless parent.respond_to?(:member_ids) file_sets = Hyrax::PcdmMemberPresenterFactory.new(parent, nil).file_set_presenters file_sets.each_with_object({}) do |presenter, hash| hash[presenter.title_or_label] = presenter.id end end |
#form_progress_sections_for ⇒ Array<String>
This helper allows downstream applications and engines to add additional sections to be rendered after the visibility section in the Save Work panel on the work form.
78 79 80 |
# File 'app/helpers/hyrax/work_form_helper.rb', line 78 def form_progress_sections_for(*) [] end |
#form_tab_label_for(form:, tab:) ⇒ String
This helper allows downstream applications and engines to change the label of tabs to be rendered on the work form.
59 60 61 |
# File 'app/helpers/hyrax/work_form_helper.rb', line 59 def form_tab_label_for(form:, tab:) # rubocop:disable Lint/UnusedMethodArgument t("hyrax.works.form.tab.#{tab}") end |
#form_tabs_for(form:) ⇒ Array<String>
The share tab isn’t included because it wasn’t in guts4form. guts4form should be cleaned up so share is treated the same as other tabs and can be included below.
This helper allows downstream applications and engines to add/remove/reorder the tabs to be rendered on the work form.
32 33 34 35 36 37 38 |
# File 'app/helpers/hyrax/work_form_helper.rb', line 32 def form_tabs_for(form:) if form.instance_of? Hyrax::Forms::BatchUploadForm %w[files metadata relationships] else %w[metadata files relationships] end end |