Save button in the pad creation screen
parent
a4a6385e86
commit
753b7550ca
|
@ -75,7 +75,7 @@
|
|||
}
|
||||
}
|
||||
|
||||
.cp-creation-create {
|
||||
.cp-creation-create, .cp-creation-settings {
|
||||
button {
|
||||
.tools_unselectable();
|
||||
padding: 15px;
|
||||
|
@ -84,6 +84,7 @@
|
|||
margin: 3px 10px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
outline: none;
|
||||
&:hover {
|
||||
background: darken(@colortheme_loading-bg, 5%);
|
||||
}
|
||||
|
@ -159,6 +160,9 @@
|
|||
color: lighten(#0275d8, 10%);
|
||||
}
|
||||
}
|
||||
&> span.fa {
|
||||
margin-left: 15px;
|
||||
}
|
||||
}
|
||||
.cp-creation-deleted {
|
||||
background: #111;
|
||||
|
|
|
@ -857,6 +857,7 @@ define(function () {
|
|||
out.creation_createFromTemplate = "Depuis un modèle";
|
||||
out.creation_createFromScratch = "Nouveau pad vide";
|
||||
out.creation_settings = "Préférences des nouveaux pads";
|
||||
out.creation_saveSettings = "Sauver les préférences";
|
||||
// Properties about creation data
|
||||
out.creation_owners = "Propriétaires";
|
||||
out.creation_ownedByOther = "Possédé par un autre utilisateur";
|
||||
|
|
|
@ -895,6 +895,7 @@ define(function () {
|
|||
out.creation_createFromTemplate = "From template";
|
||||
out.creation_createFromScratch = "From scratch";
|
||||
out.creation_settings = "New Pad settings";
|
||||
out.creation_saveSettings = "Save settings";
|
||||
// Properties about creation data
|
||||
out.creation_owners = "Owners";
|
||||
out.creation_ownedByOther = "Owned by another user";
|
||||
|
|
|
@ -1839,8 +1839,7 @@ define([
|
|||
UIElements.setExpirationValue(cfg.expire, $creation);
|
||||
|
||||
// Create the pad
|
||||
var create = function (template) {
|
||||
$creationContainer.remove();
|
||||
var getFormValues = function (template) {
|
||||
// Type of pad
|
||||
var ownedVal = parseInt($('input[name="cp-creation-owned"]:checked').val());
|
||||
// Life time
|
||||
|
@ -1856,11 +1855,16 @@ define([
|
|||
expireVal = ($('#cp-creation-expire-val').val() || 0) * unit;
|
||||
}
|
||||
|
||||
common.createPad({
|
||||
return {
|
||||
owned: ownedVal,
|
||||
expire: expireVal,
|
||||
template: template
|
||||
}, function () {
|
||||
};
|
||||
};
|
||||
var create = function (template) {
|
||||
$creationContainer.remove();
|
||||
|
||||
common.createPad(getFormValues(template), function () {
|
||||
cb();
|
||||
});
|
||||
};
|
||||
|
@ -1905,10 +1909,39 @@ define([
|
|||
|
||||
// Settings button
|
||||
var origin = common.getMetadataMgr().getPrivateData().origin;
|
||||
$(h('div.cp-creation-settings', h('a', {
|
||||
href: origin + '/settings/#creation',
|
||||
target: '_blank'
|
||||
}, Messages.creation_settings))).appendTo($creation);
|
||||
var $ok = $('<span>', {'class': 'fa fa-check', title: Messages.saved}).hide();
|
||||
var $spinner = $('<span>', {'class': 'fa fa-spinner fa-pulse'}).hide();
|
||||
var okTo;
|
||||
var $saveButton = $('<button>').text(Messages.creation_saveSettings).click(function () {
|
||||
if (okTo) { clearTimeout(okTo); }
|
||||
$ok.hide();
|
||||
$spinner.show();
|
||||
var val = getFormValues();
|
||||
NThen(function (waitFor) {
|
||||
common.setAttribute(['general', 'creation', 'owned'], val.owned, waitFor(function (e) {
|
||||
if (e) { return void console.error(e); }
|
||||
}));
|
||||
common.setAttribute(['general', 'creation', 'expire'], val.expire, waitFor(function (e) {
|
||||
if (e) { return void console.error(e); }
|
||||
}));
|
||||
}).nThen(function () {
|
||||
$spinner.hide();
|
||||
$ok.show();
|
||||
okTo = setTimeout(function () {
|
||||
$ok.hide();
|
||||
}, 5000);
|
||||
});
|
||||
});
|
||||
$(h('div.cp-creation-settings', [
|
||||
$saveButton[0],
|
||||
h('br'),
|
||||
h('a', {
|
||||
href: origin + '/settings/#creation',
|
||||
target: '_blank'
|
||||
}, Messages.creation_settings),
|
||||
$ok[0],
|
||||
$spinner[0]
|
||||
])).appendTo($creation);
|
||||
};
|
||||
|
||||
UIElements.onServerError = function (common, err, toolbar, cb) {
|
||||
|
|
Loading…
Reference in New Issue