mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 15:48:04 +01:00
Made uuid in hall of heroes populate the input box
This commit is contained in:
28
test/spec/hallCtrlSpec.js
Normal file
28
test/spec/hallCtrlSpec.js
Normal file
@@ -0,0 +1,28 @@
|
|||||||
|
'use strict';
|
||||||
|
|
||||||
|
describe.only('Hall of Heroes Controller', function() {
|
||||||
|
var scope, ctrl, user, $rootScope;
|
||||||
|
|
||||||
|
beforeEach(function() {
|
||||||
|
module(function($provide) {
|
||||||
|
$provide.value('User', {});
|
||||||
|
});
|
||||||
|
|
||||||
|
inject(function($rootScope, $controller){
|
||||||
|
user = specHelper.newUser();
|
||||||
|
user._id = "unique-user-id"
|
||||||
|
|
||||||
|
scope = $rootScope.$new();
|
||||||
|
|
||||||
|
// Load RootCtrl to ensure shared behaviors are loaded
|
||||||
|
$controller('RootCtrl', {$scope: scope, User: {user: user}});
|
||||||
|
|
||||||
|
ctrl = $controller('HallHeroesCtrl', {$scope: scope, User: {user: user}});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
|
||||||
|
it('populates contributor input with selected hero id', function(){
|
||||||
|
scope.populateContributorInput(user._id);
|
||||||
|
expect(scope._heroID).to.eql(user._id);
|
||||||
|
});
|
||||||
|
});
|
||||||
@@ -17,6 +17,10 @@ habitrpg.controller("HallHeroesCtrl", ['$scope', '$rootScope', 'User', 'Notifica
|
|||||||
})
|
})
|
||||||
}
|
}
|
||||||
$scope.heroes = Hero.query();
|
$scope.heroes = Hero.query();
|
||||||
|
|
||||||
|
$scope.populateContributorInput = function(id) {
|
||||||
|
$scope._heroID = id;
|
||||||
|
};
|
||||||
}]);
|
}]);
|
||||||
|
|
||||||
habitrpg.controller("HallPatronsCtrl", ['$scope', '$rootScope', 'User', 'Notification', 'ApiUrl', '$resource',
|
habitrpg.controller("HallPatronsCtrl", ['$scope', '$rootScope', 'User', 'Notification', 'ApiUrl', '$resource',
|
||||||
|
|||||||
@@ -84,7 +84,7 @@ script(type='text/ng-template', id='partials/options.social.hall.heroes.html')
|
|||||||
span(ng-class='userAdminGlyphiconStyle(hero)')
|
span(ng-class='userAdminGlyphiconStyle(hero)')
|
||||||
span(ng-if='!hero.contributor.admin')
|
span(ng-if='!hero.contributor.admin')
|
||||||
a.label.label-default(ng-class='userLevelStyle(hero)', ng-click='clickMember(hero._id, true)') {{hero.profile.name}}
|
a.label.label-default(ng-class='userLevelStyle(hero)', ng-click='clickMember(hero._id, true)') {{hero.profile.name}}
|
||||||
td(ng-if='user.contributor.admin') {{hero._id}}
|
td(ng-if='user.contributor.admin', ng-click='populateContributorInput(hero._id)').btn-link {{hero._id}}
|
||||||
td {{hero.contributor.level}}
|
td {{hero.contributor.level}}
|
||||||
td {{hero.contributor.text}}
|
td {{hero.contributor.text}}
|
||||||
td
|
td
|
||||||
|
|||||||
Reference in New Issue
Block a user