mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-17 22:57:21 +01:00
Updates new tag code and test spec for new tags.
This commit is contained in:
@@ -11,6 +11,7 @@ describe('Filters Controller', function() {
|
|||||||
}));
|
}));
|
||||||
|
|
||||||
it('creates a tag', function(){
|
it('creates a tag', function(){
|
||||||
|
scope._newTag = {name:'tagName'}
|
||||||
scope.createTag('tagName');
|
scope.createTag('tagName');
|
||||||
expect(user.tags).to.have.length(1);
|
expect(user.tags).to.have.length(1);
|
||||||
expect(user.tags[0].name).to.eql('tagName');
|
expect(user.tags[0].name).to.eql('tagName');
|
||||||
|
|||||||
@@ -4,7 +4,6 @@ habitrpg.controller("FiltersCtrl", ['$scope', '$rootScope', 'User', 'Shared',
|
|||||||
function($scope, $rootScope, User, Shared) {
|
function($scope, $rootScope, User, Shared) {
|
||||||
var user = User.user;
|
var user = User.user;
|
||||||
$scope._editing = false;
|
$scope._editing = false;
|
||||||
$scope._newTag = {name:''};
|
|
||||||
|
|
||||||
var tagsSnap; // used to compare which tags need updating
|
var tagsSnap; // used to compare which tags need updating
|
||||||
|
|
||||||
@@ -30,8 +29,8 @@ habitrpg.controller("FiltersCtrl", ['$scope', '$rootScope', 'User', 'Shared',
|
|||||||
// User.save();
|
// User.save();
|
||||||
};
|
};
|
||||||
|
|
||||||
$scope.createTag = function(newTag) {
|
$scope.createTag = function() {
|
||||||
User.user.ops.addTag({body:{name:newTag.name, id:Shared.uuid()}});
|
User.user.ops.addTag({body:{name:$scope._newTag.name, id:Shared.uuid()}});
|
||||||
$scope._newTag.name = '';
|
$scope._newTag = '';
|
||||||
};
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|||||||
@@ -20,8 +20,8 @@
|
|||||||
//- Add new tag
|
//- Add new tag
|
||||||
li.filters-edit(ng-show='_editing')
|
li.filters-edit(ng-show='_editing')
|
||||||
form.hrpg-input-group
|
form.hrpg-input-group
|
||||||
input(type='text', ng-model='_newTag.name', placeholder=env.t('newTag'))
|
input(type='text', ng-model='_newTag', placeholder=env.t('newTag'))
|
||||||
button(ng-click='createTag(_newTag)')=env.t('add')
|
button(ng-click='createTag()')=env.t('add')
|
||||||
div(ng-if='!areTagsHidden || _editing')
|
div(ng-if='!areTagsHidden || _editing')
|
||||||
ul(ng-if='_editing')
|
ul(ng-if='_editing')
|
||||||
li.filters-edit(ng-class='{active: user.filters[tag.id]}', ng-repeat='tag in user.tags', bindonce='user.tags')
|
li.filters-edit(ng-class='{active: user.filters[tag.id]}', ng-repeat='tag in user.tags', bindonce='user.tags')
|
||||||
|
|||||||
Reference in New Issue
Block a user