mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-03 23:00:14 -05:00
Added API endpoint for browsing custom theme settings (#13362)
refs https://github.com/TryGhost/Team/issues/1070 - bumped `@tryghost/custom-theme-settings-service` to get access to `.listSettings()` method - added GET `/api/canary/admin/theme_settings/` route behind `'customThemeSettings'` feature flag that uses the custom theme settings service to return settings resources that are a combination of the theme-provided definition and the saved value
This commit is contained in:
parent
cb53dd338e
commit
2947db0e6b
7 changed files with 35 additions and 5 deletions
12
core/server/api/canary/custom-theme-settings.js
Normal file
12
core/server/api/canary/custom-theme-settings.js
Normal file
|
@ -0,0 +1,12 @@
|
||||||
|
const customThemeSettingsService = require('../../services/custom-theme-settings');
|
||||||
|
|
||||||
|
module.exports = {
|
||||||
|
docName: 'custom_theme_settings',
|
||||||
|
|
||||||
|
browse: {
|
||||||
|
permissions: true,
|
||||||
|
query() {
|
||||||
|
return customThemeSettingsService.listSettings();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
|
@ -153,6 +153,10 @@ module.exports = {
|
||||||
return shared.pipeline(require('./snippets'), localUtils);
|
return shared.pipeline(require('./snippets'), localUtils);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
get customThemeSettings() {
|
||||||
|
return shared.pipeline(require('./custom-theme-settings'), localUtils);
|
||||||
|
},
|
||||||
|
|
||||||
get serializers() {
|
get serializers() {
|
||||||
return require('./utils/serializers');
|
return require('./utils/serializers');
|
||||||
},
|
},
|
||||||
|
|
|
@ -0,0 +1,7 @@
|
||||||
|
module.exports = {
|
||||||
|
browse(models, apiConfig, frame) {
|
||||||
|
frame.response = {
|
||||||
|
customThemeSettings: models
|
||||||
|
};
|
||||||
|
}
|
||||||
|
};
|
|
@ -139,5 +139,9 @@ module.exports = {
|
||||||
|
|
||||||
get snippets() {
|
get snippets() {
|
||||||
return require('./snippets');
|
return require('./snippets');
|
||||||
|
},
|
||||||
|
|
||||||
|
get custom_theme_settings() {
|
||||||
|
return require('./custom-theme-settings');
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
|
@ -273,5 +273,8 @@ module.exports = function apiRoutes() {
|
||||||
router.put('/snippets/:id', mw.authAdminApi, http(api.snippets.edit));
|
router.put('/snippets/:id', mw.authAdminApi, http(api.snippets.edit));
|
||||||
router.del('/snippets/:id', mw.authAdminApi, http(api.snippets.destroy));
|
router.del('/snippets/:id', mw.authAdminApi, http(api.snippets.destroy));
|
||||||
|
|
||||||
|
// ## Custom theme settings
|
||||||
|
router.get('/custom_theme_settings', mw.authAdminApi, labs.enabledMiddleware('customThemeSettings'), http(api.customThemeSettings.browse));
|
||||||
|
|
||||||
return router;
|
return router;
|
||||||
};
|
};
|
||||||
|
|
|
@ -59,7 +59,7 @@
|
||||||
"@tryghost/color-utils": "0.1.2",
|
"@tryghost/color-utils": "0.1.2",
|
||||||
"@tryghost/config-url-helpers": "0.1.1",
|
"@tryghost/config-url-helpers": "0.1.1",
|
||||||
"@tryghost/constants": "0.1.9",
|
"@tryghost/constants": "0.1.9",
|
||||||
"@tryghost/custom-theme-settings-service": "0.0.2",
|
"@tryghost/custom-theme-settings-service": "0.0.4",
|
||||||
"@tryghost/debug": "0.1.5",
|
"@tryghost/debug": "0.1.5",
|
||||||
"@tryghost/email-analytics-provider-mailgun": "1.0.1",
|
"@tryghost/email-analytics-provider-mailgun": "1.0.1",
|
||||||
"@tryghost/email-analytics-service": "1.0.1",
|
"@tryghost/email-analytics-service": "1.0.1",
|
||||||
|
|
|
@ -1265,10 +1265,10 @@
|
||||||
resolved "https://registry.yarnpkg.com/@tryghost/constants/-/constants-0.1.9.tgz#1c3ecb42feffdff4cb2ad684938a209ac69ebeaf"
|
resolved "https://registry.yarnpkg.com/@tryghost/constants/-/constants-0.1.9.tgz#1c3ecb42feffdff4cb2ad684938a209ac69ebeaf"
|
||||||
integrity sha512-tCRFl+d5tYUyAHKGXt+eEm7f7Vpb0a8VXGenpo1q20PEPY7lVsHkFJ+8mwebQWUmELrXKfYkDgjuQDZizQxArA==
|
integrity sha512-tCRFl+d5tYUyAHKGXt+eEm7f7Vpb0a8VXGenpo1q20PEPY7lVsHkFJ+8mwebQWUmELrXKfYkDgjuQDZizQxArA==
|
||||||
|
|
||||||
"@tryghost/custom-theme-settings-service@0.0.2":
|
"@tryghost/custom-theme-settings-service@0.0.4":
|
||||||
version "0.0.2"
|
version "0.0.4"
|
||||||
resolved "https://registry.yarnpkg.com/@tryghost/custom-theme-settings-service/-/custom-theme-settings-service-0.0.2.tgz#a017fe7ca5bc0a3b9c603e5177b4f6ac5692f49c"
|
resolved "https://registry.yarnpkg.com/@tryghost/custom-theme-settings-service/-/custom-theme-settings-service-0.0.4.tgz#6eae410db3b7ab5d0faa4c0de991ff26e90e340e"
|
||||||
integrity sha512-TOwUeN7H/h+lr3tU3RwEUy21gAImQ/MQsk147DNs8mXm4efw32VOHp/NskM0ZQoDU9wi9gyK9fA/CZ5rgNRPDA==
|
integrity sha512-78ck4xeDECJN+KNO3yXx5VsvdAhofMaLnPRrWSRWE1Qk6sgQw5yaoFk9kNkOrWksJn++O6Zx95MdiRgqPKTRqA==
|
||||||
dependencies:
|
dependencies:
|
||||||
"@tryghost/debug" "^0.1.5"
|
"@tryghost/debug" "^0.1.5"
|
||||||
"@tryghost/errors" "^0.2.14"
|
"@tryghost/errors" "^0.2.14"
|
||||||
|
|
Loading…
Add table
Reference in a new issue