mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-18 15:17:25 +01:00
rename website/client to website/client-old
This commit is contained in:
54
website/client-old/js/controllers/hallCtrl.js
Normal file
54
website/client-old/js/controllers/hallCtrl.js
Normal file
@@ -0,0 +1,54 @@
|
||||
"use strict";
|
||||
|
||||
habitrpg.controller("HallHeroesCtrl", ['$scope', '$rootScope', 'User', 'Notification', 'ApiUrl', 'Hall',
|
||||
function($scope, $rootScope, User, Notification, ApiUrl, Hall) {
|
||||
$scope.hero = undefined;
|
||||
$scope.currentHeroIndex = undefined;
|
||||
$scope.heroes = [];
|
||||
|
||||
Hall.getHeroes()
|
||||
.then(function (response) {
|
||||
$scope.heroes = response.data.data;
|
||||
});
|
||||
|
||||
$scope.loadHero = function(uuid, heroIndex) {
|
||||
$scope.currentHeroIndex = heroIndex;
|
||||
Hall.getHero(uuid)
|
||||
.then(function (response) {
|
||||
$scope.hero = response.data.data;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.saveHero = function(hero) {
|
||||
$scope.hero.contributor.admin = ($scope.hero.contributor.level > 7) ? true : false;
|
||||
Hall.updateHero($scope.hero)
|
||||
.then(function (response) {
|
||||
Notification.text("User updated");
|
||||
$scope.hero = undefined;
|
||||
$scope._heroID = undefined;
|
||||
$scope.heroes[$scope.currentHeroIndex] = response.data.data;
|
||||
$scope.currentHeroIndex = undefined;
|
||||
});
|
||||
}
|
||||
|
||||
$scope.populateContributorInput = function(id, index) {
|
||||
$scope._heroID = id;
|
||||
window.scrollTo(0, 200);
|
||||
$scope.loadHero(id, index);
|
||||
};
|
||||
}]);
|
||||
|
||||
habitrpg.controller("HallPatronsCtrl", ['$scope', '$rootScope', 'User', 'Notification', 'ApiUrl', 'Hall',
|
||||
function($scope, $rootScope, User, Notification, ApiUrl, Hall) {
|
||||
var page = 0;
|
||||
$scope.patrons = [];
|
||||
|
||||
$scope.loadMore = function() {
|
||||
Hall.getPatrons(page++)
|
||||
.then(function (response) {
|
||||
$scope.patrons = $scope.patrons.concat(response.data.data);
|
||||
});
|
||||
}
|
||||
$scope.loadMore();
|
||||
|
||||
}]);
|
||||
Reference in New Issue
Block a user