Skip to content

Commit

Permalink
[TASK] Update JavaScript for upcoming powermail version 10
Browse files Browse the repository at this point in the history
  • Loading branch information
einpraegsam committed Apr 8, 2022
1 parent a22a1c0 commit d5ab72c
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 13 deletions.
1 change: 1 addition & 0 deletions Configuration/TypoScript/setup.typoscript
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ plugin.tx_powermail {
}

page.includeJSFooter.powermailextended = EXT:powermailextended/Resources/Public/JavaScripts/ZipValidation.js
page.includeJSFooter.powermailextended.defer = 1


# Add new Field Properties
Expand Down
17 changes: 10 additions & 7 deletions Resources/Public/JavaScripts/ZipValidation.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
/**
* <input type="text" data-parsley-custom100="1" data-parsley-error-message="Please try again" />
* <input type="text" data-powermail-custom100="80000" data-powermail-error-message="Please try again" />
*/
window.Parsley.addValidator(
'custom100', function (value, requirement) {
if (value >= 80000) {
return true;
const forms = document.querySelectorAll('.powermail_form');
forms.forEach(function(form) {
let formValidation = form.powermailFormValidation;

formValidation.addValidator('custom100', function(field) {
if (field.hasAttribute('data-powermail-custom100')) {
return field.value < parseInt(field.getAttribute('data-powermail-custom100'));
}
return false;
}, 32)
.addMessage('en', 'custom100', 'Error');
});
});
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@
}
],
"type": "typo3-cms-extension",
"license": "GPL-3.0",
"license": "GPL-2.0-or-later",
"require": {
"typo3/cms": "^10.4",
"in2code/powermail": "^8.0"
"typo3/cms-core": "^11.5",
"in2code/powermail": ">=9.0.0"
},
"autoload": {
"psr-4": {
Expand Down
6 changes: 3 additions & 3 deletions ext_emconf.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,15 @@
'description' => 'Sample Extension to extend powermail:
Add new validators, Add new Fieldtypes or Add new Field Properties',
'category' => 'plugin',
'version' => '4.0.0',
'version' => '5.0.0',
'state' => 'beta',
'author' => 'Powermail dev team',
'author_email' => 'alexander.kellner@in2code.de',
'author_company' => 'in2code.de',
'constraints' => [
'depends' => [
'typo3' => '10.4.0-10.99.99',
'powermail' => '8.0.0-8.99.99',
'typo3' => '11.5.0-11.5.99',
'powermail' => '9.0.0-0.0.0',
],
'conflicts' => [],
'suggests' => [],
Expand Down

0 comments on commit d5ab72c

Please sign in to comment.