Add share and access to the bottom bar

pull/1/head
yflory 5 years ago
parent a1d9294036
commit 94eac09c61

@ -1003,7 +1003,7 @@ color: var(--toolbar-bg-color);
.cp-toolbar-bottom { .cp-toolbar-bottom {
background-color: @toolbar-bg-color-l8; background-color: @toolbar-bg-color-l8;
background-color: var(--toolbar-bg-color-l8); background-color: var(--toolbar-bg-color-l8);
color: #FFF; // XXX color: @cryptpad_text_col;
button:hover, button.cp-toolbar-button-active { button:hover, button.cp-toolbar-button-active {
background-color: @toolbar-bg-color; background-color: @toolbar-bg-color;
background-color: var(--toolbar-bg-color); background-color: var(--toolbar-bg-color);
@ -1028,6 +1028,9 @@ color: var(--toolbar-bg-color);
margin: 0px; margin: 0px;
border-radius: 0; border-radius: 0;
height: 100%; height: 100%;
.fa {
margin-right: 5px;
}
} }
.cp-dropdown-content { .cp-dropdown-content {
margin-top: -1px; margin-top: -1px;

@ -1483,18 +1483,7 @@ define([
Title = common.createTitle({}); Title = common.createTitle({});
var configTb = { var configTb = {
displayed: [ displayed: ['pad'],
'chat',
'userlist',
'title',
'useradmin',
'spinner',
'newpad',
'share',
'limit',
'unpinnedWarning',
'notifications'
],
title: Title.getTitleConfig(), title: Title.getTitleConfig(),
metadataMgr: metadataMgr, metadataMgr: metadataMgr,
readOnly: readOnly, readOnly: readOnly,
@ -1561,8 +1550,6 @@ define([
var $properties = common.createButton('properties', true); var $properties = common.createButton('properties', true);
toolbar.$drawer.append($properties); toolbar.$drawer.append($properties);
var $access = common.createButton('access', true);
toolbar.$drawer.append($access);
}; };
config.onReady = function (info) { config.onReady = function (info) {

@ -654,19 +654,7 @@ define([
getHeadingText: function () { return titleRecommender(); } getHeadingText: function () { return titleRecommender(); }
}, onLocal); }, onLocal);
var configTb = { var configTb = {
displayed: [ displayed: ['pad'],
'chat',
'userlist',
'title',
'useradmin',
'spinner',
'newpad',
'share',
'limit',
'request',
'unpinnedWarning',
'notifications'
],
title: title.getTitleConfig(), title: title.getTitleConfig(),
metadataMgr: cpNfInner.metadataMgr, metadataMgr: cpNfInner.metadataMgr,
readOnly: readOnly, readOnly: readOnly,
@ -722,8 +710,6 @@ define([
var $properties = common.createButton('properties', true); var $properties = common.createButton('properties', true);
toolbar.$drawer.append($properties); toolbar.$drawer.append($properties);
var $access = common.createButton('access', true);
toolbar.$drawer.append($access);
createFilePicker(); createFilePicker();

@ -473,10 +473,12 @@ MessengerUI, Messages) {
toolbar.chatContent = $content; toolbar.chatContent = $content;
var $container = $('<span>', {id: 'cp-toolbar-chat-drawer-open', title: Messages.chatButton}); var $container = $('<span>', {id: 'cp-toolbar-chat-drawer-open'});
var $button = $('<button>', {'class': 'fa fa-comments'}).appendTo($container); var $button = $(h('button', [
$('<span>',{'class': 'cp-dropdown-button-title'}).appendTo($button); h('i.fa.fa-comments'),
h('span.cp-button-name', Messages.chatButton)
])).appendTo($container);
toolbar.$bottomR.prepend($container); toolbar.$bottomR.prepend($container);
@ -531,13 +533,13 @@ MessengerUI, Messages) {
var createShare = function (toolbar, config) { var createShare = function (toolbar, config) {
if (!config.metadataMgr) { if (!config.metadataMgr) {
throw new Error("You must provide a `metadataMgr` to display the userlist"); throw new Error("You must provide a `metadataMgr` to display the share button");
} }
var $shareBlock = $('<button>', { var $shareBlock = $(h('button.cp-toolar-share-button', [
'class': 'fa fa-shhare-alt cp-toolbar-share-button', h('i.fa.fa-shhare-alt'),
title: Messages.shareButton h('span.cp-button-name', Messages.shareButton)
}); ]));
Common.getSframeChannel().event('EV_SHARE_OPEN', { Common.getSframeChannel().event('EV_SHARE_OPEN', {
hidden: true hidden: true
}); });
@ -550,11 +552,29 @@ MessengerUI, Messages) {
}); });
}); });
toolbar.$leftside.append($shareBlock); toolbar.$bottomM.append($shareBlock);
toolbar.share = $shareBlock; toolbar.share = $shareBlock;
return "Loading share button"; return "Loading share button";
}; };
var createAccess = function (toolbar, config) {
if (!config.metadataMgr) {
throw new Error("You must provide a `metadataMgr` to display the access button");
}
var $accessBlock = $(h('button.cp-toolar-access-button', [
h('i.fa.fa-unlock-alt'),
h('span.cp-button-name', Messages.accessButton)
]));
$accessBlock.click(function () {
Common.getSframeChannel().event('EV_ACCESS_OPEN');
});
toolbar.$bottomM.append($accessBlock);
toolbar.access = $accessBlock;
return "Loading access button";
};
var createFileShare = function (toolbar, config) { var createFileShare = function (toolbar, config) {
if (!config.metadataMgr) { if (!config.metadataMgr) {
@ -578,7 +598,7 @@ MessengerUI, Messages) {
}); });
}); });
toolbar.$leftside.append($shareBlock); toolbar.$bottomM.append($shareBlock);
return $shareBlock; return $shareBlock;
}; };
@ -1240,6 +1260,7 @@ MessengerUI, Messages) {
tb['userlist'] = createUserList; tb['userlist'] = createUserList;
tb['chat'] = createChat; tb['chat'] = createChat;
tb['share'] = createShare; tb['share'] = createShare;
tb['access'] = createAccess;
tb['fileshare'] = createFileShare; tb['fileshare'] = createFileShare;
tb['title'] = createTitle; tb['title'] = createTitle;
tb['pageTitle'] = createPageTitle; tb['pageTitle'] = createPageTitle;
@ -1254,6 +1275,14 @@ MessengerUI, Messages) {
tb['unpinnedWarning'] = createUnpinnedWarning; tb['unpinnedWarning'] = createUnpinnedWarning;
tb['notifications'] = createNotifications; tb['notifications'] = createNotifications;
tb['pad'] = function () {
addElement([
'chat', 'userlist', 'title', 'useradmin', 'spinner',
'newpad', 'share', 'access', 'limit', 'unpinnedWarning',
'notifications'
], {});
};
var addElement = toolbar.addElement = function (arr, additionalCfg, init) { var addElement = toolbar.addElement = function (arr, additionalCfg, init) {
if (typeof additionalCfg === "object") { $.extend(true, config, additionalCfg); } if (typeof additionalCfg === "object") { $.extend(true, config, additionalCfg); }
arr.forEach(function (el) { arr.forEach(function (el) {

@ -72,6 +72,7 @@ define([
var displayed = ['useradmin', 'newpad', 'limit', 'upgrade']; var displayed = ['useradmin', 'newpad', 'limit', 'upgrade'];
if (!uploadMode) { if (!uploadMode) {
displayed.push('fileshare'); displayed.push('fileshare');
displayed.push('access');
} }
var configTb = { var configTb = {
displayed: displayed, displayed: displayed,
@ -132,7 +133,6 @@ define([
title: Title.getTitleConfig(), title: Title.getTitleConfig(),
}); });
toolbar.$rightside.append(common.createButton('forget', true)); toolbar.$rightside.append(common.createButton('forget', true));
toolbar.$rightside.append(common.createButton('access', true));
toolbar.$rightside.append(common.createButton('properties', true)); toolbar.$rightside.append(common.createButton('properties', true));
if (common.isLoggedIn()) { if (common.isLoggedIn()) {
toolbar.$rightside.append(common.createButton('hashtag', true)); toolbar.$rightside.append(common.createButton('hashtag', true));

@ -1125,18 +1125,7 @@ define([
Title = common.createTitle(titleCfg); Title = common.createTitle(titleCfg);
var configTb = { var configTb = {
displayed: [ displayed: ['pad'],
'chat',
'userlist',
'title',
'useradmin',
'spinner',
'newpad',
'share',
'limit',
'unpinnedWarning',
'notifications'
],
title: Title.getTitleConfig(), title: Title.getTitleConfig(),
metadataMgr: metadataMgr, metadataMgr: metadataMgr,
readOnly: APP.readOnly, readOnly: APP.readOnly,
@ -1169,8 +1158,6 @@ define([
var $forgetPad = common.createButton('forget', true, {}, forgetCb); var $forgetPad = common.createButton('forget', true, {}, forgetCb);
$rightside.append($forgetPad); $rightside.append($forgetPad);
var $access = common.createButton('access', true);
$drawer.append($access);
var $properties = common.createButton('properties', true); var $properties = common.createButton('properties', true);
$drawer.append($properties); $drawer.append($properties);

Loading…
Cancel
Save