Files
habitica/website/client-old/js/controllers/memberModalCtrl.js
MathWhiz e8b7660376 Add Costume Info to member modal (#7768)
* Add localization strings

* Change name of Equipment section

* Add costume section to member modal

* Add costume section to member modal

* Add current pet and current mount info

* Reorder Sections and Separate Active Mounts/Pets

* switch ng-show with ng-if

* Add `noActiveMount` to pets.json

* Breaking Stuff

* Add petservices.js to the manifest

* Remove Extra Parenthesis

* Progress towards backgrounds

* Add semicolons

* Add background information

* Add all methods in petServices to userCtrl and memberModalCtrl

* Add avatar settings

* Add semicolons

* Revert "Add avatar settings"

This reverts commit 6e8cca9736.

* Remove active-pet-and-mount

* Remove Content from memberModalCtrl

* Update costumeServices.js

* Make costumeservices.js more readable

* Update costumeServices.js

* Update costumeService logic

* Remove unused strings

* Fix include statements

* move service

* Update pet/mount logic

* fixes

* Fix background logic
2016-11-21 21:19:13 +10:00

81 lines
2.6 KiB
JavaScript

"use strict";
habitrpg
.controller("MemberModalCtrl", ['$scope', '$rootScope', 'Members', 'Shared', '$http', 'Notification', 'Groups', 'Chat', '$controller', 'Stats', 'Costume',
function($scope, $rootScope, Members, Shared, $http, Notification, Groups, Chat, $controller, Stats, Costume) {
$controller('RootCtrl', {$scope: $scope});
$rootScope.appLoaded = true;
$scope.timestamp = function(timestamp){
return moment(timestamp).format($rootScope.User.user.preferences.dateFormat.toUpperCase());
}
$scope.statCalc = Stats;
// We watch Members.selectedMember because it's asynchronously set, so would be a hassle to handle updates here
$scope.$watch( function() { return Members.selectedMember; }, function (member) {
if(member) {
$scope.profile = member;
}
});
$scope.costume = Costume;
$scope.keyDownListener = function (e) {
if (e.key === 'Enter' && (e.metaKey || e.ctrlKey)) {
$scope.sendPrivateMessage($scope.profile._id, $scope._message);
}
};
$scope.sendPrivateMessage = function(uuid, message){
if (!message) return;
Members.sendPrivateMessage(message, uuid)
.then(function (response) {
Notification.text(window.env.t('messageSentAlert'));
$rootScope.User.sync();
$scope.$close();
});
};
//@TODO: We don't send subscriptions so the structure has changed in the back. Update this when we update the views.
$scope.gift = {
type: 'gems',
gems: {amount: 0, fromBalance: true},
subscription: {key: ''},
message: ''
};
$scope.sendGift = function (uuid) {
Members.transferGems($scope.gift.message, uuid, $scope.gift.gems.amount)
.then(function (response) {
Notification.text(window.env.t('sentGems'));
$rootScope.User.sync();
$scope.$close();
});
};
$scope.reportAbuse = function(reporter, message, groupId) {
Chat.flagChatMessage(groupId, message.id)
.then(function(data){
var res = data.data.data;
message.flags = res.flags;
message.flagCount = res.flagCount;
Notification.text(window.env.t('abuseReported'));
$scope.$close();
});
};
$scope.clearFlagCount = function(message, groupId) {
Chat.clearFlagCount(groupId, message.id)
.then(function(data){
message.flagCount = 0;
Notification.text("Flags cleared");
$scope.$close();
});
}
}
]);