Add a 'New pad' button in the toolbar

pull/1/head
yflory 8 years ago
parent a9063e0459
commit 88d5b4cc9c

@ -300,7 +300,7 @@
}
}
.buttonTitle {
.fa-user {
.fa:not(.fa-caret-down) {
margin-right: 5px;
}
.account-name {

@ -370,7 +370,7 @@
.cryptpad-user p.accountData > span span {
font-weight: normal;
}
.cryptpad-user .buttonTitle .fa-user {
.cryptpad-user .buttonTitle .fa:not(.fa-caret-down) {
margin-right: 5px;
}
.cryptpad-user .buttonTitle .account-name {

@ -82,6 +82,9 @@ define(function () {
out.shareSuccess = 'URL copiée dans le presse-papiers';
out.shareFailed = "Échec de la copie de l'URL dans le presse-papiers";
out.newPadButton = 'Nouveau';
out.newPadButtonTitle = 'Créer un nouveau document';
out.presentButton = 'PRÉSENTER';
out.presentButtonTitle = "Entrer en mode présentation";
out.presentSuccess = 'Appuyer sur Échap pour quitter le mode présentation';

@ -84,6 +84,9 @@ define(function () {
out.shareSuccess = 'Copied URL to clipboard';
out.shareFailed = "Failed to copy URL to clipboard";
out.newPadButton = 'New';
out.newPadButtonTitle = 'Create a new document';
out.presentButton = 'PRESENT';
out.presentButtonTitle = "Enter presentation mode";
out.presentSuccess = 'Hit ESC to exit presentation mode';

@ -375,7 +375,7 @@ define([
});
var config = {
displayed: ['useradmin', 'language', 'spinner', 'lag', 'state', 'share', 'userlist'],
displayed: ['useradmin', 'language', 'spinner', 'lag', 'state', 'share', 'userlist', 'newpad'],
userData: userData,
readOnly: readOnly,
ifrw: ifrw,

@ -326,9 +326,7 @@ define([
};
var createUserAdmin = function ($topContainer, config, readOnly, lagElement, Cryptpad) {
if (config.displayed.indexOf('useradmin') === -1 && config.displayed.indexOf('share') === -1) { return; }
var $lag = $(lagElement);
//TODO check if we should displayed that button and if we can (userName.setName, userName.lastName and userdata required)
var $userContainer = $('<span>', {
'class': USER_CLS
@ -349,6 +347,29 @@ define([
Cryptpad.createLanguageSelector($userContainer);
}
if (config.displayed.indexOf('newpad') !== -1) {
var pads_options = [];
['pad', 'code', 'slide', 'poll'].forEach(function (p) {
pads_options.push({
tag: 'a',
attributes: {
'target': '_blank', // TODO: open in the same window?
'href': '/' + p,
},
content: Messages.type[p] // Pretty name of the language value
});
});
var $newButton = $('<div>').append($('<span>', {'class': 'fa fa-plus'})).append(Messages.newPadButton);
var dropdownConfig = {
text: $newButton.html(), // Button initial text
options: pads_options, // Entries displayed in the menu
left: true, // Open to the left of the button
};
var $newPadBlock = Cryptpad.createDropdown(dropdownConfig);
$newPadBlock.find('button').attr('title', Messages.newPadButtonTitle);
$newPadBlock.appendTo($userContainer);
}
// User dropdown
if (config.displayed.indexOf('useradmin') !== -1) {
if (!config.userName || !config.userName.setName || !config.userName.lastName) {

@ -568,7 +568,7 @@ define([
});
var config = {
displayed: ['useradmin', 'language', 'spinner', 'lag', 'state', 'share', 'userlist'],
displayed: ['useradmin', 'language', 'spinner', 'lag', 'state', 'share', 'userlist', 'newpad'],
userData: userData,
readOnly: readOnly,
ifrw: ifrw,

@ -652,7 +652,7 @@ define([
});
var config = {
displayed: ['useradmin', 'language', 'spinner', 'lag', 'state', 'share', 'userlist'],
displayed: ['useradmin', 'language', 'spinner', 'lag', 'state', 'share', 'userlist', 'newpad'],
userData: userData,
readOnly: readOnly,
title: {

@ -418,7 +418,7 @@ define([
});
var config = {
displayed: ['useradmin', 'language', 'spinner', 'lag', 'state', 'share', 'userlist'],
displayed: ['useradmin', 'language', 'spinner', 'lag', 'state', 'share', 'userlist', 'newpad'],
userData: userData,
readOnly: readOnly,
ifrw: ifrw,

Loading…
Cancel
Save