Made uuid in hall of heroes populate the input box

This commit is contained in:
Blade Barringer
2015-04-09 21:57:06 -05:00
parent ddc91e0227
commit 24ef3aa012
3 changed files with 33 additions and 1 deletions

28
test/spec/hallCtrlSpec.js Normal file
View 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);
});
});

View File

@@ -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',

View File

@@ -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