| //- |
| 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. |
| |
| include /app/helpers/jade/mixins |
| |
| +form-field__label({ |
| label: '{{ ::$ctrl.label }}', |
| name: '$ctrl.id', |
| required: '$ctrl.required', |
| disabled: '$ctrl.ngDisabled' |
| }) |
| +form-field__tooltip({title: '{{$ctrl.tip}}'})( |
| ng-if='$ctrl.tip' |
| ) |
| |
| .form-field__control.form-field__control-group(ng-form='$ctrl.innerForm') |
| input( |
| type='number' |
| id='{{::$ctrl.id}}Input' |
| ng-model='$ctrl.value' |
| ng-model-options='{allowInvalid: true}' |
| ng-change='$ctrl.onValueChange()' |
| name='numberInput' |
| placeholder='{{$ctrl.placeholder}}' |
| min='{{ $ctrl.min ? $ctrl.min / $ctrl.sizeScale.value : "" }}' |
| max='{{ $ctrl.max ? $ctrl.max / $ctrl.sizeScale.value : "" }}' |
| ng-required='$ctrl.required' |
| ng-disabled='$ctrl.ngDisabled' |
| ignite-form-field-input-autofocus='{{$ctrl.autofocus}}' |
| ng-on-blur='$ctrl.triggerBlur()' |
| ) |
| button.select-toggle( |
| bs-select |
| bs-options='size as size.label for size in $ctrl.sizesMenu' |
| ng-model='$ctrl.sizeScale' |
| protect-from-bs-select-render |
| ng-disabled='$ctrl.ngDisabled' |
| type='button' |
| ) |
| | {{ $ctrl.sizeScale.label }} |
| |
| .form-field__errors( |
| ng-messages='$ctrl.ngModel.$error' |
| ng-show=`($ctrl.ngModel.$dirty || $ctrl.ngModel.$touched || $ctrl.ngModel.$submitted) && $ctrl.ngModel.$invalid` |
| ) |
| div(ng-transclude) |
| +form-field__error({ |
| error: 'required', |
| message: 'This field could not be empty' |
| }) |
| +form-field__error({ |
| error: 'min', |
| message: 'Value is less than allowable minimum: {{ $ctrl.min/$ctrl.sizeScale.value }} {{$ctrl.sizeScale.label}}' |
| }) |
| +form-field__error({ |
| error: 'max', |
| message: 'Value is more than allowable maximum: {{ $ctrl.max/$ctrl.sizeScale.value }} {{$ctrl.sizeScale.label}}' |
| }) |
| +form-field__error({ |
| error: 'number', |
| message: 'Only numbers allowed' |
| }) |
| +form-field__error({ |
| error: 'step', |
| message: 'Invalid step' |
| }) |