Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
U
ulakbus-ui
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ulakbus
ulakbus-ui
Commits
7281efe5
Commit
7281efe5
authored
Jun 12, 2016
by
Evren Kutar
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
custom search widget for typeahead
rref #5374
parent
f61e0b51
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
29 deletions
+61
-29
typeahead.html
app/shared/templates/typeahead.html
+32
-29
form_service.js
app/zetalib/form_service.js
+29
-0
No files found.
app/shared/templates/typeahead.html
View file @
7281efe5
...
@@ -4,21 +4,8 @@
...
@@ -4,21 +4,8 @@
{{form.title}}
{{form.title}}
</label>
</label>
<!--<div class="form-group input-group">-->
<input
ng-if=
"form.widget!=='custom'"
<!--<span class="input-group-btn">-->
type=
"text"
<!--<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"
autocomplete=
"off"
autocomplete=
"off"
ng-model=
"$$value$$"
ng-model=
"$$value$$"
uib-typeahead=
"item as item.name for item in form.titleMap"
uib-typeahead=
"item as item.name for item in form.titleMap"
...
@@ -32,7 +19,23 @@
...
@@ -32,7 +19,23 @@
class=
"form-control {{form.fieldHtmlClass}}"
class=
"form-control {{form.fieldHtmlClass}}"
schema-validate=
"form"
schema-validate=
"form"
name=
"{{form.name}}"
/>
name=
"{{form.name}}"
/>
<!--</div>-->
<input
ng-if=
"form.widget==='custom'"
type=
"text"
autocomplete=
"off"
ng-model=
"$$value$$"
uib-typeahead=
"item as item.name for item in getTitleMap($viewValue)"
typeahead-wait-ms=
"500"
typeahead-loading=
"loadingTitleMap"
typeahead-on-select=
"form.onDropdownSelect($item, form.name)"
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
ng-show=
"loadingTitleMap"
class=
"loader"
></div>
<div
ng-show=
"loadingTitleMap"
class=
"loader"
></div>
<div
class=
"help-block"
sf-message=
"form.description"
></div>
<div
class=
"help-block"
sf-message=
"form.description"
></div>
</div>
</div>
\ No newline at end of file
app/zetalib/form_service.js
View file @
7281efe5
...
@@ -773,6 +773,35 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
...
@@ -773,6 +773,35 @@ angular.module('ulakbus.formService', ['ui.bootstrap'])
}
}
};
};
v
.
type
=
'string'
;
v
.
type
=
'string'
;
},
custom
:
function
(
scope
,
v
,
k
)
{
scope
.
form
[
scope
.
form
.
indexOf
(
k
)]
=
{
type
:
"template"
,
title
:
v
.
title
,
getTitleMap
:
function
(
viewValue
)
{
// v.view is where that value will looked up
var
searchData
=
{
"url"
:
v
.
wf
,
"wf"
:
v
.
wf
,
"view"
:
v
.
view
,
"query"
:
viewValue
};
generator
.
get_list
(
searchData
).
then
(
function
(
res
)
{
// response must be in titleMap format
return
res
;
});
},
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
:
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment