Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Backport] Allow for injection of new tabs on edit page #4450

Merged
merged 1 commit into from
Jul 16, 2020

Conversation

cjcolvar
Copy link
Member

This commit adds a new code seam allowing for the modification of tab
ordering and the addition (or removal) of tabs on a form by form basis.
The default tab order is moved out of the guts4form view partial and
into a helper.

To modify the default list of tabs in an application override the form_tabs_for helper method and make sure it gets loaded
after Hyrax::HyraxHelperBehavoir (by default included in app/helpers/hyrax_helper.rb). For example:

module WorksHelper
  def form_tabs_for(form:)
    super + ["my_new_tab"]
  end
end

A deprecation warning was added for cases where the view calling
guts4form doesn't pass the tabs local param.

The share tab has not been included in the default tab order because it
wasn't in the view partial. Future work is to simplify the guts4form
partial so share can be treated the same as the other tabs and included
in the default list.

Backport of #4440.

@samvera/hyrax-code-reviewers

This commit adds a new code seam allowing for the modification of tab
ordering and the addition (or removal) of tabs on a form by form basis.
The default tab order is moved out of the guts4form view partial and
into a helper.

To modify the default list of tabs in an application override the `form_tabs_for` helper method and make sure it gets loaded
after Hyrax::HyraxHelperBehavoir (by default included in app/helpers/hyrax_helper.rb). For example:
```
module WorksHelper
  def form_tabs_for(form:)
    super + ["my_new_tab"]
  end
end
```

A deprecation warning was added for cases where the view calling
guts4form doesn't pass the tabs local param.

The share tab has not been included in the default tab order because it
wasn't in the view partial.  Future work is to simplify the guts4form
partial so share can be treated the same as the other tabs and included
in the default list.

Backport of #4440.
@cjcolvar cjcolvar changed the title Allow for injection of new tabs on edit page [Backport] Allow for injection of new tabs on edit page Jul 16, 2020
@jeremyf jeremyf merged commit 3831615 into 2.x-stable Jul 16, 2020
@jeremyf jeremyf deleted the form-tabs-2x branch July 16, 2020 14:58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants