Author: echatellier Date: 2014-07-02 16:16:13 +0200 (Wed, 02 Jul 2014) New Revision: 317 Url: http://forge.codelutin.com/projects/faxtomail/repository/revisions/317 Log: Ajout d'un check sur la taille des emails Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js Modified: trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp =================================================================== --- trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-07-02 14:04:24 UTC (rev 316) +++ trunk/faxtomail-ui-web/src/main/webapp/WEB-INF/content/admin/configuration-input.jsp 2014-07-02 14:16:13 UTC (rev 317) @@ -87,7 +87,7 @@ <!-- Général --> <div class="form-group"> <label class="control-label" for="configurationEmailMaxSizeField">Taille maximale des email (en octets)</label> - <input type="text" id="configurationEmailMaxSizeField" class="form-control" ng-model="configuration.emailMaxSize" /> + <input type="text" id="configurationEmailMaxSizeField" class="form-control" ng-model="configuration.emailMaxSize" fm-integer /> </div> Actions autorisées lorsque la demande n'a pas d'état d'attente et est <strong>invalide</strong> : Modified: trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css =================================================================== --- trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css 2014-07-02 14:04:24 UTC (rev 316) +++ trunk/faxtomail-ui-web/src/main/webapp/css/faxtomail.css 2014-07-02 14:16:13 UTC (rev 317) @@ -22,6 +22,10 @@ * #L% */ +input.ng-dirty.ng-invalid { + background-color: #FA787E !important; +} + .full-width { width: 100%; } Modified: trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js =================================================================== --- trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js 2014-07-02 14:04:24 UTC (rev 316) +++ trunk/faxtomail-ui-web/src/main/webapp/js/faxtomail.js 2014-07-02 14:16:13 UTC (rev 317) @@ -67,3 +67,28 @@ /** Mail faxtomail application module. */ var FaxToMailModule = angular.module('FaxToMail', ['ui.bootstrap']); + +/** + * Directive de validation d'un champ en entier. + */ +FaxToMailModule.directive('fmInteger', function() { + return { + require: 'ngModel', + link: function(scope, elm, attrs, ctrl) { + ctrl.$parsers.unshift(function(viewValue) { + if (/^\d+$/.test(viewValue)) { + // it is valid + ctrl.$setValidity('integer', true); + return viewValue; + } else if (viewValue.length == 0) { + ctrl.$setValidity('integer', true); + return undefined; + } else { + // it is invalid, return undefined (no model update) + ctrl.$setValidity('integer', false); + return undefined; + } + }); + } + }; +}); \ No newline at end of file
participants (1)
-
echatellier@users.forge.codelutin.com