AdminPage
Extends:
Valid options for the setting component builder to generate a Switch.
Method Summary
| Public Methods | ||
| public |
buildSettingComponent(entry: *): *
|
|
| public |
dirty(): * Returns a map of settings keys to values which includes only those which have been modified but not yet saved. |
|
| public |
header(vnode: *): * Returns the Header component for this AdminPage. |
|
| public |
headerInfo(): {"className": *, "icon": *, "title": *, "description": *} Returns the options passed to the AdminHeader component. |
|
| public |
isChanged(): * Returns the number of settings that have been modified. |
|
| public |
onsaved() Called when |
|
| public |
saveSettings(e: *): * Saves the modified settings to the database. |
|
| public |
Returns a function that fetches the setting from the |
|
| public |
submitButton(vnode: *): * Returns the submit button for this AdminPage. |
|
| public |
view(vnode: *): * |
|
Public Methods
public buildSettingComponent(entry: *): * source
buildSettingComponent takes a settings object and turns it into a component.
Depending on the type of input, you can set the type to 'bool', 'select', or
any standard <input> type. Any values inside the 'extra' object will be added
to the component as an attribute.
Alternatively, you can pass a callback that will be executed in ExtensionPage's context to include custom JSX elements.
Params:
| Name | Type | Attribute | Description |
| entry | * |
Return:
| * |
Example:
{
setting: 'acme.checkbox',
label: app.translator.trans('acme.admin.setting_label'),
type: 'bool',
help: app.translator.trans('acme.admin.setting_help'),
className: 'Setting-item'
}
{
setting: 'acme.select',
label: app.translator.trans('acme.admin.setting_label'),
type: 'select',
options: {
'option1': 'Option 1 label',
'option2': 'Option 2 label',
},
default: 'option1',
}
() => {
return <p>My cool component</p>;
}
public dirty(): * source
Returns a map of settings keys to values which includes only those which have been modified but not yet saved.
Return:
| * |
public header(vnode: *): * source
Returns the Header component for this AdminPage.
Params:
| Name | Type | Attribute | Description |
| vnode | * |
Return:
| * |
public headerInfo(): {"className": *, "icon": *, "title": *, "description": *} source
Returns the options passed to the AdminHeader component.
Return:
| {"className": *, "icon": *, "title": *, "description": *} |
public saveSettings(e: *): * source
Saves the modified settings to the database.
Params:
| Name | Type | Attribute | Description |
| e | * |
Return:
| * |
public setting(key: *, fallback: string): * source
Returns a function that fetches the setting from the app global.
Params:
| Name | Type | Attribute | Description |
| key | * | ||
| fallback | string |
|
Return:
| * |
public submitButton(vnode: *): * source
Returns the submit button for this AdminPage.
Calls this.saveSettings when the button is clicked.
Params:
| Name | Type | Attribute | Description |
| vnode | * |
Return:
| * |
Reference
Source
