Invite to team modal
This commit is contained in:
parent
585138aeee
commit
998e2f81d2
@ -1559,6 +1559,7 @@ define([
|
|||||||
|
|
||||||
var module = config.module || common.makeUniversal('team');
|
var module = config.module || common.makeUniversal('team');
|
||||||
|
|
||||||
|
// Invite contacts
|
||||||
var $div;
|
var $div;
|
||||||
var refreshButton = function () {
|
var refreshButton = function () {
|
||||||
if (!$div) { return; }
|
if (!$div) { return; }
|
||||||
@ -1572,20 +1573,16 @@ define([
|
|||||||
$btn.prop('disabled', 'disabled');
|
$btn.prop('disabled', 'disabled');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
var getContacts = function () {
|
||||||
var list = UIElements.getUserGrid(Messages.team_pickFriends, {
|
var list = UIElements.getUserGrid(Messages.team_pickFriends, {
|
||||||
common: common,
|
common: common,
|
||||||
data: config.friends,
|
data: config.friends,
|
||||||
large: true
|
large: true
|
||||||
}, refreshButton);
|
}, refreshButton);
|
||||||
$div = $(list.div);
|
var div = h('div.contains-nav');
|
||||||
refreshButton();
|
var $div = $(div);
|
||||||
|
$div.append(list.div);
|
||||||
var buttons = [{
|
var contactsButtons = [{
|
||||||
className: 'cancel',
|
|
||||||
name: Messages.cancel,
|
|
||||||
onClick: function () {},
|
|
||||||
keys: [27]
|
|
||||||
}, {
|
|
||||||
className: 'primary',
|
className: 'primary',
|
||||||
name: Messages.team_inviteModalButton,
|
name: Messages.team_inviteModalButton,
|
||||||
onClick: function () {
|
onClick: function () {
|
||||||
@ -1609,11 +1606,54 @@ define([
|
|||||||
keys: [13]
|
keys: [13]
|
||||||
}];
|
}];
|
||||||
|
|
||||||
var content = h('div', [
|
return {
|
||||||
list.div
|
content: div,
|
||||||
|
buttons: contactsButtons
|
||||||
|
};
|
||||||
|
};
|
||||||
|
hasFriends = false;
|
||||||
|
var friendsObject = hasFriends ? getContacts() : noContactsMessage(common);
|
||||||
|
console.log(friendsObject);
|
||||||
|
var friendsList = friendsObject.content;
|
||||||
|
var contactsButtons = friendsObject.buttons;
|
||||||
|
contactsButtons.unshift({
|
||||||
|
className: 'cancel',
|
||||||
|
name: Messages.cancel,
|
||||||
|
onClick: function () {},
|
||||||
|
keys: [27]
|
||||||
|
});
|
||||||
|
|
||||||
|
var contactsContent = h('div.cp-share-modal', [
|
||||||
|
friendsList
|
||||||
]);
|
]);
|
||||||
|
|
||||||
var modal = UI.dialog.customModal(content, {buttons: buttons});
|
var frameContacts = UI.dialog.customModal(contactsContent, {
|
||||||
|
buttons: contactsButtons,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Invite from link
|
||||||
|
var linkContent = h('div.cp-share-modal', [
|
||||||
|
]);
|
||||||
|
var linkButtons = [];
|
||||||
|
|
||||||
|
var frameLink = UI.dialog.customModal(linkContent, {
|
||||||
|
buttons: linkButtons,
|
||||||
|
});
|
||||||
|
|
||||||
|
// Create modal
|
||||||
|
var tabs = [{
|
||||||
|
title: Messages.share_contactCategory,
|
||||||
|
icon: "fa fa-address-book",
|
||||||
|
content: frameContacts,
|
||||||
|
active: hasFriends
|
||||||
|
}, {
|
||||||
|
title: Messages.share_linkCategory,
|
||||||
|
icon: "fa fa-link",
|
||||||
|
content: frameLink,
|
||||||
|
active: !hasFriends
|
||||||
|
}];
|
||||||
|
|
||||||
|
var modal = UI.dialog.tabs(tabs);
|
||||||
UI.openCustomModal(modal);
|
UI.openCustomModal(modal);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user