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

Re-enables nav-tabs for hydra apps #836

Merged
merged 1 commit into from
Jul 17, 2023
Merged

Conversation

summer-cook
Copy link
Contributor

@summer-cook summer-cook commented Jul 17, 2023

  • Breaking change: Hyku applications will need to move the require statement for bulkrax's javascript ( //= require bulkrax/application) above the require statements for the dataTables javascript (//= require dataTables/jquery.dataTables //= require dataTables/bootstrap/3/jquery.dataTables.bootstrap) in their local application.js. This has since been updated in the generator for bulkrax so it will be in the correct place for future installations.

Summary

Bootstrap's javascript files were not included by default and bulkrax was relying on the parent application for some of its js to work.
this PR includes bootstrap (and jquery dependency), makes sure they all load in the same order, and activates the nav tabs on the importer/show page.

likely reason the tabs need to be initialized separately in this case Bootstrap's JavaScript components, including the tabs functionality, require manual initialization in certain cases. This is because the default behavior of Bootstrap's JavaScript is to automatically initialize the components on page load. However, when using frameworks like Turbolinks or loading content dynamically, the JavaScript initialization may not occur automatically.

In your case, since you mentioned that you are working within a Rails gem, which is inside another Rails project, it's possible that the application's JavaScript files are not being loaded or initialized correctly due to the structure of the project or the usage of Turbolinks.

By explicitly adding the JavaScript initialization code, you ensure that the tab functionality is properly triggered when the page is loaded or when the tab links are clicked. This approach bypasses any potential conflicts or issues that may be preventing the automatic initialization.

So, while Bootstrap's tabs.js file is present in your app, adding the initialization code manually guarantees that the tab functionality is consistently applied, regardless of the project's structure or other factors that may affect the automatic initialization.

It's worth noting that Bootstrap's JavaScript components are designed to be flexible and work with different frameworks and setups. This means that manual initialization may be necessary in certain scenarios to ensure proper functionality.

Related

scientist-softserv/west-virginia-university#82

Acceptance Criteria

  • Navtabs work for on the importers/:id & exporters/:id pages

Videos

Before: https://share.getcloudapp.com/E0uLgQL9
After: https://share.getcloudapp.com/E0uLgQR9

@summer-cook summer-cook merged commit 32dace9 into main Jul 17, 2023
6 of 7 checks passed
@summer-cook summer-cook deleted the fix-navtabs-for-hydra branch July 17, 2023 18:05
kirkkwang added a commit that referenced this pull request Jul 20, 2023
This commit will alter the install generator to move the require for
bulkrax/application above dataTables require.  This was causing jquery
errors in Hyku applications because of recent changes.

Ref:
  - #836
@summer-cook summer-cook added the breaking-change for release notes label Jul 20, 2023
kirkkwang added a commit to scientist-softserv/utk-hyku that referenced this pull request Jul 20, 2023
This commit will update the revisions of `Bulkrax` and `AllinsonFlex` to
the latest versions to bring in the views changes for the admin
dashboard sidebar.  Also, this commit moves the js require for Bulkrax
up above the dataTables require to fix the issue with the admin jquery
throwing errors.  This was likely due to a recent change to make Bulkrax
work better with Hydra.

Ref:
  - samvera/bulkrax#836
  - samvera-labs/allinson_flex#120
  - samvera/bulkrax#838
kirkkwang added a commit to scientist-softserv/utk-hyku that referenced this pull request Jul 21, 2023
This commit will update the revisions of `Bulkrax` and `AllinsonFlex` to
the latest versions to bring in the views changes for the admin
dashboard sidebar.  Also, this commit moves the js require for Bulkrax
up above the jQuery requires to fix the issue with the admin jQuery
throwing errors.  This was likely due to a recent change to make Bulkrax
work better with Hydra.

Ref:
  - samvera/bulkrax#836
  - samvera-labs/allinson_flex#120
  - samvera/bulkrax#838
@kirkkwang kirkkwang removed the breaking-change for release notes label Jul 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
patch-ver for release notes
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants