Update admin js for admin us redesign

This commit is contained in:
Alexander Skvortsov 2020-11-25 01:26:36 -05:00
parent bf6dd3083d
commit f5c8dade55
2 changed files with 34 additions and 39 deletions

View File

@ -1,35 +0,0 @@
import SettingsModal from 'flarum/components/SettingsModal';
export default class PusherSettingsModal extends SettingsModal {
className() {
return 'PusherSettingsModal Modal--small';
}
title() {
return app.translator.trans('flarum-pusher.admin.pusher_settings.title');
}
form() {
return [
<div className="Form-group">
<label>{app.translator.trans('flarum-pusher.admin.pusher_settings.app_id_label')}</label>
<input className="FormControl" bidi={this.setting('flarum-pusher.app_id')}/>
</div>,
<div className="Form-group">
<label>{app.translator.trans('flarum-pusher.admin.pusher_settings.app_key_label')}</label>
<input className="FormControl" bidi={this.setting('flarum-pusher.app_key')}/>
</div>,
<div className="Form-group">
<label>{app.translator.trans('flarum-pusher.admin.pusher_settings.app_secret_label')}</label>
<input className="FormControl" bidi={this.setting('flarum-pusher.app_secret')}/>
</div>,
<div className="Form-group">
<label>{app.translator.trans('flarum-pusher.admin.pusher_settings.app_cluster_label')}</label>
<input className="FormControl" bidi={this.setting('flarum-pusher.app_cluster')}/>
</div>
];
}
}

View File

@ -1,8 +1,38 @@
import { extend } from 'flarum/extend';
import app from 'flarum/app';
import PusherSettingsModal from './components/PusherSettingsModal';
app.initializers.add('flarum-pusher', app => {
app.extensionSettings['flarum-pusher'] = () => app.modal.show(PusherSettingsModal);
app.extensionData
.for('flarum-pusher')
.registerSetting(
{
setting: 'flarum-pusher.app_id',
label: app.translator.trans('flarum-pusher.admin.pusher_settings.app_id_label'),
type: 'text',
},
30
)
.registerSetting(
{
setting: 'flarum-pusher.app_key',
label: app.translator.trans('flarum-pusher.admin.pusher_settings.app_key_label'),
type: 'text',
},
20
)
.registerSetting(
{
setting: 'flarum-pusher.app_secret',
label: app.translator.trans('flarum-pusher.admin.pusher_settings.app_secret_label'),
type: 'text',
},
10
)
.registerSetting(
{
setting: 'flarum-pusher.app_cluster',
label: app.translator.trans('flarum-pusher.admin.pusher_settings.app_cluster_label'),
type: 'text',
},
0
);
});