mirror of
https://github.com/flarum/framework.git
synced 2025-02-08 02:07:03 +08:00
Merge "Small Admin Patches" (#2739) from flarum/ck/adminux-patch2 into master
- Fixes #2736 - Fixes #2728
This commit is contained in:
commit
3dae397c65
|
@ -126,16 +126,17 @@ export default class AdminNav extends Component {
|
||||||
|
|
||||||
categorizedExtensions[category].map((extension) => {
|
categorizedExtensions[category].map((extension) => {
|
||||||
const query = this.query().toUpperCase();
|
const query = this.query().toUpperCase();
|
||||||
const title = extension.extra['flarum-extension'].title;
|
const title = extension.extra['flarum-extension'].title || '';
|
||||||
|
const description = extension.description || '';
|
||||||
|
|
||||||
if (!query || title.toUpperCase().includes(query) || extension.description.toUpperCase().includes(query)) {
|
if (!query || title.toUpperCase().includes(query) || description.toUpperCase().includes(query)) {
|
||||||
items.add(
|
items.add(
|
||||||
`extension-${extension.id}`,
|
`extension-${extension.id}`,
|
||||||
<ExtensionLinkButton
|
<ExtensionLinkButton
|
||||||
href={app.route('extension', { id: extension.id })}
|
href={app.route('extension', { id: extension.id })}
|
||||||
extensionId={extension.id}
|
extensionId={extension.id}
|
||||||
className="ExtensionNavButton"
|
className="ExtensionNavButton"
|
||||||
title={extension.description}
|
title={description}
|
||||||
>
|
>
|
||||||
{title}
|
{title}
|
||||||
</ExtensionLinkButton>,
|
</ExtensionLinkButton>,
|
||||||
|
|
|
@ -98,35 +98,41 @@ export default class AdminPage extends Page {
|
||||||
return entry.call(this);
|
return entry.call(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
const setting = entry.setting;
|
const { setting, help, ...componentAttrs } = entry;
|
||||||
const help = entry.help;
|
|
||||||
delete entry.help;
|
delete componentAttrs.help;
|
||||||
|
|
||||||
const value = this.setting([setting])();
|
const value = this.setting([setting])();
|
||||||
if (['bool', 'checkbox', 'switch', 'boolean'].includes(entry.type)) {
|
if (['bool', 'checkbox', 'switch', 'boolean'].includes(componentAttrs.type)) {
|
||||||
return (
|
return (
|
||||||
<div className="Form-group">
|
<div className="Form-group">
|
||||||
<Switch state={!!value && value !== '0'} onchange={this.settings[setting]} {...entry}>
|
<Switch state={!!value && value !== '0'} onchange={this.settings[setting]} {...componentAttrs}>
|
||||||
{entry.label}
|
{componentAttrs.label}
|
||||||
</Switch>
|
</Switch>
|
||||||
<div className="helpText">{help}</div>
|
<div className="helpText">{help}</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else if (['select', 'dropdown', 'selectdropdown'].includes(entry.type)) {
|
} else if (['select', 'dropdown', 'selectdropdown'].includes(componentAttrs.type)) {
|
||||||
return (
|
return (
|
||||||
<div className="Form-group">
|
<div className="Form-group">
|
||||||
<label>{entry.label}</label>
|
<label>{componentAttrs.label}</label>
|
||||||
<div className="helpText">{help}</div>
|
<div className="helpText">{help}</div>
|
||||||
<Select value={value || entry.default} options={entry.options} buttonClassName="Button" onchange={this.settings[setting]} {...entry} />
|
<Select
|
||||||
|
value={value || componentAttrs.default}
|
||||||
|
options={componentAttrs.options}
|
||||||
|
buttonClassName="Button"
|
||||||
|
onchange={this.settings[setting]}
|
||||||
|
{...componentAttrs}
|
||||||
|
/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
entry.className = classList(['FormControl', entry.className]);
|
componentAttrs.className = classList(['FormControl', componentAttrs.className]);
|
||||||
return (
|
return (
|
||||||
<div className="Form-group">
|
<div className="Form-group">
|
||||||
{entry.label ? <label>{entry.label}</label> : ''}
|
{componentAttrs.label ? <label>{componentAttrs.label}</label> : ''}
|
||||||
<div className="helpText">{help}</div>
|
<div className="helpText">{help}</div>
|
||||||
<input type={entry.type} bidi={this.setting(setting)} {...entry} />
|
<input type={componentAttrs.type} bidi={this.setting(setting)} {...componentAttrs} />
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue
Block a user