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("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'
|
||||
style='font-size : 12px;' name='value'>$value</textarea>";
|
||||
|
||||
print "<footer>";
|
||||
print "<button dojoType='dijit.form.Button'
|
||||
onclick=\"dijit.byId('cssEditDlg').execute()\">".__('Save')."</button> ";
|
||||
print "<button dojoType='dijit.form.Button' class='alt-success'
|
||||
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'
|
||||
onclick=\"dijit.byId('cssEditDlg').hide()\">".__('Cancel')."</button>";
|
||||
print "</footer>";
|
||||
|
|
|
@ -1584,7 +1584,7 @@
|
|||
$value = get_pref('USER_STYLESHEET');
|
||||
|
||||
if ($value) {
|
||||
print "<style type=\"text/css\">";
|
||||
print "<style type='text/css' id='user_css_style'>";
|
||||
print str_replace("<br/>", "\n", $value);
|
||||
print "</style>";
|
||||
}
|
||||
|
|
|
@ -150,6 +150,12 @@ define(["dojo/_base/declare"], function (declare) {
|
|||
id: "cssEditDlg",
|
||||
title: __("Customize stylesheet"),
|
||||
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 () {
|
||||
Notify.progress('Saving data...', true);
|
||||
|
||||
|
|
Loading…
Reference in New Issue