mirror of
https://github.com/sudoxnym/habitica.git
synced 2026-08-03 08:21:07 +00:00
Changed new tag code to be more angular-idiomatic.
This commit is contained in:
parent
99aad96688
commit
f95f892491
2 changed files with 5 additions and 4 deletions
|
|
@ -4,6 +4,7 @@ habitrpg.controller("FiltersCtrl", ['$scope', '$rootScope', 'User', 'Shared',
|
|||
function($scope, $rootScope, User, Shared) {
|
||||
var user = User.user;
|
||||
$scope._editing = false;
|
||||
$scope._newTag = {name:''};
|
||||
|
||||
var tagsSnap; // used to compare which tags need updating
|
||||
|
||||
|
|
@ -29,8 +30,8 @@ habitrpg.controller("FiltersCtrl", ['$scope', '$rootScope', 'User', 'Shared',
|
|||
// User.save();
|
||||
};
|
||||
|
||||
$scope.createTag = function(name) {
|
||||
User.user.ops.addTag({body:{name:name, id:Shared.uuid()}});
|
||||
this._newTag = '';
|
||||
$scope.createTag = function(newTag) {
|
||||
User.user.ops.addTag({body:{name:newTag.name, id:Shared.uuid()}});
|
||||
$scope._newTag.name = '';
|
||||
};
|
||||
}]);
|
||||
|
|
|
|||
|
|
@ -20,7 +20,7 @@
|
|||
//- Add new tag
|
||||
li.filters-edit(ng-show='_editing')
|
||||
form.hrpg-input-group
|
||||
input(type='text', ng-model='_newTag', placeholder=env.t('newTag'))
|
||||
input(type='text', ng-model='_newTag.name', placeholder=env.t('newTag'))
|
||||
button(ng-click='createTag(_newTag)')=env.t('add')
|
||||
div(ng-if='!areTagsHidden || _editing')
|
||||
ul(ng-if='_editing')
|
||||
|
|
|
|||
Loading…
Reference in a new issue