Invitation link UI
This commit is contained in:
parent
d04d36c8cd
commit
ef05ac440e
@ -1611,9 +1611,7 @@ define([
|
|||||||
buttons: contactsButtons
|
buttons: contactsButtons
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
hasFriends = false;
|
|
||||||
var friendsObject = hasFriends ? getContacts() : noContactsMessage(common);
|
var friendsObject = hasFriends ? getContacts() : noContactsMessage(common);
|
||||||
console.log(friendsObject);
|
|
||||||
var friendsList = friendsObject.content;
|
var friendsList = friendsObject.content;
|
||||||
var contactsButtons = friendsObject.buttons;
|
var contactsButtons = friendsObject.buttons;
|
||||||
contactsButtons.unshift({
|
contactsButtons.unshift({
|
||||||
@ -1631,10 +1629,67 @@ define([
|
|||||||
buttons: contactsButtons,
|
buttons: contactsButtons,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
var linkName, linkPassword, linkMessage;
|
||||||
|
var linKError;
|
||||||
// Invite from link
|
// Invite from link
|
||||||
var linkContent = h('div.cp-share-modal', [
|
var linkContent = h('div.cp-share-modal', [
|
||||||
|
h('p', 'XXX Invite link description...'), // XXX
|
||||||
|
linkError = h('div.alert.alert-danger', {style : 'display: none;'}),
|
||||||
|
linkName = h('input', {
|
||||||
|
placeholder: 'name...' // XXX
|
||||||
|
}),
|
||||||
|
h('br'),
|
||||||
|
linkPassword = UI.passwordInput({
|
||||||
|
id: 'cp-teams-invite-password',
|
||||||
|
placeholder: 'password...' // XXX
|
||||||
|
}),
|
||||||
|
h('br'),
|
||||||
|
linkMessage = h('textarea', {
|
||||||
|
placeholder: 'note...'
|
||||||
|
})
|
||||||
]);
|
]);
|
||||||
var linkButtons = [];
|
var process = function () {
|
||||||
|
$(linkError).text('').hide();
|
||||||
|
var name = $(linkName).val();
|
||||||
|
var pw = $(linkPassword).val();
|
||||||
|
var msg = $(linkMessage).val();
|
||||||
|
if (!name || !name.trim()) {
|
||||||
|
$(linkError).text('empty name...').show(); // XXX
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
var bytes;
|
||||||
|
nThen(function (waitFor) {
|
||||||
|
// Scrypt
|
||||||
|
}).nThen(function (waitFor) {
|
||||||
|
module.execCommand('CREATE_INVITE_LINK', {
|
||||||
|
name: name,
|
||||||
|
password: pw,
|
||||||
|
message: msg,
|
||||||
|
// send scrypt result
|
||||||
|
teamId: config.teamId,
|
||||||
|
}, waitFor(function (obj) {
|
||||||
|
if (obj && obj.error) {
|
||||||
|
waitFor.abort();
|
||||||
|
return void $(linkError).text('ERROR '+obj.error).show(); // XXX
|
||||||
|
}
|
||||||
|
// Display result here
|
||||||
|
}));
|
||||||
|
});
|
||||||
|
return true;
|
||||||
|
};
|
||||||
|
var linkButtons = [{
|
||||||
|
className: 'cancel',
|
||||||
|
name: Messages.cancel,
|
||||||
|
onClick: function () {},
|
||||||
|
keys: [27]
|
||||||
|
}, {
|
||||||
|
className: 'primary',
|
||||||
|
name: 'CREATE LINK', // XXX
|
||||||
|
onClick: function () {
|
||||||
|
return process();
|
||||||
|
},
|
||||||
|
keys: [13]
|
||||||
|
}];
|
||||||
|
|
||||||
var frameLink = UI.dialog.customModal(linkContent, {
|
var frameLink = UI.dialog.customModal(linkContent, {
|
||||||
buttons: linkButtons,
|
buttons: linkButtons,
|
||||||
|
|||||||
@ -1259,6 +1259,17 @@ define([
|
|||||||
ctx.store.messenger.openTeamChat(team.getChatData(), onUpdate, cId, cb);
|
ctx.store.messenger.openTeamChat(team.getChatData(), onUpdate, cId, cb);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
var createInviteLink = function (ctx, data, cId, cb) {
|
||||||
|
var team = ctx.teams[data.teamId];
|
||||||
|
// var roster = team.roster;
|
||||||
|
// var name = data.name;
|
||||||
|
// var password = data.password;
|
||||||
|
// var msg = data.message;
|
||||||
|
cb({
|
||||||
|
error: 'NOT_IMPLEMENTED'
|
||||||
|
});
|
||||||
|
};
|
||||||
|
|
||||||
Team.init = function (cfg, waitFor, emit) {
|
Team.init = function (cfg, waitFor, emit) {
|
||||||
var team = {};
|
var team = {};
|
||||||
var store = cfg.store;
|
var store = cfg.store;
|
||||||
@ -1412,6 +1423,9 @@ define([
|
|||||||
if (cmd === 'GET_EDITABLE_FOLDERS') {
|
if (cmd === 'GET_EDITABLE_FOLDERS') {
|
||||||
return void getEditableFolders(ctx, data, clientId, cb);
|
return void getEditableFolders(ctx, data, clientId, cb);
|
||||||
}
|
}
|
||||||
|
if (cmd === 'CREATE_INVITE_LINK') {
|
||||||
|
return void createInviteLink(ctx, data, clientId, cb);
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return team;
|
return team;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user