Commit 74775a3d authored by Evren Kutar's avatar Evren Kutar

ADD typeahead type for forms and dispatcher function rref #5050 refs GH-26

parent 423b3343
<div class="form-group {{form.htmlClass}} schema-form-select col-md-12"
ng-class="{'has-error': form.disableErrorState !== true && hasError(), 'has-success': form.disableSuccessState !== true && hasSuccess(), 'has-feedback': form.feedback !== false}">
<label class="control-label {{form.labelHtmlClass}}" ng-show="showTitle()">
{{form.title}}
</label>
<!--<div class="form-group input-group">-->
<!--<span class="input-group-btn">-->
<!--<button class="btn btn-default dropdown-toggle" type="button"-->
<!--data-toggle="dropdown">-->
<!--<span class="caret"></span>-->
<!--</button>-->
<!--<ul class="dropdown-menu">-->
<!--<li class="text-center" ng-if="form.gettingTitleMap"><a><span class="loader"></span></a></li>-->
<!--<li ng-repeat="item in form.titleMap">-->
<!--<a ng-click="form.onDropdownSelect(item, form.name)">{{item-->
<!--.name}}</a>-->
<!--</li>-->
<!--</ul>-->
<!--</span>-->
<input type="text"
ng-model="$$value$$"
uib-typeahead="item.name for item in form.titleMap | filter:$viewValue"
typeahead-wait-ms="500"
typeahead-loading="loadingTitleMap"
placeholder="{{form.title}}"
ng-model-options="form.ngModelOptions"
ng-disabled="form.readonly"
sf-changed="form"
class="form-control {{form.fieldHtmlClass}}"
schema-validate="form"
name="{{form.name}}"/>
<!--</div>-->
<div ng-show="loadingTitleMap" class="loader"></div>
<div class="help-block" sf-message="form.description"></div>
</div>
\ No newline at end of file
...@@ -551,6 +551,23 @@ angular.module('ulakbus.formService', ['ui.bootstrap']) ...@@ -551,6 +551,23 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
int: {default: _numbers}, int: {default: _numbers},
boolean: {default: function () {}}, boolean: {default: function () {}},
string: {default: function () {}}, string: {default: function () {}},
typeahead: {default: function (scope, v, k) {
scope.form[scope.form.indexOf(k)] = {
type: "template",
title: v.title,
titleMap: v.titleMap,
templateUrl: "shared/templates/typeahead.html",
name: k,
key: k,
onDropdownSelect: function (item, inputname) {
scope.model[k] = item.value;
$timeout(function () {
document.querySelector('input[name=' + inputname + ']').value = item.name;
});
}
};
v.type = 'string';
}},
text_general: { text_general: {
default: default:
function (scope, v, k) { function (scope, v, k) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment