Fixed member modal on front page

This commit is contained in:
Keith Holliday
2016-05-16 09:54:22 -05:00
parent ad03cc8f9a
commit 11b567038e
4 changed files with 17 additions and 12 deletions

View File

@@ -1,8 +1,8 @@
'use strict'; 'use strict';
angular.module('habitrpg') angular.module('habitrpg')
.factory('Members', [ '$rootScope', 'Shared', 'ApiUrl', '$resource', '$http', '$q', .factory('Members', [ '$rootScope', 'Shared', 'ApiUrl', '$http', '$q',
function($rootScope, Shared, ApiUrl, $resource, $http, $q) { function($rootScope, Shared, ApiUrl, $http, $q) {
var members = {}; var members = {};
var selectedMember = {}; var selectedMember = {};
var apiV3Prefix = '/api/v3'; var apiV3Prefix = '/api/v3';

View File

@@ -6,18 +6,21 @@ window.habitrpg = angular.module('habitrpg', ['chieffancypants.loadingBar', 'ui.
.constant("STORAGE_SETTINGS_ID", 'habit-mobile-settings') .constant("STORAGE_SETTINGS_ID", 'habit-mobile-settings')
.constant("MOBILE_APP", false) .constant("MOBILE_APP", false)
.controller("RootCtrl", ['$scope', '$location', '$modal', '$http', 'Stats', function($scope, $location, $modal, $http, Stats){ .controller("RootCtrl", ['$scope', '$location', '$modal', '$http', 'Stats', 'Members',
function($scope, $location, $modal, $http, Stats, Members) {
var memberId = $location.search()['memberId']; var memberId = $location.search()['memberId'];
if (memberId) { if (memberId) {
$http.get('/api/v2/members/'+memberId).success(function(data, status, headers, config){ Members.fetchMember(memberId)
$scope.profile = window.habitrpgShared.wrap(data, false); .success(function(response) {
$scope.statCalc = Stats; $scope.profile = response.data;
$scope.Content = window.habitrpgShared.content;
$modal.open({ $scope.statCalc = Stats;
templateUrl: 'modals/member.html', $scope.Content = window.habitrpgShared.content;
scope: $scope $modal.open({
templateUrl: 'modals/member.html',
scope: $scope
});
}); });
})
} }
$http.defaults.headers.common['x-client'] = 'habitica-web'; $http.defaults.headers.common['x-client'] = 'habitica-web';

View File

@@ -136,6 +136,7 @@
"js/services/statServices.js", "js/services/statServices.js",
"js/services/taskServices.js", "js/services/taskServices.js",
"js/services/tagsServices.js", "js/services/tagsServices.js",
"js/services/memberServices.js",
"js/controllers/authCtrl.js", "js/controllers/authCtrl.js",
"js/controllers/footerCtrl.js" "js/controllers/footerCtrl.js"
], ],
@@ -172,6 +173,7 @@
"js/services/taskServices.js", "js/services/taskServices.js",
"js/services/tagsServices.js", "js/services/tagsServices.js",
"js/services/userServices.js", "js/services/userServices.js",
"js/services/memberServices.js",
"js/controllers/authCtrl.js", "js/controllers/authCtrl.js",
"js/controllers/footerCtrl.js" "js/controllers/footerCtrl.js"
], ],

View File

@@ -33,7 +33,7 @@ let api = {};
api.getMember = { api.getMember = {
method: 'GET', method: 'GET',
url: '/members/:memberId', url: '/members/:memberId',
middlewares: [authWithHeaders()], middlewares: [],
async handler (req, res) { async handler (req, res) {
req.checkParams('memberId', res.t('memberIdRequired')).notEmpty().isUUID(); req.checkParams('memberId', res.t('memberIdRequired')).notEmpty().isUUID();