Module: Hyrax::WorkFormHelper

Included in:
HyraxHelperBehavior
Defined in:
app/helpers/hyrax/work_form_helper.rb

Instance Method Summary collapse

Instance Method Details

#form_progress_sections_forArray<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.

Examples:

with additional sections

Override this helper and ensure that it loads after Hyrax's helpers.
module WorksHelper
  def form_progress_sections_for(*)
    super + ["my_new_section"]
  end
end
Add the new section partial at app/views/hyrax/base/_form_progress_my_new_section.html.erb

Parameters:

Returns:

  • (Array<String>)

    the list of names of sections to be rendered in the form_progress panel



44
45
46
# File 'app/helpers/hyrax/work_form_helper.rb', line 44

def form_progress_sections_for(*)
  []
end

#form_tabs_for(form:) ⇒ Array<String>

TODO:

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.

Examples:

with additional tabs

Override this helper and ensure that it loads after Hyrax's helpers.
module WorksHelper
  def form_tabs_for(form:)
    super + ["my_new_tab"]
  end
end
Add the new section partial at app/views/hyrax/base/_form_my_new_tab.html.erb

Parameters:

Returns:

  • (Array<String>)

    the list of names of tabs to be rendered in the form



21
22
23
24
25
26
27
# File 'app/helpers/hyrax/work_form_helper.rb', line 21

def form_tabs_for(form:)
  if form.instance_of? Hyrax::Forms::BatchUploadForm
    %w[files metadata relationships]
  else
    %w[metadata files relationships]
  end
end