diff --git a/src/index.html b/src/index.html index 2587398..bd41440 100644 --- a/src/index.html +++ b/src/index.html @@ -363,26 +363,39 @@

-
+
+ .certificate.label
- - .browse - - + +
+
+ .error.required +
+
- -
+
- - .browse - - + +
+
+ .error.required +
+
diff --git a/src/js/directives/fileRequired.js b/src/js/directives/fileRequired.js new file mode 100644 index 0000000..0ba1efa --- /dev/null +++ b/src/js/directives/fileRequired.js @@ -0,0 +1,31 @@ +//required validation for input type file is not supported yet +//see: https://github.com/angular/angular.js/issues/1375 +//see: https://github.com/angular/angular.js/pull/8987 + +'use strict'; + +module.exports = function(app) { + app.directive('fileValid', function() { + return { + require: 'ngModel', + scope: { + required: '=ngRequired' + }, + link: function(scope, element, attributes, ngModel) { + console.log(scope.required); + scope.$watch('required', function(newValue, oldValue) { + console.log('required changed'); + }); + + //handle element change + element.bind('change',function() { + scope.$apply(function() { + ngModel.$setViewValue(element.val()); + ngModel.$render(); + }); + }); + + } + }; + }); +}; diff --git a/src/js/directives/index.js b/src/js/directives/index.js index 9d91ff3..9e42bea 100644 --- a/src/js/directives/index.js +++ b/src/js/directives/index.js @@ -3,4 +3,5 @@ module.exports = function(app) { require('./compareTo')(app); require('./ipv4Address')(app); + require('./fileRequired')(app); }; diff --git a/src/nls/locale-de.json b/src/nls/locale-de.json index 9b6f696..1cdd7f0 100644 --- a/src/nls/locale-de.json +++ b/src/nls/locale-de.json @@ -66,7 +66,8 @@ "label": "VPN03 Zertifikat und Schlüssel für diesen Router generieren. ", "certificate.label": "VPN Zertifikat", "key.label": "Schlüssel", - "browse": "Durchsuchen" + "browse": "Durchsuchen", + "error.required": "Diese Datei wird benötigt. Wenn du den Haken oben setzt, wird sie automatisch generiert" } }, "ip": { diff --git a/src/nls/locale-en.json b/src/nls/locale-en.json index ebac392..233d8c1 100644 --- a/src/nls/locale-en.json +++ b/src/nls/locale-en.json @@ -66,7 +66,8 @@ "label": "Generate new VPN03 certificate and key for this router", "certificate.label": "VPN certificate", "key.label": "VPN key", - "browse": "Browse" + "browse": "Browse", + "error.required": "The file is required. It is generated automatically if you select the checkbox above." } }, "ip": {