challenges: get Challenges (mostly) working along the same ui-router

principles as groups. Having some $scope variable resolution timing issues
This commit is contained in:
Tyler Renelle
2013-10-29 17:49:49 -07:00
parent 77fee06fdb
commit 02ebc536ca
8 changed files with 110 additions and 76 deletions

View File

@@ -1,11 +1,16 @@
"use strict";
habitrpg.controller("ChallengesCtrl", ['$scope', 'User', 'Challenges', 'Notification', '$compile', 'groups', 'challenges',
function($scope, User, Challenges, Notification, $compile, groups, challenges) {
habitrpg.controller("ChallengesCtrl", ['$scope', 'User', 'Challenges', 'Notification', '$compile', 'Groups',
function($scope, User, Challenges, Notification, $compile, Groups) {
// groups & challenges are loaded as `resolve` via ui-router (see app.js)
$scope.groups = groups;
$scope.challenges = challenges;
// FIXME get this from cache
Groups.Group.query(function(groups){
groups.tavern[0].name = 'Tavern';
$scope.groups = groups.party.concat(groups.guilds).concat(groups.tavern);
});
// FIXME $scope.challenges needs to be resolved first (see app.js)
$scope.challenges = Challenges.Challenge.query();
// we should fix this, that's pretty brittle
//------------------------------------------------------------
// Challenge