Make tags reusable
Make the most recent tag suggested when a user goes to add a new one Add a dropdown of previously used tags as suggestions Change-Id: I0f38e55b9349fea181e013f810763302294789d5 Task: 3143 Story: 2000676
This commit is contained in:
parent
ae6c13b830
commit
ca614e882c
|
@ -23,7 +23,7 @@ angular.module('sb.story').controller('StoryDetailController',
|
|||
Story, creator, tasks, Task, DSCacheFactory, User, $q,
|
||||
storyboardApiBase, SessionModalService, moment, $document,
|
||||
$anchorScroll, $timeout, $location, currentUser,
|
||||
enableEditableComments) {
|
||||
enableEditableComments, Tags) {
|
||||
'use strict';
|
||||
|
||||
var pageSize = Preference.get('story_detail_page_size');
|
||||
|
@ -622,4 +622,14 @@ angular.module('sb.story').controller('StoryDetailController',
|
|||
},
|
||||
handleServiceError);
|
||||
};
|
||||
|
||||
$scope.searchTags = function (value) {
|
||||
return Tags.browse({name: value, limit: 10}).$promise;
|
||||
};
|
||||
|
||||
$scope.updateViewValue = function (value) {
|
||||
$scope.newTag.name = value;
|
||||
};
|
||||
|
||||
$scope.newTag = {};
|
||||
});
|
||||
|
|
|
@ -273,7 +273,10 @@
|
|||
</ul>
|
||||
<br>
|
||||
<span class="input-group" ng-show="showAddTag">
|
||||
<input type="text" class="form-control" ng-model="newTag.name" />
|
||||
<input type="text" class="form-control" ng-model="newTag.name"
|
||||
typeahead="tag as tag.name for tag in searchTags($viewValue)"
|
||||
typeahead-on-select="updateViewValue($model.name);"/>
|
||||
|
||||
<span class="input-group-btn">
|
||||
<button class="btn btn-primary" type="button"
|
||||
ng-click="addTag(newTag.name)">Add</button>
|
||||
|
|
Loading…
Reference in New Issue