mirror of
https://github.com/HabitRPG/habitica.git
synced 2025-12-19 07:37:25 +01:00
[#1465] add member modals back in. Not all info is present, just a bit more
work. Can now click guild & tavern members! does lazy-loading of members so we don't have to load all their information at once
This commit is contained in:
@@ -1,17 +1,38 @@
|
||||
"use strict";
|
||||
|
||||
habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'API_URL', '$q', 'User',
|
||||
function($scope, $rootScope, Groups, $http, API_URL, $q, User) {
|
||||
habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'API_URL', '$q', 'User', 'Members', '$location',
|
||||
function($scope, $rootScope, Groups, $http, API_URL, $q, User, Members, $location) {
|
||||
|
||||
$scope.isMember = function(user, group){
|
||||
return ~(group.members.indexOf(user._id));
|
||||
}
|
||||
|
||||
$scope.groups = Groups.groups;
|
||||
// ------ Loading ------
|
||||
|
||||
$scope.groups = Groups.groups;
|
||||
$scope.fetchGuilds = Groups.fetchGuilds;
|
||||
$scope.fetchTavern = Groups.fetchTavern;
|
||||
|
||||
// ------ Modals ------
|
||||
|
||||
$scope.clickMember = function(uid) {
|
||||
if (User.user._id == uid) {
|
||||
if ($location.path() == '/tasks') {
|
||||
$location.path('/options');
|
||||
} else {
|
||||
$location.path('/tasks');
|
||||
}
|
||||
} else {
|
||||
// We need the member information up top here, but then we pass it down to the modal controller
|
||||
// down below. Better way of handling this?
|
||||
debugger
|
||||
Members.selectMember(uid);
|
||||
$rootScope.modals.member = true;
|
||||
}
|
||||
}
|
||||
|
||||
// ------ Invites ------
|
||||
|
||||
$scope.invitee = '';
|
||||
$scope.invite = function(group, uuid){
|
||||
group.$invite({uuid:uuid}, function(){
|
||||
@@ -22,6 +43,15 @@ habitrpg.controller("GroupsCtrl", ['$scope', '$rootScope', 'Groups', '$http', 'A
|
||||
}
|
||||
])
|
||||
|
||||
.controller("MemberModalCtrl", ['$scope', '$rootScope', 'Members',
|
||||
function($scope, $rootScope, Members) {
|
||||
// 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) {
|
||||
$scope.profile = member;
|
||||
});
|
||||
}
|
||||
])
|
||||
|
||||
.controller('ChatCtrl', ['$scope', 'Groups', 'User', function($scope, Groups, User){
|
||||
$scope._chatMessage = '';
|
||||
$scope.postChat = function(group, message){
|
||||
|
||||
Reference in New Issue
Block a user