user css dialog: allow saving and applying CSS without closing the dialog
This commit is contained in:
parent
0697eca0e1
commit
ac95ab4a65
|
@ -1132,12 +1132,18 @@ class Pref_Prefs extends Handler_Protected {
|
||||||
print_hidden("method", "setpref");
|
print_hidden("method", "setpref");
|
||||||
print_hidden("key", "USER_STYLESHEET");
|
print_hidden("key", "USER_STYLESHEET");
|
||||||
|
|
||||||
|
print "<div id='css_edit_apply_msg' style='display : none'>";
|
||||||
|
print_warning(__("User CSS has been applied, you might need to reload the page to see all changes."));
|
||||||
|
print "</div>";
|
||||||
|
|
||||||
print "<textarea class='panel user-css-editor' dojoType='dijit.form.SimpleTextarea'
|
print "<textarea class='panel user-css-editor' dojoType='dijit.form.SimpleTextarea'
|
||||||
style='font-size : 12px;' name='value'>$value</textarea>";
|
style='font-size : 12px;' name='value'>$value</textarea>";
|
||||||
|
|
||||||
print "<footer>";
|
print "<footer>";
|
||||||
print "<button dojoType='dijit.form.Button'
|
print "<button dojoType='dijit.form.Button' class='alt-success'
|
||||||
onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save')."</button> ";
|
onclick=\"dijit.byId('cssEditDlg').apply()\">".__('Apply')."</button> ";
|
||||||
|
print "<button dojoType='dijit.form.Button' class='alt-primary'
|
||||||
|
onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save and reload')."</button> ";
|
||||||
print "<button dojoType='dijit.form.Button'
|
print "<button dojoType='dijit.form.Button'
|
||||||
onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>";
|
onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>";
|
||||||
print "</footer>";
|
print "</footer>";
|
||||||
|
|
|
@ -1584,7 +1584,7 @@
|
||||||
$value = get_pref('USER_STYLESHEET');
|
$value = get_pref('USER_STYLESHEET');
|
||||||
|
|
||||||
if ($value) {
|
if ($value) {
|
||||||
print "<style type=\"text/css\">";
|
print "<style type='text/css' id='user_css_style'>";
|
||||||
print str_replace("<br/>", "\n", $value);
|
print str_replace("<br/>", "\n", $value);
|
||||||
print "</style>";
|
print "</style>";
|
||||||
}
|
}
|
||||||
|
|
|
@ -150,6 +150,12 @@ define(["dojo/_base/declare"], function (declare) {
|
||||||
id: "cssEditDlg",
|
id: "cssEditDlg",
|
||||||
title: __("Customize stylesheet"),
|
title: __("Customize stylesheet"),
|
||||||
style: "width: 600px",
|
style: "width: 600px",
|
||||||
|
apply: function() {
|
||||||
|
xhrPost("backend.php", this.attr('value'), () => {
|
||||||
|
new Effect.Appear("css_edit_apply_msg");
|
||||||
|
$("user_css_style").innerText = this.attr('value');
|
||||||
|
});
|
||||||
|
},
|
||||||
execute: function () {
|
execute: function () {
|
||||||
Notify.progress('Saving data...', true);
|
Notify.progress('Saving data...', true);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue