mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-05 12:02:13 +00:00
Tags (filters) saves when pressing Enter instead of deleting the current tag
This commit is contained in:
parent
56e2ec1bc4
commit
feb55324ba
2 changed files with 9 additions and 3 deletions
|
|
@ -20,7 +20,7 @@ habitrpg.controller("FiltersCtrl", ['$scope', '$rootScope', 'User', 'Shared',
|
|||
tagsSnap = _.object(_.pluck(tagsSnap,'id'), tagsSnap);
|
||||
$scope._editing = true;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
$scope.toggleFilter = function(tag) {
|
||||
user.filters[tag.id] = !user.filters[tag.id];
|
||||
|
|
@ -33,4 +33,10 @@ habitrpg.controller("FiltersCtrl", ['$scope', '$rootScope', 'User', 'Shared',
|
|||
User.user.ops.addTag({body:{name:name, id:Shared.uuid()}});
|
||||
$scope._newTag = '';
|
||||
};
|
||||
|
||||
$scope.checkKeyForSaving = function($event) {
|
||||
if($event.keyCode === 13) {
|
||||
$scope.saveOrEdit();
|
||||
}
|
||||
};
|
||||
}]);
|
||||
|
|
|
|||
|
|
@ -26,8 +26,8 @@
|
|||
ul(ng-if='_editing')
|
||||
li.filters-edit(ng-class='{active: user.filters[tag.id]}', ng-repeat='tag in user.tags', bindonce='user.tags')
|
||||
form.hrpg-input-group
|
||||
input(type='text', ng-model='tag.name')
|
||||
button(ng-click='user.ops.deleteTag({params:{id:tag.id}})')
|
||||
input(type='text', ng-model='tag.name', ng-keyup='checkKeyForSaving($event)')
|
||||
button(type='button', ng-click='user.ops.deleteTag({params:{id:tag.id}})')
|
||||
span.glyphicon.glyphicon-trash
|
||||
ul(ng-if='!_editing', hrpg-sort-tags)
|
||||
li.filters-tags(ng-class='{active: user.filters[tag.id], challenge: tag.challenge}', ng-repeat='tag in user.tags', bindonce='user.tags')
|
||||
|
|
|
|||
Loading…
Reference in a new issue