Repository: ignite Updated Branches: refs/heads/master 781d4e781 -> fe824a0e2
http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/primitives/form-field/password.pug ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/primitives/form-field/password.pug b/modules/web-console/frontend/app/primitives/form-field/password.pug index 6b9818b..374d768 100644 --- a/modules/web-console/frontend/app/primitives/form-field/password.pug +++ b/modules/web-console/frontend/app/primitives/form-field/password.pug @@ -17,9 +17,9 @@ mixin form-field__password({ label, model, name, disabled, required, placeholder, tip }) -var errLbl = label.substring(0, label.length - 1) - .form-field.form-field__password( + .form-field.form-field__password.ignite-form-field( password-visibility-root - on-password-visibility-toggle=`${form}[${name}].$setTouched()` + on-password-visibility-toggle=`$input1.$setTouched(); $input2.$setTouched()` ) +form-field__label({ label, name, required }) +form-field__tooltip({ title: tip, options: tipOpts }) @@ -27,16 +27,22 @@ mixin form-field__password({ label, model, name, disabled, required, placeholder .form-field__control - attributes.type='password' - attributes.class = 'password-visibility__password-hidden' + - attributes['ng-ref'] = '$input1' +form-field__input({ name, model, disabled, required, placeholder })(attributes=attributes) - attributes.class = 'password-visibility__password-visible' - attributes.type='text' - attributes.autocomplete = 'off' + - attributes['ng-ref'] = '$input2' +form-field__input({ name: name + `+"Text"`, model, disabled, required, placeholder })(attributes=attributes) password-visibility-toggle-button .form-field__errors( - ng-messages=`(${form}[${name}].$dirty || ${form}[${name}].$touched || ${form}[${name}].$submitted) && ${form}[${name}].$invalid ? ${form}[${name}].$error : {}` + ng-messages=`$input1.$error || $input2.$error` + ng-show=` + ($input1.$dirty || $input1.$touched || $input1.$submitted) && $input1.$invalid || + ($input2.$dirty || $input2.$touched || $input2.$submitted) && $input2.$invalid + ` ) if block block http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/primitives/form-field/phone.pug ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/primitives/form-field/phone.pug b/modules/web-console/frontend/app/primitives/form-field/phone.pug index 8b50301..9b60a40 100644 --- a/modules/web-console/frontend/app/primitives/form-field/phone.pug +++ b/modules/web-console/frontend/app/primitives/form-field/phone.pug @@ -17,7 +17,7 @@ mixin form-field__phone({ label, model, name, disabled, required, optional, placeholder, tip }) -var errLbl = label.substring(0, label.length - 1) - .form-field + .form-field.ignite-form-field +form-field__label({ label, name, required, optional }) +form-field__tooltip({ title: tip, options: tipOpts }) @@ -26,7 +26,8 @@ mixin form-field__phone({ label, model, name, disabled, required, optional, plac +form-field__input({ name, model, disabled, required, placeholder })(attributes=attributes) .form-field__errors( - ng-messages=`(${form}[${name}].$dirty || ${form}[${name}].$touched || ${form}[${name}].$submitted) && ${form}[${name}].$invalid ? ${form}[${name}].$error : {}` + ng-messages=`$input.$error` + ng-show=`($input.$dirty || $input.$touched || $input.$submitted) && $input.$invalid` ) if block block http://git-wip-us.apache.org/repos/asf/ignite/blob/fe824a0e/modules/web-console/frontend/app/utils/dialogState.ts ---------------------------------------------------------------------- diff --git a/modules/web-console/frontend/app/utils/dialogState.ts b/modules/web-console/frontend/app/utils/dialogState.ts new file mode 100644 index 0000000..d83c911 --- /dev/null +++ b/modules/web-console/frontend/app/utils/dialogState.ts @@ -0,0 +1,56 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +import {UIRouter, StateDeclaration, Transition} from '@uirouter/angularjs'; + +export function dialogState(component: string): Partial<StateDeclaration> { + let dialog: mgcrea.ngStrap.modal.IModal | undefined; + let hide: (() => void) | undefined; + + onEnter.$inject = ['$transition$']; + + function onEnter(transition: Transition) { + const modal = transition.injector().get<mgcrea.ngStrap.modal.IModalService>('$modal'); + const router = transition.injector().get<UIRouter>('$uiRouter'); + + dialog = modal({ + template: ` + <${component} + class='modal center modal--ignite theme--ignite' + tabindex='-1' + role='dialog' + on-hide=$hide() + ></${component}> + `, + onHide(modal) { + modal.destroy(); + } + }); + + hide = dialog.hide; + + dialog.hide = () => router.stateService.go('.^'); + } + + return { + onEnter, + onExit() { + if (hide) hide(); + dialog = hide = void 0; + } + }; +}