Skip to content

Commit

Permalink
[TASK] Move inline history.back() scripts to Module.js
Browse files Browse the repository at this point in the history
  • Loading branch information
einpraegsam committed Oct 30, 2024
1 parent 16145de commit cae6505
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 7 deletions.
10 changes: 10 additions & 0 deletions Resources/Private/Build/JavaScript/Backend/Module.js
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@ const LuxBackend = function() {
addUnitAjaxListener();
addSelectSubmitListener();
addRangeLabelListener();
addHistoryBackListener();
};

/**
Expand Down Expand Up @@ -380,6 +381,15 @@ const LuxBackend = function() {
});
}

const addHistoryBackListener = function() {
const elements = document.querySelectorAll('[data-lux-historyback]');
elements.forEach(function(element) {
element.addEventListener('click', (event) => {
window.history.back();
});
});
}

/**
* @param {string} elements
* @param {string} className
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Templates/General/Information.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<a href="https://www.in2code.de/?utm_campaign=LUX+Community+Version&utm_id=llcv&utm_source=typo3&utm_medium=browser&utm_content=information" target="_blank" rel="noopener">in2code.de - Wir leben TYPO3</a>
</p>

<button onclick="window.history.back();" class="btn btn-primary">
<button class="btn btn-primary" data-lux-historyback="1">
<f:translate key="LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:back">go back</f:translate>
</button>
</f:section>
Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Templates/Lead/Company.html
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ <h3>{company.title}</h3>
<f:section name="Buttons">
<div class="row" style="padding-bottom: 20px;">
<div class="col-md-12">
<button onclick="window.history.back();" class="btn btn-primary">
<button class="btn btn-primary" data-lux-historyback="1">
<f:translate key="LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:back">go back</f:translate>
</button>

Expand Down
2 changes: 1 addition & 1 deletion Resources/Private/Templates/Lead/Detail.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@

<div class="row" style="padding-bottom: 20px;">
<div class="col-md-12">
<button onclick="window.history.back();" class="btn btn-primary">
<button class="btn btn-primary" data-lux-historyback="1">
<f:translate key="LLL:EXT:lux/Resources/Private/Language/locallang_db.xlf:back">go back</f:translate>
</button>

Expand Down
2 changes: 1 addition & 1 deletion Resources/Public/JavaScript/Lux/Module.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cae6505

Please sign in to comment.