Skip to content

Commit

Permalink
Migrate requireJS to ES6. Solr BE Module JS
Browse files Browse the repository at this point in the history
* Migrate requireJS to ES6. Solr BE Module JS
* Add js as file extension for JavaScript modules
* Repair modal window in index administration module

Relates: #4043
  • Loading branch information
sfroemkenjw committed May 16, 2024
1 parent 0b27705 commit eda13b2
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<f:layout name="Backend/WithPageTree"/>

<f:section name="Main">
<f:be.pageRenderer includeRequireJsModules="{0:'TYPO3/CMS/Solr/FormModal'}"/>
<f:be.pageRenderer includeJavaScriptModules="{0: '@apache-solr-for-typo3/solr/FormModal.js'}"/>

<div class="row">
<div class="col-xs-12">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<f:layout name="Backend/WithPageTree"/>

<f:section name="Main">
<f:be.pageRenderer includeCssFiles="{0: 'EXT:solr/Resources/Public/StyleSheets/Backend/IndexQueueModule.css'}" includeRequireJsModules="{0:'TYPO3/CMS/Solr/FormModal'}"/>
<f:be.pageRenderer includeCssFiles="{0: 'EXT:solr/Resources/Public/StyleSheets/Backend/IndexQueueModule.css'}" includeJavaScriptModules="{0: '@apache-solr-for-typo3/solr//FormModal.js'}"/>

<h1>Index Queue</h1>
<p class="lead"><f:translate key="solr.backend.index_queue_module.description" /></p>
Expand Down
60 changes: 28 additions & 32 deletions Resources/Public/JavaScript/FormModal.js
Original file line number Diff line number Diff line change
@@ -1,34 +1,30 @@
define([
'jquery',
'TYPO3/CMS/Backend/Modal'
], function($, Modal) {
$(document).ready(function() {
import $ from 'jquery';
import Modal from '@typo3/backend/modal.js';

$(document).ready(() => {
$('.t3js-modal-formsubmit-trigger').click(function(){
const element = $(this);
const title = element.data('title');
const content = element.data('content');
let severity = typeof top.TYPO3.Severity[element.data('severity')] !== 'undefined'
? top.TYPO3.Severity[element.data('severity')]
: top.TYPO3.Severity.info;

$('.t3js-modal-formsubmit-trigger').click(function(){

var element = $(this);
var title = element.data('title');
var content = element.data('content');
var severity = (typeof top.TYPO3.Severity[element.data('severity')] !== 'undefined') ? top.TYPO3.Severity[element.data('severity')] : top.TYPO3.Severity.info;

Modal.confirm(title, content, severity, [
{
text: 'Confirm',
active: true,
trigger: function() {
element.parents('form:first').submit();
Modal.dismiss();
}
}, {
text: 'Abort!',
trigger: function() {
Modal.dismiss();
}
}
]);

return false;
})
});
});
Modal.confirm(title, content, severity, [
{
text: 'Confirm',
active: true,
trigger: function() {
element.parents('form:first').submit();
Modal.dismiss();
}
}, {
text: 'Abort!',
trigger: function() {
Modal.dismiss();
}
}
]);
return false;
});
});

0 comments on commit eda13b2

Please sign in to comment.