From d5e78266e50a58ed773e326ce0b6cb56724ed072 Mon Sep 17 00:00:00 2001 From: Tyler Renelle Date: Thu, 31 Oct 2013 14:06:18 -0700 Subject: [PATCH] challenge prize: various fixes. Woo, challenge prizes work now! @sabrecat @lemoness @wc8 (still some bugs & cleanup, but it's mostly there) --- public/js/controllers/challengesCtrl.js | 4 ++-- src/controllers/challenges.js | 2 +- views/options/challenges.jade | 2 +- views/shared/tasks/task.jade | 3 ++- 4 files changed, 6 insertions(+), 5 deletions(-) diff --git a/public/js/controllers/challengesCtrl.js b/public/js/controllers/challengesCtrl.js index 92563116b9..ed42ab3d85 100644 --- a/public/js/controllers/challengesCtrl.js +++ b/public/js/controllers/challengesCtrl.js @@ -1,7 +1,7 @@ "use strict"; -habitrpg.controller("ChallengesCtrl", ['$scope', 'User', 'Challenges', 'Notification', '$compile', 'Groups', '$state', '$rootScope', - function($scope, User, Challenges, Notification, $compile, Groups, $state, $rootScope) { +habitrpg.controller("ChallengesCtrl", ['$scope', 'User', 'Challenges', 'Notification', '$compile', 'Groups', '$state', + function($scope, User, Challenges, Notification, $compile, Groups, $state) { // FIXME get this from cache Groups.Group.query({type:'party,guilds,tavern'}, function(groups){ diff --git a/src/controllers/challenges.js b/src/controllers/challenges.js index 2e9ed49075..6d4be6e733 100644 --- a/src/controllers/challenges.js +++ b/src/controllers/challenges.js @@ -275,7 +275,7 @@ api.selectWinner = function(req, res) { function(saved, num, cb) { closeChal(req.params.cid, {broken: 'CHALLENGE_CLOSED', winner: saved.profile.name}, cb); } - ], function(){ + ], function(err){ if (err) return res.json(500, {err: err}); res.send(200); }) diff --git a/views/options/challenges.jade b/views/options/challenges.jade index 5bf9424bad..cb499043dd 100644 --- a/views/options/challenges.jade +++ b/views/options/challenges.jade @@ -2,7 +2,7 @@ script(type='text/ng-template', id='partials/options.challenges.detail.close.htm a.btn.btn-small.btn-danger(ng-click="delete(closingChal)") Delete h5 - Or - small Select a winner and close the challenge: - select(ng-model='challenge.winner', name='Winner', ng-options='u._id as u.profile.name for u in closingChal.members', ng-change='selectWinner(closingChal)') + select(ng-model='closingChal.winner', name='Winner', ng-options='u._id as u.profile.name for u in closingChal.members', ng-change='selectWinner(closingChal)') small.pull-right a(ng-click='cancelClosing(closingChal)') cancel diff --git a/views/shared/tasks/task.jade b/views/shared/tasks/task.jade index fde272458e..8601fb837a 100644 --- a/views/shared/tasks/task.jade +++ b/views/shared/tasks/task.jade @@ -76,7 +76,8 @@ li(ng-repeat='task in obj[list.type+"s"]', class='task {{taskClasses(task, user. |  |  a(ng-click='unlink(task, "remove-all")') Remove Them div(ng-if='task.challenge.broken=="CHALLENGE_CLOSED"') - p. This challenge has been completed, and the winner was {{task.challenge.winner}}!. What to do with the orphan tasks? + p. + This challenge has been completed, and the winner was {{task.challenge.winner}}! What to do with the orphan tasks? p a(ng-click='unlink(task, "keep-all")') Keep Them |  |