Skip to content

Commit

Permalink
Fix JS assets not loading
Browse files Browse the repository at this point in the history
  • Loading branch information
Thource committed Feb 13, 2025
1 parent ae36a54 commit b4f728c
Show file tree
Hide file tree
Showing 11 changed files with 16 additions and 127 deletions.
12 changes: 5 additions & 7 deletions assets/js/establishment-roll.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
const landingRows = document.querySelectorAll('.establishment-roll__table__landing-row')
const spurRows = document.querySelectorAll('.establishment-roll__table__spur-row')
const wingRows = document.querySelectorAll('.establishment-roll__table__wing-row')
const totalsRow = document.querySelector('#roll-table-totals-row')
module.exports = () => {
const landingRows = document.querySelectorAll('.establishment-roll__table__landing-row')
const spurRows = document.querySelectorAll('.establishment-roll__table__spur-row')
const wingRows = document.querySelectorAll('.establishment-roll__table__wing-row')
const totalsRow = document.querySelector('#roll-table-totals-row')

function init() {
;[...landingRows, ...spurRows].forEach(row => {
row.setAttribute('hidden', 'hidden')
})
Expand Down Expand Up @@ -45,5 +45,3 @@ function init() {
wingNameCell.replaceChildren(wingLink)
})
}

init()
3 changes: 0 additions & 3 deletions assets/js/govukFrontendInit.js

This file was deleted.

2 changes: 0 additions & 2 deletions assets/js/index.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,10 @@
import * as govukFrontend from 'govuk-frontend'
import * as mojFrontend from '@ministryofjustice/frontend'
import establishmentRoll from './establishment-roll'
import initMoj from './initMoj'
import printPage from './printPage'

govukFrontend.initAll()
mojFrontend.initAll()
establishmentRoll()
printPage()
initMoj()

1 change: 0 additions & 1 deletion assets/js/initMoj.js

This file was deleted.

18 changes: 10 additions & 8 deletions assets/js/printPage.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
const printLinks = document.querySelectorAll('.print-link')
module.exports = () => {
const printLinks = document.querySelectorAll('.print-link')

if (printLinks?.length) {
printLinks.forEach(el =>
el.addEventListener('click', evt => {
evt.preventDefault()
window.print()
}),
)
if (printLinks?.length) {
printLinks.forEach(el =>
el.addEventListener('click', evt => {
evt.preventDefault()
window.print()
}),
)
}
}
14 changes: 0 additions & 14 deletions server/views/macros/hmppsPagedListFooter.njk

This file was deleted.

17 changes: 0 additions & 17 deletions server/views/macros/hmppsPagedListHeader.njk

This file was deleted.

31 changes: 0 additions & 31 deletions server/views/macros/hmppsPagination.njk

This file was deleted.

36 changes: 0 additions & 36 deletions server/views/macros/hmppsSortSelector.njk

This file was deleted.

4 changes: 0 additions & 4 deletions server/views/pages/establishmentRoll.njk
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,3 @@
</table>
</div>
{% endblock %}

{% block pageScripts %}
<script src="/assets/establishment-roll.js"></script>
{% endblock %}
5 changes: 1 addition & 4 deletions server/views/partials/layout.njk
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,7 @@
{% endblock %}

{% block bodyEnd %}
<script type="module" src="/assets/govukFrontendInit.js"></script>
<script src="/assets/moj/all.js"></script>
<script src="/assets/printPage.js"></script>
<script src="/assets/initMoj.js"></script>
<script type="module" src="{{ '/assets/js/app.js' | assetMap }}"></script>

{% block pageScripts %}
{% endblock %}
Expand Down

0 comments on commit b4f728c

Please sign in to comment.