mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-12-21 01:41:46 +03:00
1e8e0485e3
refs https://github.com/TryGhost/Team/issues/1070 - adds a `customThemeSettings` service that handles overall setting loading and saving to avoid components having to know any of the intricacies of the model setup - adds `custom-theme-setting-list` model so that we can save multiple setting records as embedded relations - custom adapter ensures requests go to the `/custom_theme_settings` base route as a `PUT` request - custom serializer drops the default `models: []` wrapper in the save request data so the format matches the `PUT /settings` endpoint, then converts the response to look like a `custom-theme-setting-list` response
16 lines
637 B
JavaScript
16 lines
637 B
JavaScript
import ApplicationAdapter from 'ghost-admin/adapters/application';
|
|
|
|
export default class CustomThemeSettingListAdapter extends ApplicationAdapter {
|
|
// we use `custom-theme-setting-list` model as a workaround for saving all
|
|
// custom theme setting records in one request so it uses the base model url
|
|
pathForType() {
|
|
return 'custom_theme_settings';
|
|
}
|
|
|
|
// there's no custom theme setting creation
|
|
// newListModel.save() acts as an overall update request so force a PUT
|
|
createRecord(store, type, snapshot) {
|
|
return this.saveRecord(store, type, snapshot, {method: 'PUT'}, 'createRecord');
|
|
}
|
|
}
|