Fix ordering in file menu, add scrollbars and remove 'new pad' button

pull/1/head
yflory 5 years ago
parent ef4bb40f25
commit 96f6e0ebaf

@ -603,17 +603,6 @@ color: var(--toolbar-bg-color);
} }
} }
} }
.cp-toolbar-new {
height: @toolbar_line-height;
width: @toolbar_line-height;
margin-left: 0;
button {
height: @toolbar_line-height;
width: @toolbar_line-height;
font-size: 20px;
margin-top: -1px;
}
}
.cp-toolbar-user-dropdown { .cp-toolbar-user-dropdown {
height: @toolbar_line-height; height: @toolbar_line-height;
width: @toolbar_line-height; width: @toolbar_line-height;
@ -797,7 +786,7 @@ color: var(--toolbar-bg-color);
height: 43px; height: 43px;
} }
} }
.cp-toolbar-link, .cp-toolbar-new, .cp-toolbar-notifications { .cp-toolbar-link, .cp-toolbar-notifications {
font-size: 48px; font-size: 48px;
line-height: @toolbar_top-height; line-height: @toolbar_top-height;
width: 64px; width: 64px;
@ -816,7 +805,7 @@ color: var(--toolbar-bg-color);
*/ */
} }
.cp-toolbar-notifications, .cp-toolbar-new { .cp-toolbar-notifications {
/* /*
// XXX // XXX
background-color: rgba(0,0,0,0.2); background-color: rgba(0,0,0,0.2);
@ -928,7 +917,6 @@ color: var(--toolbar-bg-color);
*/ */
.cp-toolbar-notifications { order: 1; } .cp-toolbar-notifications { order: 1; }
.cp-toolbar-new { order: 2; }
.cp-toolbar-user-dropdown { order: 3; } .cp-toolbar-user-dropdown { order: 3; }
.cp-toolbar-backup { order: 4; } // TODO drive migration to secure iframe .cp-toolbar-backup { order: 4; } // TODO drive migration to secure iframe
&> * { &> * {
@ -955,7 +943,6 @@ color: var(--toolbar-bg-color);
.cp-dropdown-content { .cp-dropdown-content {
margin: 0; margin: 0;
overflow: visible;
} }
& > button { & > button {
display: flex; display: flex;
@ -1059,11 +1046,46 @@ color: var(--toolbar-bg-color);
} }
.cp-toolbar-bottom-left { .cp-toolbar-bottom-left {
.cp-toolbar-appmenu, .cp-toolbar-file {
button {
&::before, .fa {
min-width: 20px;
text-align: center;
margin-right: 0;
}
}
}
.cp-toolbar-file {
button {
order: 50;
&.fa-plus { order: 0; }
&.fa-history { order: 5; }
&.fa-hashtag { order: 10; }
&.fa-bookmark { order: 15; }
&.fa-upload { order: 20; }
&.fa-clone { order: 25; }
&.fa-download { order: 30; }
&.fa-print { order: 35; }
&.fa-trash { order: 40; }
&.fa-info-circle { order: 100; }
&.fa-arrows-h { order: 5; }
&.fa-cog { order: 5; }
&.fa-paint-brush { order: 5; }
&.cp-toolbar-icon-help { order: 150; }
}
}
.cp-toolbar-drawer-content:empty ~ .cp-toolbar-drawer-button { .cp-toolbar-drawer-content:empty ~ .cp-toolbar-drawer-button {
display: none; display: none;
} }
.cp-toolbar-drawer-content { .cp-toolbar-drawer-content {
box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.2); box-shadow: 0px 1px 5px 0px rgba(0, 0, 0, 0.2);
overflow-y: auto;
overflow-x: hidden;
&.cp-dropdown-visible {
overflow: visible;
}
position: absolute; position: absolute;
left: 0px; left: 0px;
top: @toolbar_line-height; top: @toolbar_line-height;

@ -1400,7 +1400,6 @@ define([
case 'copy': case 'copy':
button = $('<button>', { button = $('<button>', {
'class': 'fa fa-clone cp-toolbar-icon-import', 'class': 'fa fa-clone cp-toolbar-icon-import',
title: Messages.makeACopy,
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.makeACopy)); }).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.makeACopy));
button button
.click(common.prepareFeedback(type)) .click(common.prepareFeedback(type))
@ -1413,7 +1412,6 @@ define([
if (!common.isLoggedIn()) { return; } if (!common.isLoggedIn()) { return; }
button = $('<button>', { button = $('<button>', {
'class': 'fa fa-upload cp-toolbar-icon-import', 'class': 'fa fa-upload cp-toolbar-icon-import',
title: Messages.template_import,
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.template_import)); }).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.template_import));
button button
.click(common.prepareFeedback(type)) .click(common.prepareFeedback(type))
@ -1425,9 +1423,8 @@ define([
if (!AppConfig.enableTemplates) { return; } if (!AppConfig.enableTemplates) { return; }
if (!common.isLoggedIn()) { return; } if (!common.isLoggedIn()) { return; }
button = $('<button>', { button = $('<button>', {
title: Messages.saveTemplateButton, 'class': 'fa fa-bookmark cp-toolbar-icon-template',
class: 'fa fa-bookmark cp-toolbar-icon-template' }).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.saveTemplateButton));
});
if (data.rt) { if (data.rt) {
button button
.click(function () { .click(function () {
@ -1472,9 +1469,8 @@ define([
break; break;
case 'forget': case 'forget':
button = $('<button>', { button = $('<button>', {
title: Messages.forgetButtonTitle,
'class': "fa fa-trash cp-toolbar-icon-forget" 'class': "fa fa-trash cp-toolbar-icon-forget"
}); }).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.fc_delete));
callback = typeof callback === "function" ? callback : function () {}; callback = typeof callback === "function" ? callback : function () {};
button button
.click(common.prepareFeedback(type)) .click(common.prepareFeedback(type))
@ -1578,8 +1574,8 @@ define([
button = $('<button>', { button = $('<button>', {
'class': 'fa fa-hashtag cp-toolbar-icon-hashtag', 'class': 'fa fa-hashtag cp-toolbar-icon-hashtag',
title: Messages.tags_title, title: Messages.tags_title,
}) }).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.fc_hashtag));
.click(common.prepareFeedback(type)) button.click(common.prepareFeedback(type))
.click(function () { .click(function () {
common.isPadStored(function (err, data) { common.isPadStored(function (err, data) {
if (!data) { if (!data) {
@ -1647,6 +1643,17 @@ define([
.click(common.prepareFeedback(type)); .click(common.prepareFeedback(type));
if (callback) { button.click(callback); } if (callback) { button.click(callback); }
break; break;
case 'newpad':
button = $('<button>', {
title: Messages.newButtonTitle,
'class': 'fa fa-plus cp-toolbar-icon-newpad',
}).append($('<span>', {'class': 'cp-toolbar-drawer-element'}).text(Messages.newButton));
button
.click(common.prepareFeedback(type))
.click(function () {
common.createNewPadModal();
});
break;
default: default:
data = data || {}; data = data || {};
var icon = data.icon || "fa-question"; var icon = data.icon || "fa-question";
@ -2293,6 +2300,17 @@ define([
content: h('span', Messages.type.teams) content: h('span', Messages.type.teams)
}); });
} }
if (padType !== 'contacts' && accountName) {
options.push({
tag: 'a',
attributes: {
'target': '_blank',
'href': origin+'/contacts/',
'class': 'cptools cptools-contacts'
},
content: h('span', Messages.type.contacts)
});
}
options.push({ tag: 'hr' }); options.push({ tag: 'hr' });
// Add the change display name button if not in read only mode // Add the change display name button if not in read only mode
if (config.changeNameButtonCls && config.displayChangeName && !AppConfig.disableProfile) { if (config.changeNameButtonCls && config.displayChangeName && !AppConfig.disableProfile) {

@ -363,7 +363,14 @@ define([
common: Common common: Common
}; };
var $block = exp.$theme = UIElements.createDropdown(dropdownConfig); var $block = exp.$theme = UIElements.createDropdown(dropdownConfig);
$block.find('button').attr('title', Messages.themeButtonTitle); $block.find('button').attr('title', Messages.themeButtonTitle).click(function () {
var state = $block.find('.cp-dropdown-content').is(':visible');
var $c = $block.closest('.cp-toolbar-drawer-content');
$c.removeClass('cp-dropdown-visible');
if (!state) {
$c.addClass('cp-dropdown-visible');
}
});
setTheme(lastTheme, $block); setTheme(lastTheme, $block);

@ -42,7 +42,6 @@ MessengerUI, Messages) {
var SPINNER_CLS = Bar.constants.spinner = 'cp-toolbar-spinner'; var SPINNER_CLS = Bar.constants.spinner = 'cp-toolbar-spinner';
var LIMIT_CLS = Bar.constants.limit = 'cp-toolbar-limit'; var LIMIT_CLS = Bar.constants.limit = 'cp-toolbar-limit';
var TITLE_CLS = Bar.constants.title = "cp-toolbar-title"; var TITLE_CLS = Bar.constants.title = "cp-toolbar-title";
var NEWPAD_CLS = Bar.constants.newpad = "cp-toolbar-new";
var LINK_CLS = Bar.constants.link = "cp-toolbar-link"; var LINK_CLS = Bar.constants.link = "cp-toolbar-link";
var NOTIFICATIONS_CLS = Bar.constants.user = 'cp-toolbar-notifications'; var NOTIFICATIONS_CLS = Bar.constants.user = 'cp-toolbar-notifications';
@ -79,7 +78,6 @@ MessengerUI, Messages) {
}).appendTo($topContainer); }).appendTo($topContainer);
$('<span>', {'class': LIMIT_CLS}).hide().appendTo($userContainer); $('<span>', {'class': LIMIT_CLS}).hide().appendTo($userContainer);
$('<span>', {'class': NOTIFICATIONS_CLS + ' cp-dropdown-container'}).hide().appendTo($userContainer); $('<span>', {'class': NOTIFICATIONS_CLS + ' cp-dropdown-container'}).hide().appendTo($userContainer);
$('<span>', {'class': NEWPAD_CLS + ' cp-dropdown-container'}).hide().appendTo($userContainer);
$('<span>', {'class': USERADMIN_CLS + ' cp-dropdown-container'}).hide().appendTo($userContainer); $('<span>', {'class': USERADMIN_CLS + ' cp-dropdown-container'}).hide().appendTo($userContainer);
$toolbar.append($topContainer); $toolbar.append($topContainer);
@ -108,6 +106,10 @@ MessengerUI, Messages) {
if ($drawerContent.is(':visible')) { if ($drawerContent.is(':visible')) {
$drawer.addClass('cp-toolbar-button-active'); $drawer.addClass('cp-toolbar-button-active');
$drawerContent.focus(); $drawerContent.focus();
var wh = $(window).height();
var topPos = $drawer[0].getBoundingClientRect().bottom;
console.error(wh, topPos);
$drawerContent.css('max-height', Math.floor(wh - topPos - 1)+'px');
} }
}); });
var onBlur = function (e) { var onBlur = function (e) {
@ -948,49 +950,9 @@ MessengerUI, Messages) {
}; };
var createNewPad = function (toolbar, config) { var createNewPad = function (toolbar, config) {
var $newPad = toolbar.$top.find('.'+NEWPAD_CLS).show(); var $button = Common.createButton('newpad', true);
toolbar.$drawer.append($button);
var origin = config.metadataMgr.getPrivateData().origin; return $button;
var pads_options = [];
Config.availablePadTypes.forEach(function (p) {
if (p === 'drive') { return; }
if (!Common.isLoggedIn() && Config.registeredOnlyTypes &&
Config.registeredOnlyTypes.indexOf(p) !== -1) { return; }
pads_options.push({
tag: 'a',
attributes: {
'target': '_blank',
'href': origin + '/' + p + '/',
},
content: $('<div>').append(UI.getIcon(p)).html() + Messages.type[p]
});
});
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
});
var dropdownConfig = {
text: '', // Button initial text
options: pads_options, // Entries displayed in the menu
container: $newPad,
left: true,
feedback: /drive/.test(window.location.pathname)?
'DRIVE_NEWPAD': 'NEWPAD',
common: Common
};
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;
}; };
var createUserAdmin = function (toolbar, config) { var createUserAdmin = function (toolbar, config) {

@ -102,7 +102,7 @@ define([
var mkThemeButton = function (framework) { var mkThemeButton = function (framework) {
Messages.toolbar_theme = "Theme"; Messages.toolbar_theme = "Theme";
var $theme = $(h('button', [ var $theme = $(h('button.cp-toolbar-appmenu', [
h('i.cptools.cptools-palette'), h('i.cptools.cptools-palette'),
h('span.cp-button-name', Messages.toolbar_theme) h('span.cp-button-name', Messages.toolbar_theme)
])); ]));
@ -115,6 +115,9 @@ define([
if ($content.is(':visible')) { if ($content.is(':visible')) {
$theme.addClass('cp-toolbar-button-active'); $theme.addClass('cp-toolbar-button-active');
$content.focus(); $content.focus();
var wh = $(window).height();
var topPos = $theme[0].getBoundingClientRect().bottom;
$content.css('max-height', Math.floor(wh - topPos - 1)+'px');
} }
}); });
var onBlur = function (e) { var onBlur = function (e) {

Loading…
Cancel
Save