|
|
@ -173,7 +173,7 @@ define([
|
|
|
|
showCategories(categories[key]);
|
|
|
|
showCategories(categories[key]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
|
$category.append(Messages['team_cat_'+key] || key); // XXX
|
|
|
|
$category.append(Messages['team_cat_'+key] || key);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
if (active === 'drive') {
|
|
|
|
if (active === 'drive') {
|
|
|
|
APP.$rightside.addClass('cp-rightside-drive');
|
|
|
|
APP.$rightside.addClass('cp-rightside-drive');
|
|
|
@ -259,8 +259,8 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
makeBlock('info', function (common, cb) {
|
|
|
|
makeBlock('info', function (common, cb) {
|
|
|
|
cb([
|
|
|
|
cb([
|
|
|
|
h('h3', 'Team application'), // XXX
|
|
|
|
h('h3', Messages.team_infoLabel),
|
|
|
|
h('p', 'From here you can ...') // XXX
|
|
|
|
h('p', Messages.team_infoContent)
|
|
|
|
]);
|
|
|
|
]);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|
|
@ -274,13 +274,12 @@ define([
|
|
|
|
var lis = [];
|
|
|
|
var lis = [];
|
|
|
|
Object.keys(obj).forEach(function (id) {
|
|
|
|
Object.keys(obj).forEach(function (id) {
|
|
|
|
var team = obj[id];
|
|
|
|
var team = obj[id];
|
|
|
|
var a = h('a', 'Open');
|
|
|
|
var a = h('a', Messages.team_listLoad);
|
|
|
|
var avatar = h('span.cp-avatar.cp-team-list-avatar');
|
|
|
|
var avatar = h('span.cp-avatar.cp-team-list-avatar');
|
|
|
|
lis.push(h('li', h('ul', [
|
|
|
|
lis.push(h('li', h('ul', [ // XXX UI
|
|
|
|
h('li', avatar), // XXX
|
|
|
|
h('li', avatar),
|
|
|
|
h('li', 'Name: ' + team.metadata.name), // XXX
|
|
|
|
h('li', team.metadata.name),
|
|
|
|
h('li', 'ID: ' + id), // XXX
|
|
|
|
h('li', a)
|
|
|
|
h('li', a) // XXX
|
|
|
|
|
|
|
|
])));
|
|
|
|
])));
|
|
|
|
common.displayAvatar($(avatar), team.metadata.avatar, team.metadata.name);
|
|
|
|
common.displayAvatar($(avatar), team.metadata.avatar, team.metadata.name);
|
|
|
|
$(a).click(function () {
|
|
|
|
$(a).click(function () {
|
|
|
@ -305,11 +304,11 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
makeBlock('create', function (common, cb) {
|
|
|
|
makeBlock('create', function (common, cb) {
|
|
|
|
var content = [];
|
|
|
|
var content = [];
|
|
|
|
content.push(h('h3', 'Create a team')); // XXX
|
|
|
|
content.push(h('h3', Messages.team_createLabel));
|
|
|
|
content.push(h('label', 'Team name')); // XXX
|
|
|
|
content.push(h('label', Messages.team_createName));
|
|
|
|
var input = h('input', {type:'text'});
|
|
|
|
var input = h('input', {type:'text'});
|
|
|
|
content.push(input);
|
|
|
|
content.push(input);
|
|
|
|
var button = h('button.btn.btn-success', 'Create'); // XXX
|
|
|
|
var button = h('button.btn.btn-success', Messages.creation_create);
|
|
|
|
content.push(h('br'));
|
|
|
|
content.push(h('br'));
|
|
|
|
content.push(h('br'));
|
|
|
|
content.push(h('br'));
|
|
|
|
content.push(button);
|
|
|
|
content.push(button);
|
|
|
@ -403,7 +402,7 @@ define([
|
|
|
|
// If they're a member and I have a higher role than them, I can promote them to admin
|
|
|
|
// If they're a member and I have a higher role than them, I can promote them to admin
|
|
|
|
if (!isMe && myRole > theirRole && theirRole === 0) {
|
|
|
|
if (!isMe && myRole > theirRole && theirRole === 0) {
|
|
|
|
var promote = h('span.fa.fa-angle-double-up', {
|
|
|
|
var promote = h('span.fa.fa-angle-double-up', {
|
|
|
|
title: 'Promote' // XXX
|
|
|
|
title: Messages.team_rosterPromote
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$(promote).click(function () {
|
|
|
|
$(promote).click(function () {
|
|
|
|
data.role = 'ADMIN';
|
|
|
|
data.role = 'ADMIN';
|
|
|
@ -416,7 +415,7 @@ define([
|
|
|
|
// (if they're not already a MEMBER)
|
|
|
|
// (if they're not already a MEMBER)
|
|
|
|
if (!isMe && myRole >= theirRole && theirRole > 0) {
|
|
|
|
if (!isMe && myRole >= theirRole && theirRole > 0) {
|
|
|
|
var demote = h('span.fa.fa-angle-double-down', {
|
|
|
|
var demote = h('span.fa.fa-angle-double-down', {
|
|
|
|
title: 'Demote' // XXX
|
|
|
|
title: Messages.team_rosterDemote
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$(demote).click(function () {
|
|
|
|
$(demote).click(function () {
|
|
|
|
data.role = ROLES[theirRole - 1] || 'MEMBER';
|
|
|
|
data.role = ROLES[theirRole - 1] || 'MEMBER';
|
|
|
@ -428,7 +427,7 @@ define([
|
|
|
|
// If I'm not a member and I have an equal or higher role than them, I can remove them
|
|
|
|
// If I'm not a member and I have an equal or higher role than them, I can remove them
|
|
|
|
if (!isMe && myRole > 0 && myRole >= theirRole) {
|
|
|
|
if (!isMe && myRole > 0 && myRole >= theirRole) {
|
|
|
|
var remove = h('span.fa.fa-times', {
|
|
|
|
var remove = h('span.fa.fa-times', {
|
|
|
|
title: 'Remove' // XXX
|
|
|
|
title: Messages.team_rosterKick
|
|
|
|
});
|
|
|
|
});
|
|
|
|
$(remove).click(function () {
|
|
|
|
$(remove).click(function () {
|
|
|
|
$(remove).hide();
|
|
|
|
$(remove).hide();
|
|
|
@ -487,15 +486,14 @@ define([
|
|
|
|
}).map(function (k) {
|
|
|
|
}).map(function (k) {
|
|
|
|
return makeMember(common, roster[k], me);
|
|
|
|
return makeMember(common, roster[k], me);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
// XXX LEAVE the team button
|
|
|
|
|
|
|
|
// XXX INVITE to the team button
|
|
|
|
|
|
|
|
var header = h('div.cp-app-team-roster-header');
|
|
|
|
var header = h('div.cp-app-team-roster-header');
|
|
|
|
var $header = $(header);
|
|
|
|
var $header = $(header);
|
|
|
|
|
|
|
|
|
|
|
|
// If you're an admin or an owner, you can invite your friends to the team
|
|
|
|
// If you're an admin or an owner, you can invite your friends to the team
|
|
|
|
// TODO and acquaintances later?
|
|
|
|
// TODO and acquaintances later?
|
|
|
|
if (me && (me.role === 'ADMIN' || me.role === 'OWNER')) {
|
|
|
|
if (me && (me.role === 'ADMIN' || me.role === 'OWNER')) {
|
|
|
|
var invite = h('button.btn.btn-primary', 'INVITE A FRIEND');
|
|
|
|
var invite = h('button.btn.btn-primary', Messages.team_inviteButton);
|
|
|
|
var inviteFriends = common.getFriends();
|
|
|
|
var inviteFriends = common.getFriends();
|
|
|
|
Object.keys(inviteFriends).forEach(function (curve) {
|
|
|
|
Object.keys(inviteFriends).forEach(function (curve) {
|
|
|
|
// Keep only friends that are not already in the team and that you can contact
|
|
|
|
// Keep only friends that are not already in the team and that you can contact
|
|
|
@ -517,9 +515,9 @@ define([
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
if (me && (me.role === 'ADMIN' || me.role === 'MEMBER')) {
|
|
|
|
if (me && (me.role === 'ADMIN' || me.role === 'MEMBER')) {
|
|
|
|
var leave = h('button.btn.btn-danger', 'LEAVE THE TEAM');
|
|
|
|
var leave = h('button.btn.btn-danger', Messages.team_leaveButton);
|
|
|
|
$(leave).click(function () {
|
|
|
|
$(leave).click(function () {
|
|
|
|
UI.confirm("Your're going to leave this team and lose access to its entire drive. Are you sure?", function (yes) {
|
|
|
|
UI.confirm(Messages.team_leaveConfirm, function (yes) {
|
|
|
|
if (!yes) { return; }
|
|
|
|
if (!yes) { return; }
|
|
|
|
APP.module.execCommand('LEAVE_TEAM', {
|
|
|
|
APP.module.execCommand('LEAVE_TEAM', {
|
|
|
|
teamId: APP.team
|
|
|
|
teamId: APP.team
|
|
|
@ -535,11 +533,11 @@ define([
|
|
|
|
|
|
|
|
|
|
|
|
return [
|
|
|
|
return [
|
|
|
|
header,
|
|
|
|
header,
|
|
|
|
h('h3', 'OWNER'), // XXX
|
|
|
|
h('h3', Messages.team_owner),
|
|
|
|
h('div', owner),
|
|
|
|
h('div', owner),
|
|
|
|
h('h3', 'ADMINS'), // XXX
|
|
|
|
h('h3', Messages.team_admins),
|
|
|
|
h('div', admins),
|
|
|
|
h('div', admins),
|
|
|
|
h('h3', 'MEMBERS'), // XXX
|
|
|
|
h('h3', Messages.team_members),
|
|
|
|
h('div', members)
|
|
|
|
h('div', members)
|
|
|
|
];
|
|
|
|
];
|
|
|
|
};
|
|
|
|
};
|
|
|
@ -557,7 +555,7 @@ define([
|
|
|
|
teamId: APP.team
|
|
|
|
teamId: APP.team
|
|
|
|
}, function (obj) {
|
|
|
|
}, function (obj) {
|
|
|
|
if (obj && obj.error) {
|
|
|
|
if (obj && obj.error) {
|
|
|
|
return void UI.alert(Messages.error); // XXX
|
|
|
|
return void UI.alert(Messages.error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
common.setTeamChat(obj.channel);
|
|
|
|
common.setTeamChat(obj.channel);
|
|
|
|
MessengerUI.create($(container), common, true);
|
|
|
|
MessengerUI.create($(container), common, true);
|
|
|
@ -700,7 +698,7 @@ define([
|
|
|
|
driveAPP.loggedIn = common.isLoggedIn();
|
|
|
|
driveAPP.loggedIn = common.isLoggedIn();
|
|
|
|
if (!driveAPP.loggedIn) { throw new Error('NOT_LOGGED_IN'); }
|
|
|
|
if (!driveAPP.loggedIn) { throw new Error('NOT_LOGGED_IN'); }
|
|
|
|
|
|
|
|
|
|
|
|
common.setTabTitle('TEAMS (ALPHA)'); // XXX
|
|
|
|
common.setTabTitle(Messages.type.team);
|
|
|
|
|
|
|
|
|
|
|
|
// Drive data
|
|
|
|
// Drive data
|
|
|
|
if (privateData.newSharedFolder) {
|
|
|
|
if (privateData.newSharedFolder) {
|
|
|
@ -712,7 +710,7 @@ define([
|
|
|
|
var $bar = $('#cp-toolbar');
|
|
|
|
var $bar = $('#cp-toolbar');
|
|
|
|
var configTb = {
|
|
|
|
var configTb = {
|
|
|
|
displayed: ['useradmin', 'pageTitle', 'newpad', 'limit', 'notifications'],
|
|
|
|
displayed: ['useradmin', 'pageTitle', 'newpad', 'limit', 'notifications'],
|
|
|
|
pageTitle: 'TEAMS (ALPHA)', // XXX
|
|
|
|
pageTitle: Messages.type.team,
|
|
|
|
metadataMgr: metadataMgr,
|
|
|
|
metadataMgr: metadataMgr,
|
|
|
|
readOnly: privateData.readOnly,
|
|
|
|
readOnly: privateData.readOnly,
|
|
|
|
sfCommon: common,
|
|
|
|
sfCommon: common,
|
|
|
|