mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
chore(): rename website/src -> website/server and website/public -> website/client (#7199)
This commit is contained in:
42
website/client/js/controllers/hallCtrl.js
Normal file
42
website/client/js/controllers/hallCtrl.js
Normal file
@@ -0,0 +1,42 @@
|
||||
"use strict";
|
||||
|
||||
habitrpg.controller("HallHeroesCtrl", ['$scope', '$rootScope', 'User', 'Notification', 'ApiUrl', '$resource',
|
||||
function($scope, $rootScope, User, Notification, ApiUrl, $resource) {
|
||||
var Hero = $resource(ApiUrl.get() + '/api/v2/hall/heroes/:uid', {uid:'@_id'});
|
||||
$scope.hero = undefined;
|
||||
$scope.loadHero = function(uuid){
|
||||
$scope.hero = Hero.get({uid:uuid});
|
||||
}
|
||||
$scope.saveHero = function(hero) {
|
||||
$scope.hero.contributor.admin = ($scope.hero.contributor.level > 7) ? true : false;
|
||||
hero.$save(function(){
|
||||
Notification.text("User updated");
|
||||
$scope.hero = undefined;
|
||||
$scope._heroID = undefined;
|
||||
$scope.heroes = Hero.query();
|
||||
})
|
||||
}
|
||||
$scope.heroes = Hero.query();
|
||||
|
||||
$scope.populateContributorInput = function(id) {
|
||||
$scope._heroID = id;
|
||||
window.scrollTo(0,200);
|
||||
$scope.loadHero(id);
|
||||
};
|
||||
}]);
|
||||
|
||||
habitrpg.controller("HallPatronsCtrl", ['$scope', '$rootScope', 'User', 'Notification', 'ApiUrl', '$resource',
|
||||
function($scope, $rootScope, User, Notification, ApiUrl, $resource) {
|
||||
var Patron = $resource(ApiUrl.get() + '/api/v2/hall/patrons/:uid', {uid:'@_id'});
|
||||
|
||||
var page = 0;
|
||||
$scope.patrons = [];
|
||||
|
||||
$scope.loadMore = function(){
|
||||
Patron.query({page: page++}, function(patrons){
|
||||
$scope.patrons = $scope.patrons.concat(patrons);
|
||||
})
|
||||
}
|
||||
$scope.loadMore();
|
||||
|
||||
}]);
|
||||
Reference in New Issue
Block a user