ignite-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From sboi...@apache.org
Subject [44/67] [abbrv] ignite git commit: IGNITE-5127 Fixed validation of url fields. Refactored mixins.
Date Thu, 04 May 2017 13:37:48 GMT
IGNITE-5127 Fixed validation of url fields. Refactored mixins.


Project: http://git-wip-us.apache.org/repos/asf/ignite/repo
Commit: http://git-wip-us.apache.org/repos/asf/ignite/commit/843b3f7d
Tree: http://git-wip-us.apache.org/repos/asf/ignite/tree/843b3f7d
Diff: http://git-wip-us.apache.org/repos/asf/ignite/diff/843b3f7d

Branch: refs/heads/ignite-5075
Commit: 843b3f7d45512e3d8c2f34c3151b233201712227
Parents: e7826aa
Author: Vasiliy Sisko <vsisko@gridgain.com>
Authored: Wed May 3 11:12:40 2017 +0700
Committer: Andrey Novikov <anovikov@gridgain.com>
Committed: Wed May 3 11:13:21 2017 +0700

----------------------------------------------------------------------
 .../app/helpers/jade/form/form-field-text.pug   | 55 +++-----------------
 .../frontend/app/helpers/jade/mixins.pug        | 14 +++--
 2 files changed, 18 insertions(+), 51 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ignite/blob/843b3f7d/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug b/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug
index 5a7aa2e..8207271 100644
--- a/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug
+++ b/modules/web-console/frontend/app/helpers/jade/form/form-field-text.pug
@@ -14,12 +14,11 @@
     See the License for the specific language governing permissions and
     limitations under the License.
 
-mixin ignite-field-input(type, name, model, disabled, required, placeholder)
+mixin ignite-form-field-input(name, model, disabled, required, placeholder)
     input.form-control(
         id=`{{ ${name} }}Input`
         name=`{{ ${name} }}`
         placeholder=placeholder
-        type=type
 
         data-ng-model=model
 
@@ -28,61 +27,21 @@ mixin ignite-field-input(type, name, model, disabled, required, placeholder)
         data-ng-focus='tableReset()'
 
         data-ignite-form-panel-field=''
-    )&attributes(attributes ? attributes.attributes ? attributes.attributes : attributes:
{})
-
-mixin ignite-form-field-input(name, model, disabled, required, placeholder)
-    +ignite-field-input('text', name, model, disabled, required, placeholder)
+    )&attributes(attributes ? attributes.attributes ? attributes.attributes : attributes
: {})
 
-mixin ignite-form-field-url-input(name, model, disabled, required, placeholder)
-    +ignite-field-input('url', name, model, disabled, required, placeholder)
-
-mixin ignite-form-field-text(label, model, name, disabled, required, placeholder, tip)
-    -var errLbl = label.substring(0, label.length - 1)
+mixin ignite-form-field-text(lbl, model, name, disabled, required, placeholder, tip)
+    -var errLbl = lbl.substring(0, lbl.length - 1)
 
     .ignite-form-field
-        +ignite-form-field__label(label, name, required)
+        +ignite-form-field__label(lbl, name, required)
         .ignite-form-field__control
             +tooltip(tip, tipOpts)
 
             if block
                 block
 
-            +form-field-feedback(name, 'required', errLbl + ' could not be empty!')
+            if required
+                +form-field-feedback(name, 'required', `${errLbl} could not be empty!`)
 
             .input-tip
                 +ignite-form-field-input(name, model, disabled, required, placeholder)(attributes=attributes)
-
-mixin ignite-form-field-url(label, model, name, required, placeholder, tip)
-    -var errLbl = label.substring(0, label.length - 1)
-
-    .ignite-form-field
-        +ignite-form-field__label(label, name, required)
-        .ignite-form-field__control
-            +tooltip(tip, tipOpts)
-            
-            if block
-                block
-
-            +form-field-feedback(name, 'required', errLbl + ' could not be empty!')
-            +form-field-feedback(name, 'url', errLbl + ' should be a valid URL!')
-
-            .input-tip
-                +ignite-form-field-url-input(name, model, false, required, placeholder)(attributes=attributes)
-
-mixin ignite-form-field-url(label, model, name, required, placeholder, tip)
-    -var errLbl = label.substring(0, label.length - 1)
-
-    .ignite-form-field
-        +ignite-form-field__label(label, name, required)
-        .ignite-form-field__control
-            if tip
-                i.tipField.icon-help(bs-tooltip='' data-title=tip)
-
-            if block
-                block
-
-            +form-field-feedback(name, 'required', errLbl + ' could not be empty!')
-            +form-field-feedback(name, 'url', errLbl + ' should be a valid URL!')
-
-            .input-tip
-                +ignite-form-field-url-input(name, model, false, required, placeholder)(attributes=attributes)

http://git-wip-us.apache.org/repos/asf/ignite/blob/843b3f7d/modules/web-console/frontend/app/helpers/jade/mixins.pug
----------------------------------------------------------------------
diff --git a/modules/web-console/frontend/app/helpers/jade/mixins.pug b/modules/web-console/frontend/app/helpers/jade/mixins.pug
index 73aa7c5..ae80ec8 100644
--- a/modules/web-console/frontend/app/helpers/jade/mixins.pug
+++ b/modules/web-console/frontend/app/helpers/jade/mixins.pug
@@ -203,12 +203,16 @@ mixin text(lbl, model, name, required, placeholder, tip)
         if  block
             block
 
-//- Mixin for text field.
+//- Mixin for url field.
 mixin url(lbl, model, name, required, placeholder, tip)
-    +ignite-form-field-url(lbl, model, name, required, placeholder, tip)
+    -var errLbl = lbl.substring(0, lbl.length - 1)
+
+    +ignite-form-field-text(lbl, model, name, 'false', required, placeholder, tip)(type='url')
         if  block
             block
 
+        +form-field-feedback(name, 'url', errLbl + ' should be a valid URL!')
+
 //- Mixin for password field.
 mixin password(lbl, model, name, required, placeholder, tip)
     +ignite-form-field-password(lbl, model, name, false, required, placeholder, tip)
@@ -371,11 +375,15 @@ mixin table-url-field(name, model, items, valid, save, newItem)
     -var onBlur = `${valid} && (${save}); ${resetOnBlur};`
 
     div(ignite-on-focus-out=onBlur)
+        +form-field-feedback(name, 'url', 'URL should be valid!')
+
         if block
             block
 
         .input-tip
-            +ignite-form-field-url-input(name, model, false, 'true', 'Enter URL')(
+            +ignite-form-field-input(name, model, false, 'true', 'Enter URL')(
+                type='url'
+
                 data-ignite-unique=items
                 data-ignite-form-field-input-autofocus='true'
 


Mime
View raw message