Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F0BE2200CA5 for ; Fri, 5 May 2017 11:45:15 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id EF8AC160BBF; Fri, 5 May 2017 09:45:15 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id D79A8160BD5 for ; Fri, 5 May 2017 11:45:13 +0200 (CEST) Received: (qmail 59337 invoked by uid 500); 5 May 2017 09:45:13 -0000 Mailing-List: contact commits-help@ignite.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@ignite.apache.org Delivered-To: mailing list commits@ignite.apache.org Received: (qmail 58775 invoked by uid 99); 5 May 2017 09:45:12 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 05 May 2017 09:45:12 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 7D312F16BB; Fri, 5 May 2017 09:45:12 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: sboikov@apache.org To: commits@ignite.apache.org Date: Fri, 05 May 2017 09:45:30 -0000 Message-Id: <51c11197120a488da0fa3d553bc5c5ea@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [19/50] [abbrv] ignite git commit: IGNITE-5127 Fixed validation of url fields. Refactored mixins. archived-at: Fri, 05 May 2017 09:45:16 -0000 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-5009 Commit: 843b3f7d45512e3d8c2f34c3151b233201712227 Parents: e7826aa Author: Vasiliy Sisko Authored: Wed May 3 11:12:40 2017 +0700 Committer: Andrey Novikov 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'