Merge branch 'staging' of github.com:xwiki-labs/cryptpad into staging
commit
5b4e5480cb
|
@ -36,7 +36,10 @@ var nt = nThen(function (waitFor) {
|
|||
}).nThen;
|
||||
|
||||
[
|
||||
// login test must happen after register test
|
||||
['/register/', {}],
|
||||
['/login/', {}],
|
||||
|
||||
['/assert/', {}],
|
||||
['/auth/', {}],
|
||||
|
||||
|
|
|
@ -14,7 +14,6 @@
|
|||
}
|
||||
.cke_toolbox_main {
|
||||
display: inline-block;
|
||||
margin-bottom: -3px;
|
||||
}
|
||||
#cke_1_contents {
|
||||
flex: 1;
|
||||
|
|
|
@ -0,0 +1,40 @@
|
|||
.icons_main() {
|
||||
li {
|
||||
display: inline-block;
|
||||
margin: 10px 10px;
|
||||
width: 140px;
|
||||
height: 140px;
|
||||
text-align: center;
|
||||
vertical-align: top;
|
||||
overflow: hidden;
|
||||
text-overflow: ellipsis;
|
||||
padding-top: 5px;
|
||||
padding-bottom: 5px;
|
||||
border: 1px solid white;
|
||||
|
||||
.cp-icons-name {
|
||||
width: 100%;
|
||||
height: 24px;
|
||||
margin: 0;
|
||||
display: inline-block;
|
||||
font-size: 14px;
|
||||
//align-items: center;
|
||||
//justify-content: center;
|
||||
overflow: hidden;
|
||||
white-space: nowrap;
|
||||
text-overflow: ellipsis;
|
||||
word-wrap: break-word;
|
||||
}
|
||||
.fa {
|
||||
display: block;
|
||||
margin: auto;
|
||||
font-size: 64px;
|
||||
margin: 18px 0;
|
||||
text-align: center;
|
||||
&.listonly {
|
||||
display: none;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -6,6 +6,8 @@
|
|||
@import (once) "./toolbar-history.less";
|
||||
@import (once) "./icon-colors.less";
|
||||
@import (once) "./tools.less";
|
||||
@import (once) "./icons.less";
|
||||
@import (once) "./modal.less";
|
||||
|
||||
.toolbar_main (
|
||||
@color: @colortheme_default-color, // Color of the text for the toolbar
|
||||
|
@ -173,6 +175,68 @@
|
|||
}
|
||||
}
|
||||
|
||||
#cp-app-toolbar-creation-dialog.cp-modal-container {
|
||||
.icons_main();
|
||||
|
||||
li:hover {
|
||||
border: 1px solid white;
|
||||
}
|
||||
.cp-modal {
|
||||
display: flex;
|
||||
flex-flow: column;
|
||||
li, li .fa {
|
||||
cursor: pointer;
|
||||
}
|
||||
&> p {
|
||||
margin: 50px;
|
||||
}
|
||||
&> div {
|
||||
display: flex;
|
||||
flex-wrap: wrap;
|
||||
justify-content: center;
|
||||
align-content: center;
|
||||
overflow-y: auto;
|
||||
}
|
||||
}
|
||||
|
||||
.cp-creation-icons-name {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
#cp-app-toolbar-creation-advanced {
|
||||
width: auto;
|
||||
margin: 0;
|
||||
padding: 0;
|
||||
}
|
||||
label[for="cp-app-toolbar-creation-advanced"] {
|
||||
margin: 0;
|
||||
margin-left: 5px;
|
||||
}
|
||||
|
||||
@media screen and (max-height: @browser_media-not-big) {
|
||||
.cp-modal {
|
||||
& > p {
|
||||
display: none;
|
||||
}
|
||||
& > div {
|
||||
align-content: unset;
|
||||
li {
|
||||
height: 40px;
|
||||
width: 200px;
|
||||
display: flex;
|
||||
align-items: center;
|
||||
.fa {
|
||||
font-size: 32px;
|
||||
}
|
||||
.cp-icons-name {
|
||||
height: auto;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// TODO(cjd) This ought to be in a less file for markdown-based editors
|
||||
.cp-markdown-toolbar {
|
||||
height: @toolbar_line-height;
|
||||
|
|
|
@ -803,9 +803,12 @@ define(function () {
|
|||
// Properties about creation data
|
||||
out.creation_owners = "Propriétaires";
|
||||
out.creation_ownedByOther = "Possédé par un autre utilisateur";
|
||||
out.creation_noOwner = "Pad de propriétaire";
|
||||
out.creation_noOwner = "Pas de propriétaire";
|
||||
out.creation_expiration = "Date d'expiration";
|
||||
out.creation_propertiesTitle = "Disponibilité";
|
||||
out.creation_appMenuName = "Mode avancé (Ctrl + E)";
|
||||
out.creation_newPadModalDescription = "Cliquez sur un type de pad pour le créer. Vous pouvez cocher la case pour afficher l'écran de création de pads";
|
||||
out.creation_newPadModalAdvanced = "Afficher l'écran de création de pads";
|
||||
|
||||
return out;
|
||||
});
|
||||
|
|
|
@ -839,6 +839,9 @@ define(function () {
|
|||
out.creation_noOwner = "No owner";
|
||||
out.creation_expiration = "Expiration time";
|
||||
out.creation_propertiesTitle = "Availability";
|
||||
out.creation_appMenuName = "Advanced mode (Ctrl + E)";
|
||||
out.creation_newPadModalDescription = "Click on a pad type to create it. You can check the box if you want to display the pad creation screen (for owned pad, expiration pad, etc.).";
|
||||
out.creation_newPadModalAdvanced = "Display the pad creation screen";
|
||||
|
||||
return out;
|
||||
});
|
||||
|
|
|
@ -11,5 +11,6 @@ define(function () {
|
|||
oldStorageKey: 'CryptPad_RECENTPADS',
|
||||
storageKey: 'filesData',
|
||||
tokenKey: 'loginToken',
|
||||
displayPadCreationScreen: 'displayPadCreationScreen'
|
||||
};
|
||||
});
|
||||
|
|
|
@ -5,6 +5,7 @@ define([
|
|||
'/common/common-hash.js',
|
||||
'/common/common-language.js',
|
||||
'/common/common-interface.js',
|
||||
'/common/common-constants.js',
|
||||
'/common/common-feedback.js',
|
||||
'/common/hyperscript.js',
|
||||
'/common/media-tag.js',
|
||||
|
@ -13,8 +14,8 @@ define([
|
|||
'/bower_components/nthen/index.js',
|
||||
|
||||
'css!/common/tippy.css',
|
||||
], function ($, Config, Util, Hash, Language, UI, Feedback, h, MediaTag, Messages, AppConfig,
|
||||
NThen) {
|
||||
], function ($, Config, Util, Hash, Language, UI, Constants, Feedback, h, MediaTag, Messages,
|
||||
AppConfig, NThen) {
|
||||
var UIElements = {};
|
||||
|
||||
// Configure MediaTags to use our local viewer
|
||||
|
@ -1263,6 +1264,64 @@ define([
|
|||
return $blockContainer;
|
||||
};
|
||||
|
||||
UIElements.createNewPadModal = function (common) {
|
||||
var $modal = UIElements.createModal({
|
||||
id: 'cp-app-toolbar-creation-dialog',
|
||||
$body: $('body')
|
||||
});
|
||||
var $title = $('<h3>').text(Messages.fm_newFile);
|
||||
var $description = $('<p>').text(Messages.creation_newPadModalDescription);
|
||||
$modal.find('.cp-modal').append($title);
|
||||
$modal.find('.cp-modal').append($description);
|
||||
|
||||
var $advanced;
|
||||
|
||||
var $advancedContainer = $('<div>');
|
||||
if (common.isLoggedIn()) {
|
||||
$advanced = $('<input>', {
|
||||
type: 'checkbox',
|
||||
checked: 'checked',
|
||||
id: 'cp-app-toolbar-creation-advanced'
|
||||
}).appendTo($advancedContainer);
|
||||
$('<label>', {
|
||||
for: 'cp-app-toolbar-creation-advanced'
|
||||
}).text(Messages.creation_newPadModalAdvanced).appendTo($advancedContainer);
|
||||
}
|
||||
|
||||
var $container = $('<div>');
|
||||
AppConfig.availablePadTypes.forEach(function (p) {
|
||||
if (p === 'drive') { return; }
|
||||
if (p === 'contacts') { return; }
|
||||
if (p === 'todo') { return; }
|
||||
if (p === 'file') { return; }
|
||||
if (!common.isLoggedIn() && AppConfig.registeredOnlyTypes &&
|
||||
AppConfig.registeredOnlyTypes.indexOf(p) !== -1) { return; }
|
||||
var $element = $('<li>', {
|
||||
'class': 'cp-icons-element'
|
||||
}).prepend(UI.getIcon(p)).appendTo($container);
|
||||
$element.append($('<span>', {'class': 'cp-icons-name'})
|
||||
.text(Messages.type[p]));
|
||||
$element.attr('data-type', p);
|
||||
$element.click(function () {
|
||||
$modal.hide();
|
||||
if ($advanced && $advanced.is(':checked')) {
|
||||
common.sessionStorage.put(Constants.displayPadCreationScreen, true, function () {
|
||||
common.openURL('/' + p + '/');
|
||||
});
|
||||
return;
|
||||
}
|
||||
common.sessionStorage.put(Constants.displayPadCreationScreen, "", function () {
|
||||
common.openURL('/' + p + '/');
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
/*var $content = createNewPadIcons($modal, isInRoot);*/
|
||||
$modal.find('.cp-modal').append($container).append($advancedContainer);
|
||||
window.setTimeout(function () { $modal.show(); });
|
||||
//addNewPadHandlers($modal, isInRoot);
|
||||
};
|
||||
|
||||
UIElements.initFilePicker = function (common, cfg) {
|
||||
var onSelect = cfg.onSelect || $.noop;
|
||||
|
|
|
@ -407,7 +407,7 @@ define([
|
|||
var priv = common.getMetadataMgr().getPrivateData();
|
||||
if (priv.isNewFile) {
|
||||
var c = (priv.settings.general && priv.settings.general.creation) || {};
|
||||
if (c.skip) { return void common.createPad(c, waitFor()); }
|
||||
if (c.skip && !priv.forceCreationScreen) { return void common.createPad(c, waitFor()); }
|
||||
common.getPadCreationScreen(c, waitFor());
|
||||
}
|
||||
}).nThen(function (waitFor) {
|
||||
|
|
|
@ -148,6 +148,9 @@ define([
|
|||
if (!parsed.type) { throw new Error(); }
|
||||
var defaultTitle = Utils.Hash.getDefaultName(parsed);
|
||||
var edPublic;
|
||||
var forceCreationScreen = cfg.useCreationScreen &&
|
||||
sessionStorage[Utils.Constants.displayPadCreationScreen];
|
||||
delete sessionStorage[Utils.Constants.displayPadCreationScreen];
|
||||
var updateMeta = function () {
|
||||
//console.log('EV_METADATA_UPDATE');
|
||||
var metaObj, isTemplate;
|
||||
|
@ -182,7 +185,8 @@ define([
|
|||
upgradeURL: Cryptpad.upgradeURL
|
||||
},
|
||||
isNewFile: isNewFile,
|
||||
isDeleted: window.location.hash.length > 0
|
||||
isDeleted: window.location.hash.length > 0,
|
||||
forceCreationScreen: forceCreationScreen
|
||||
};
|
||||
for (var k in additionalPriv) { metaObj.priv[k] = additionalPriv[k]; }
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ define([
|
|||
funcs.createLanguageSelector = callWithCommon(UIElements.createLanguageSelector);
|
||||
funcs.createMarkdownToolbar = callWithCommon(UIElements.createMarkdownToolbar);
|
||||
funcs.getPadCreationScreen = callWithCommon(UIElements.getPadCreationScreen);
|
||||
funcs.createNewPadModal = callWithCommon(UIElements.createNewPadModal);
|
||||
|
||||
// Thumb
|
||||
funcs.displayThumbnail = callWithCommon(Thumb.displayThumbnail);
|
||||
|
|
|
@ -933,6 +933,21 @@ define([
|
|||
content: $('<div>').append(UI.getIcon(p)).html() + Messages.type[p]
|
||||
});
|
||||
});
|
||||
if (Config.displayCreationScreen) {
|
||||
pads_options.push({
|
||||
tag: 'a',
|
||||
attributes: {
|
||||
id: 'cp-app-toolbar-creation-advanced',
|
||||
href: origin
|
||||
},
|
||||
content: '<span class="fa fa-plus-circle"></span> ' + Messages.creation_appMenuName
|
||||
});
|
||||
$(window).keydown(function (e) {
|
||||
if (e.which === 69 && e.ctrlKey) {
|
||||
Common.createNewPadModal();
|
||||
}
|
||||
});
|
||||
}
|
||||
var dropdownConfig = {
|
||||
text: '', // Button initial text
|
||||
options: pads_options, // Entries displayed in the menu
|
||||
|
@ -945,6 +960,10 @@ define([
|
|||
var $newPadBlock = UIElements.createDropdown(dropdownConfig);
|
||||
$newPadBlock.find('button').attr('title', Messages.newButtonTitle);
|
||||
$newPadBlock.find('button').addClass('fa fa-th');
|
||||
$newPadBlock.find('#cp-app-toolbar-creation-advanced').click(function (e) {
|
||||
e.preventDefault();
|
||||
Common.createNewPadModal();
|
||||
});
|
||||
return $newPadBlock;
|
||||
};
|
||||
|
||||
|
|
|
@ -664,6 +664,10 @@ span {
|
|||
}
|
||||
}
|
||||
|
||||
.cp-app-drive-new-name {
|
||||
white-space: nowrap;
|
||||
}
|
||||
|
||||
@media screen and (max-height: @browser_media-not-big) {
|
||||
.cp-modal {
|
||||
& > p {
|
||||
|
|
|
@ -6,9 +6,10 @@ define([
|
|||
'/common/common-realtime.js',
|
||||
'/common/common-feedback.js',
|
||||
'/common/outer/local-store.js',
|
||||
'/common/test.js',
|
||||
|
||||
'less!/bower_components/components-font-awesome/css/font-awesome.min.css',
|
||||
], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore) {
|
||||
], function ($, Cryptpad, Login, UI, Realtime, Feedback, LocalStore, Test) {
|
||||
$(function () {
|
||||
var $main = $('#mainBlock');
|
||||
var Messages = Cryptpad.Messages;
|
||||
|
@ -53,6 +54,7 @@ define([
|
|||
});
|
||||
|
||||
var hashing = false;
|
||||
var test;
|
||||
$('button.login').click(function () {
|
||||
if (hashing) { return void console.log("hashing is already in progress"); }
|
||||
|
||||
|
@ -89,6 +91,11 @@ define([
|
|||
Realtime.whenRealtimeSyncs(result.realtime, function() {
|
||||
LocalStore.login(result.userHash, result.userName, function () {
|
||||
hashing = false;
|
||||
if (test) {
|
||||
localStorage.clear();
|
||||
test.pass();
|
||||
return;
|
||||
}
|
||||
if (sessionStorage.redirectTo) {
|
||||
var h = sessionStorage.redirectTo;
|
||||
var parser = document.createElement('a');
|
||||
|
@ -145,5 +152,12 @@ define([
|
|||
}
|
||||
window.location.href = '/register/';
|
||||
});
|
||||
|
||||
Test(function (t) {
|
||||
$uname.val('testuser');
|
||||
$passwd.val('testtest');
|
||||
test = t;
|
||||
$('button.login').click();
|
||||
});
|
||||
});
|
||||
});
|
||||
|
|
|
@ -16,8 +16,9 @@
|
|||
display: flex;
|
||||
}
|
||||
#cke_1_toolbox {
|
||||
display: inline-block;
|
||||
display: inline-flex;
|
||||
width: 100%;
|
||||
flex-flow: column;
|
||||
background-color: @colortheme_pad-toolbar-bg;
|
||||
}
|
||||
#cke_1_toolbox .cke_toolbar {
|
||||
|
|
|
@ -13,7 +13,6 @@ define([
|
|||
'/common/diffMarked.js',
|
||||
'/common/sframe-common-codemirror.js',
|
||||
'/common/common-thumbnail.js',
|
||||
'/bower_components/chainpad/chainpad.dist.js',
|
||||
'/common/common-interface.js',
|
||||
'/customize/messages.js',
|
||||
'cm/lib/codemirror',
|
||||
|
@ -43,7 +42,6 @@ define([
|
|||
DiffMd,
|
||||
SframeCM,
|
||||
Thumb,
|
||||
ChainPad,
|
||||
UI,
|
||||
Messages,
|
||||
CMeditor,
|
||||
|
@ -1110,6 +1108,8 @@ define([
|
|||
}).nThen(function (waitFor) {
|
||||
$('#cp-app-poll-create-user').click();
|
||||
setTimeout(waitFor());
|
||||
}).nThen(function (waitFor) {
|
||||
APP.rt.realtime.onSettle(waitFor());
|
||||
}).nThen(function (/*waitFor*/) {
|
||||
passIfOk(t);
|
||||
});
|
||||
|
|
|
@ -54,11 +54,8 @@ define([
|
|||
var $register = $('button#register');
|
||||
|
||||
var registering = false;
|
||||
var test;
|
||||
var logMeIn = function (result) {
|
||||
if (Test.testing) {
|
||||
Test.passed();
|
||||
return;
|
||||
}
|
||||
LocalStore.setUserHash(result.userHash);
|
||||
|
||||
var proxy = result.proxy;
|
||||
|
@ -72,6 +69,11 @@ define([
|
|||
Realtime.whenRealtimeSyncs(result.realtime, function () {
|
||||
LocalStore.login(result.userHash, result.userName, function () {
|
||||
registering = false;
|
||||
if (test) {
|
||||
localStorage.clear();
|
||||
test.pass();
|
||||
return;
|
||||
}
|
||||
if (sessionStorage.redirectTo) {
|
||||
var h = sessionStorage.redirectTo;
|
||||
var parser = document.createElement('a');
|
||||
|
@ -236,8 +238,9 @@ define([
|
|||
}
|
||||
});
|
||||
|
||||
Test(function () {
|
||||
$uname.val('test' + Math.random());
|
||||
Test(function (t) {
|
||||
test = t;
|
||||
$uname.val('testuser');
|
||||
$passwd.val('testtest');
|
||||
$confirm.val('testtest');
|
||||
$checkImport[0].checked = true;
|
||||
|
|
|
@ -98,7 +98,6 @@
|
|||
}
|
||||
}
|
||||
.fa {
|
||||
display: none;
|
||||
margin-left: 50px;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,6 +9,7 @@ define([
|
|||
'/common/common-hash.js',
|
||||
'/customize/messages.js',
|
||||
'/common/hyperscript.js',
|
||||
'/customize/application_config.js',
|
||||
|
||||
'/bower_components/file-saver/FileSaver.min.js',
|
||||
'css!/bower_components/bootstrap/dist/css/bootstrap.min.css',
|
||||
|
@ -24,7 +25,8 @@ define([
|
|||
Util,
|
||||
Hash,
|
||||
Messages,
|
||||
h
|
||||
h,
|
||||
AppConfig
|
||||
)
|
||||
{
|
||||
var saveAs = window.saveAs;
|
||||
|
@ -65,6 +67,10 @@ define([
|
|||
]
|
||||
};
|
||||
|
||||
if (!AppConfig.dislayCreationScreen) {
|
||||
delete categories.creation;
|
||||
}
|
||||
|
||||
var create = {};
|
||||
|
||||
// Account settings
|
||||
|
@ -326,8 +332,8 @@ define([
|
|||
|
||||
var $owned = $(owned);
|
||||
|
||||
var $ok = $owned.find('.fa-check');
|
||||
var $spinner = $owned.find('.fa-spinner');
|
||||
var $ok = $owned.find('.fa-check').hide();
|
||||
var $spinner = $owned.find('.fa-spinner').hide();
|
||||
|
||||
$owned.find('input').change(function () {
|
||||
$spinner.show();
|
||||
|
@ -392,8 +398,8 @@ define([
|
|||
|
||||
var $expire = $(expire);
|
||||
|
||||
var $ok = $expire.find('.fa-check');
|
||||
var $spinner = $expire.find('.fa-spinner');
|
||||
var $ok = $expire.find('.fa-check').hide();
|
||||
var $spinner = $expire.find('.fa-spinner').hide();
|
||||
|
||||
var getValue = function () {
|
||||
if(!parseInt($expire.find('[name="cp-creation-expire"]:checked').val())) { return 0; }
|
||||
|
@ -447,8 +453,8 @@ define([
|
|||
|
||||
var $div = $(skip);
|
||||
|
||||
var $ok = $div.find('.fa-check');
|
||||
var $spinner = $div.find('.fa-spinner');
|
||||
var $ok = $div.find('.fa-check').hide();
|
||||
var $spinner = $div.find('.fa-spinner').hide();
|
||||
|
||||
$div.find('input').change(function () {
|
||||
$spinner.show();
|
||||
|
@ -504,8 +510,8 @@ define([
|
|||
|
||||
var $div = $(skip);
|
||||
|
||||
var $ok = $div.find('.fa-check');
|
||||
var $spinner = $div.find('.fa-spinner');
|
||||
var $ok = $div.find('.fa-check').hide();
|
||||
var $spinner = $div.find('.fa-spinner').hide();
|
||||
|
||||
$div.find('input').change(function () {
|
||||
$spinner.show();
|
||||
|
|
Loading…
Reference in New Issue