Merge "Enhance adding tags on story details page"

This commit is contained in:
Zuul 2019-03-14 15:46:48 +00:00 committed by Gerrit Code Review
commit 6f3bb74ff9
2 changed files with 11 additions and 9 deletions

View File

@ -784,6 +784,7 @@ angular.module('sb.story').controller('StoryDetailController',
$scope.showAddTag = false;
$scope.toggleAddTag = function() {
$scope.newTag.name = null;
$scope.showAddTag = !$scope.showAddTag;
};
@ -794,11 +795,11 @@ angular.module('sb.story').controller('StoryDetailController',
DSCacheFactory.get('defaultCache').put(
storyboardApiBase + '/stories/' + story.id,
updatedStory);
$scope.showAddTag = false;
$scope.story.tags.push(tag_name);
$scope.loadEvents();
},
handleServiceError);
$scope.newTag.name = null;
}
};

View File

@ -369,18 +369,19 @@
<p class="text-muted" ng-if="story.tags.length == 0 && !isLoggedIn">
<em>This story has no tags yet.</em>
</p>
<span class="input-group" ng-show="showAddTag">
<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);"/>
<div class="col-xs-3 input-group" ng-show="showAddTag">
<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);"
ng-enter="addTag(newTag.name)"
focus/>
<span class="input-group-btn">
<button class="btn btn-primary" type="button"
ng-click="addTag(newTag.name)">Add</button>
<button class="btn btn-default" type="button"
ng-click="toggleAddTag()">Cancel</button>
</span>
</span>
</div>
<button class="btn btn-default" ng-click="toggleAddTag()"
ng-show="!showAddTag && isLoggedIn">
<i class="fa fa-plus-circle"></i>&nbsp;Add Tag