mirror of
https://github.com/flarum/core.git
synced 2025-07-18 23:31:17 +02:00
Convert EditCustomCssModal into a SettingsModal
This commit is contained in:
@@ -1,12 +1,6 @@
|
|||||||
import Modal from 'flarum/components/Modal';
|
import SettingsModal from 'flarum/components/SettingsModal';
|
||||||
import Button from 'flarum/components/Button';
|
|
||||||
import saveSettings from 'flarum/utils/saveSettings';
|
|
||||||
|
|
||||||
export default class EditCustomCssModal extends Modal {
|
|
||||||
init() {
|
|
||||||
this.customLess = m.prop(app.data.settings.custom_less || '');
|
|
||||||
}
|
|
||||||
|
|
||||||
|
export default class EditCustomCssModal extends SettingsModal {
|
||||||
className() {
|
className() {
|
||||||
return 'EditCustomCssModal Modal--large';
|
return 'EditCustomCssModal Modal--large';
|
||||||
}
|
}
|
||||||
@@ -15,36 +9,16 @@ export default class EditCustomCssModal extends Modal {
|
|||||||
return app.translator.trans('core.admin.edit_css.title');
|
return app.translator.trans('core.admin.edit_css.title');
|
||||||
}
|
}
|
||||||
|
|
||||||
content() {
|
form() {
|
||||||
return (
|
return [
|
||||||
<div className="Modal-body">
|
<p>{app.translator.trans('core.admin.edit_css.customize_text', {a: <a href="https://github.com/flarum/core/tree/master/less" target="_blank"/>})}</p>,
|
||||||
<p>{app.translator.trans('core.admin.edit_css.customize_text', {a: <a href="https://github.com/flarum/core/tree/master/less" target="_blank"/>})}</p>
|
|
||||||
|
|
||||||
<div className="Form">
|
|
||||||
<div className="Form-group">
|
<div className="Form-group">
|
||||||
<textarea className="FormControl" rows="30" value={this.customLess()} onchange={m.withAttr('value', this.customLess)}/>
|
<textarea className="FormControl" rows="30" bidi={this.setting('custom_less')}/>
|
||||||
</div>
|
</div>
|
||||||
|
];
|
||||||
<div className="Form-group">
|
|
||||||
{Button.component({
|
|
||||||
className: 'Button Button--primary',
|
|
||||||
type: 'submit',
|
|
||||||
children: app.translator.trans('core.admin.edit_css.submit_button'),
|
|
||||||
loading: this.loading
|
|
||||||
})}
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
onsubmit(e) {
|
onsaved() {
|
||||||
e.preventDefault();
|
window.location.reload();
|
||||||
|
|
||||||
this.loading = true;
|
|
||||||
|
|
||||||
saveSettings({
|
|
||||||
custom_less: this.customLess()
|
|
||||||
}).then(() => window.location.reload());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -68,8 +68,12 @@ export default class SettingsModal extends Modal {
|
|||||||
this.loading = true;
|
this.loading = true;
|
||||||
|
|
||||||
saveSettings(this.dirty()).then(
|
saveSettings(this.dirty()).then(
|
||||||
this.hide.bind(this),
|
this.onsaved.bind(this),
|
||||||
this.loaded.bind(this)
|
this.loaded.bind(this)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onsaved() {
|
||||||
|
this.hide();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user