Snapshot toolbar UI

pull/1/head
yflory 4 years ago
parent 07a6de4dab
commit e65dcdc766

@ -113,9 +113,6 @@
} }
.cp-snapshots-modal { .cp-snapshots-modal {
h6 {
margin-bottom: 0;
}
& > input:last-child { & > input:last-child {
margin-bottom: 0 !important; margin-bottom: 0 !important;
} }
@ -129,10 +126,12 @@
max-height: 245px; max-height: 245px;
overflow: auto; overflow: auto;
min-height: 100px; min-height: 100px;
outline: none;
.cp-snapshot-element { .cp-snapshot-element {
display: flex; display: flex;
align-items: center; align-items: center;
padding: 5px 0; padding: 5px 0;
outline: none;
& > i { & > i {
margin-left: @snapshot_spacing; margin-left: @snapshot_spacing;
text-align: center; text-align: center;

@ -910,9 +910,24 @@
display: none; display: none;
text-align: center; text-align: center;
width: 100%; width: 100%;
padding: 10px 0; padding: 5px 0;
align-items: center; align-items: center;
justify-content: center; justify-content: space-between;
.cp-toolbar-snapshots-info {
i {
width: 30px;
}
}
.cp-toolbar-snapshots-actions {
button {
margin: 0 5px;
border: 1px solid @cryptpad_text_col;
text-transform: uppercase;
i:not(:last-child) {
margin-right: 5px;
}
}
}
} }
.cp-toolbar-bottom { .cp-toolbar-bottom {
background-color: @toolbar-bg-color-light; background-color: @toolbar-bg-color-light;

@ -3318,17 +3318,18 @@ define([
var modal; var modal;
var readOnly = common.getMetadataMgr().getPrivateData().readOnly; var readOnly = common.getMetadataMgr().getPrivateData().readOnly;
var container = h('div.cp-snapshots-container', {tabindex:0}); var container = h('div.cp-snapshots-container', {tabindex:1});
var $container = $(container); var $container = $(container);
var input = h('input', { var input = h('input', {
tabindex: 1,
placeholder: Messages.snapshots_placeholder placeholder: Messages.snapshots_placeholder
}); });
var $input = $(input); var $input = $(input);
var content = h('div.cp-snapshots-modal', [ var content = h('div.cp-snapshots-modal', [
h('h5', Messages.snapshots_button), h('h5', Messages.snapshots_button),
container, container,
readOnly ? undefined : h('h6', Messages.snapshots_new), readOnly ? undefined : h('label', Messages.snapshots_new),
readOnly ? undefined : input readOnly ? undefined : input
]); ]);
@ -3344,7 +3345,9 @@ define([
}).map(function (hash) { }).map(function (hash) {
var s = snapshots[hash]; var s = snapshots[hash];
var openButton = h('button.cp-snapshot-view.btn.btn-light', [ var openButton = h('button.cp-snapshot-view.btn.btn-light', {
tabindex: 1,
}, [
h('i.fa.fa-eye'), h('i.fa.fa-eye'),
h('span', Messages.snapshots_open) h('span', Messages.snapshots_open)
]); ]);
@ -3355,7 +3358,9 @@ define([
} }
}); });
var deleteButton = h('button.cp-snapshot-delete.btn.btn-light', [ var deleteButton = h('button.cp-snapshot-delete.btn.btn-light', {
tabindex: 1,
}, [
h('i.fa.fa-trash'), h('i.fa.fa-trash'),
h('span', Messages.snapshots_delete) h('span', Messages.snapshots_delete)
]); ]);
@ -3366,7 +3371,7 @@ define([
refresh(); refresh();
}); });
return h('span.cp-snapshot-element', {tabindex:0}, [ return h('span.cp-snapshot-element', {tabindex:1}, [
h('i.fa.fa-camera'), h('i.fa.fa-camera'),
h('span.cp-snapshot-title', [ h('span.cp-snapshot-title', [
h('span', s.title), h('span', s.title),

@ -64,6 +64,16 @@ Messages.snapshots_cantRestore = "Can't restore now. Disconnected...";
var display = function () { var display = function () {
var data = config.data || {}; var data = config.data || {};
var actions = h('span.cp-toolbar-snapshots-actions');
var $actions = $(actions);
var content = [
h('span.cp-toolbar-snapshots-info', [
h('i.fa.fa-camera'),
h('span.cp-toolbar-snapshots-title', data.title + ' - ' + new Date(data.time).toLocaleString()),
]),
actions
];
if (!config.readOnly) { if (!config.readOnly) {
$(h('button.cp-toolbar-snapshots-restore', [ $(h('button.cp-toolbar-snapshots-restore', [
h('i.fa.fa-check'), h('i.fa.fa-check'),
@ -77,10 +87,9 @@ Messages.snapshots_cantRestore = "Can't restore now. Disconnected...";
$bottom.show(); $bottom.show();
$cke.show(); $cke.show();
Snapshots.loading = false; Snapshots.loading = false;
}).appendTo($snap); }).appendTo($actions);
} }
$(h('span.cp-toolbar-snapshots-title', data.title)).appendTo($snap);
$(h('button.cp-toolbar-snapshots-close', [ $(h('button.cp-toolbar-snapshots-close', [
h('i.fa.fa-times'), h('i.fa.fa-times'),
@ -91,7 +100,9 @@ Messages.snapshots_cantRestore = "Can't restore now. Disconnected...";
$cke.show(); $cke.show();
Snapshots.loading = false; Snapshots.loading = false;
config.close(false); config.close(false);
}).appendTo($snap); }).appendTo($actions);
$snap.append(content);
}; };
display(); display();

Loading…
Cancel
Save