Optional autocomplete for tag rules directive

This commit is contained in:
Rob Harrington
2016-05-19 11:10:20 +10:00
parent 9b12b86053
commit 3d7786e185
2 changed files with 3 additions and 1 deletions

View File

@@ -8,6 +8,8 @@ angular.module("admin.utils").directive "tagsWithTranslation", ($timeout) ->
findTags: "&"
form: '=?'
link: (scope, element, attrs) ->
scope.findTags = undefined unless attrs.hasOwnProperty("findTags")
$timeout ->
scope.tagsAttr ||= "tags"
scope.tagListAttr ||= "tag_list"

View File

@@ -1,5 +1,5 @@
%tags-input{ template: 'admin/tag.html', ng: { model: 'object[tagsAttr]' }, on: { tag: { added: 'tagAdded()', removed:'tagRemoved()' } } }
%auto-complete{source: "findTags({query: $query})",
%auto-complete{ ng: { if: "findTags" }, source: "findTags({query: $query})",
template: "admin/tag_autocomplete.html",
"min-length" => "0",
"load-on-focus" => "true",