From c460e2820eb4d6ec353d1900690d43a03deff31e Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 11 Jan 2018 16:09:29 +0100 Subject: [PATCH 1/6] Fix a 1px offset for the userlist in Firefox/Windows --- customize.dist/src/less2/include/ckeditor-fix.less | 1 - www/pad/app-pad.less | 3 ++- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/customize.dist/src/less2/include/ckeditor-fix.less b/customize.dist/src/less2/include/ckeditor-fix.less index bd44c11e1..96e6d893f 100644 --- a/customize.dist/src/less2/include/ckeditor-fix.less +++ b/customize.dist/src/less2/include/ckeditor-fix.less @@ -14,7 +14,6 @@ } .cke_toolbox_main { display: inline-block; - margin-bottom: -3px; } #cke_1_contents { flex: 1; diff --git a/www/pad/app-pad.less b/www/pad/app-pad.less index ffa9fd5c9..742163285 100644 --- a/www/pad/app-pad.less +++ b/www/pad/app-pad.less @@ -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 { From 378322a5211e4071d38a6469b639b717b0c939a2 Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Thu, 11 Jan 2018 17:08:47 +0100 Subject: [PATCH 2/6] Don't finish the test until ChainPad settles, trying to eliminate a flicker --- www/poll/inner.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/poll/inner.js b/www/poll/inner.js index 139ced8b4..ccddcef19 100644 --- a/www/poll/inner.js +++ b/www/poll/inner.js @@ -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); }); From e377d606be7860a82a5a7f2e7ecbf60f132c2b43 Mon Sep 17 00:00:00 2001 From: yflory Date: Thu, 11 Jan 2018 17:15:39 +0100 Subject: [PATCH 3/6] Fix spinner style in the new settings category --- www/settings/app-settings.less | 1 - www/settings/inner.js | 16 ++++++++-------- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/www/settings/app-settings.less b/www/settings/app-settings.less index b6fec0158..187b75da8 100644 --- a/www/settings/app-settings.less +++ b/www/settings/app-settings.less @@ -98,7 +98,6 @@ } } .fa { - display: none; margin-left: 50px; } } diff --git a/www/settings/inner.js b/www/settings/inner.js index 22d4b4be5..eff31a4fa 100644 --- a/www/settings/inner.js +++ b/www/settings/inner.js @@ -326,8 +326,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 +392,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 +447,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 +504,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(); From cd26a4c093b9e4f97b9c6fca1f93f1827b0d100a Mon Sep 17 00:00:00 2001 From: Caleb James DeLisle Date: Thu, 11 Jan 2018 18:11:06 +0100 Subject: [PATCH 4/6] Added a test of /login/ --- TestSelenium.js | 3 +++ www/login/main.js | 16 +++++++++++++++- www/register/main.js | 15 +++++++++------ 3 files changed, 27 insertions(+), 7 deletions(-) diff --git a/TestSelenium.js b/TestSelenium.js index cd34b1986..352b293eb 100644 --- a/TestSelenium.js +++ b/TestSelenium.js @@ -36,7 +36,10 @@ var nt = nThen(function (waitFor) { }).nThen; [ + // login test must happen after register test ['/register/', {}], + ['/login/', {}], + ['/assert/', {}], ['/auth/', {}], diff --git a/www/login/main.js b/www/login/main.js index 24f0e905a..408203d9b 100644 --- a/www/login/main.js +++ b/www/login/main.js @@ -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(); + }); }); }); diff --git a/www/register/main.js b/www/register/main.js index a6c31509f..172eaf8cc 100644 --- a/www/register/main.js +++ b/www/register/main.js @@ -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; From daef08a9b3e0eb1c8987888e1610def61416952a Mon Sep 17 00:00:00 2001 From: yflory Date: Fri, 12 Jan 2018 09:48:40 +0100 Subject: [PATCH 5/6] Add an advanced new pad modal --- customize.dist/src/less2/include/icons.less | 40 ++++++++++++ customize.dist/src/less2/include/toolbar.less | 64 +++++++++++++++++++ customize.dist/translations/messages.fr.js | 3 + customize.dist/translations/messages.js | 3 + www/common/common-constants.js | 1 + www/common/common-ui-elements.js | 63 +++++++++++++++++- www/common/sframe-app-framework.js | 2 +- www/common/sframe-common-outer.js | 6 +- www/common/sframe-common.js | 1 + www/common/toolbar3.js | 12 ++++ www/drive/app-drive.less | 4 ++ 11 files changed, 195 insertions(+), 4 deletions(-) create mode 100644 customize.dist/src/less2/include/icons.less diff --git a/customize.dist/src/less2/include/icons.less b/customize.dist/src/less2/include/icons.less new file mode 100644 index 000000000..85516371a --- /dev/null +++ b/customize.dist/src/less2/include/icons.less @@ -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; + } + } + } +} + diff --git a/customize.dist/src/less2/include/toolbar.less b/customize.dist/src/less2/include/toolbar.less index 9335058b5..178a922fb 100644 --- a/customize.dist/src/less2/include/toolbar.less +++ b/customize.dist/src/less2/include/toolbar.less @@ -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; diff --git a/customize.dist/translations/messages.fr.js b/customize.dist/translations/messages.fr.js index c79e07708..11839b5b5 100644 --- a/customize.dist/translations/messages.fr.js +++ b/customize.dist/translations/messages.fr.js @@ -806,6 +806,9 @@ define(function () { out.creation_noOwner = "Pad 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; }); diff --git a/customize.dist/translations/messages.js b/customize.dist/translations/messages.js index 3261f4b3b..a877275fd 100644 --- a/customize.dist/translations/messages.js +++ b/customize.dist/translations/messages.js @@ -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; }); diff --git a/www/common/common-constants.js b/www/common/common-constants.js index 044319069..494267ed3 100644 --- a/www/common/common-constants.js +++ b/www/common/common-constants.js @@ -11,5 +11,6 @@ define(function () { oldStorageKey: 'CryptPad_RECENTPADS', storageKey: 'filesData', tokenKey: 'loginToken', + displayPadCreationScreen: 'displayPadCreationScreen' }; }); diff --git a/www/common/common-ui-elements.js b/www/common/common-ui-elements.js index ebb401b1c..938866411 100644 --- a/www/common/common-ui-elements.js +++ b/www/common/common-ui-elements.js @@ -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 @@ -1262,6 +1263,64 @@ define([ return $blockContainer; }; + UIElements.createNewPadModal = function (common) { + var $modal = UIElements.createModal({ + id: 'cp-app-toolbar-creation-dialog', + $body: $('body') + }); + var $title = $('

').text(Messages.fm_newFile); + var $description = $('

').text(Messages.creation_newPadModalDescription); + $modal.find('.cp-modal').append($title); + $modal.find('.cp-modal').append($description); + + var $advanced; + + var $advancedContainer = $('

'); + if (common.isLoggedIn()) { + $advanced = $('', { + type: 'checkbox', + checked: 'checked', + id: 'cp-app-toolbar-creation-advanced' + }).appendTo($advancedContainer); + $('