mirror of
https://github.com/TryGhost/Ghost.git
synced 2023-12-13 21:00:40 +01:00
✨ Added new brand blog setting (#11408)
no issue Adds new `brand: {primary_color: ''}` blog setting behind dev flag for setting user-defined brand color in themes and emails.
This commit is contained in:
parent
7bf48e49a1
commit
fa3686bcc3
|
@ -6,6 +6,7 @@ const gating = require('./post-gating');
|
||||||
const clean = require('./clean');
|
const clean = require('./clean');
|
||||||
const extraAttrs = require('./extra-attrs');
|
const extraAttrs = require('./extra-attrs');
|
||||||
const postsMetaSchema = require('../../../../../../data/schema').tables.posts_meta;
|
const postsMetaSchema = require('../../../../../../data/schema').tables.posts_meta;
|
||||||
|
const config = require('../../../../../../config');
|
||||||
|
|
||||||
const mapUser = (model, frame) => {
|
const mapUser = (model, frame) => {
|
||||||
const jsonModel = model.toJSON ? model.toJSON(frame.options) : model;
|
const jsonModel = model.toJSON ? model.toJSON(frame.options) : model;
|
||||||
|
@ -99,11 +100,17 @@ const mapSettings = (attrs, frame) => {
|
||||||
// fields completely.
|
// fields completely.
|
||||||
if (_.isArray(attrs)) {
|
if (_.isArray(attrs)) {
|
||||||
attrs = _.filter(attrs, (o) => {
|
attrs = _.filter(attrs, (o) => {
|
||||||
|
if (o.key === 'brand' && !config.get('enableDeveloperExperiments')) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
return o.key !== 'ghost_head' && o.key !== 'ghost_foot';
|
return o.key !== 'ghost_head' && o.key !== 'ghost_foot';
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
delete attrs.ghost_head;
|
delete attrs.ghost_head;
|
||||||
delete attrs.ghost_foot;
|
delete attrs.ghost_foot;
|
||||||
|
if (!config.get('enableDeveloperExperiments')) {
|
||||||
|
delete attrs.brand;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return attrs;
|
return attrs;
|
||||||
|
|
|
@ -42,6 +42,9 @@
|
||||||
"icon": {
|
"icon": {
|
||||||
"defaultValue": ""
|
"defaultValue": ""
|
||||||
},
|
},
|
||||||
|
"brand": {
|
||||||
|
"defaultValue": "{\"primaryColor\":\"\"}"
|
||||||
|
},
|
||||||
"default_locale": {
|
"default_locale": {
|
||||||
"defaultValue": "en",
|
"defaultValue": "en",
|
||||||
"validations": {
|
"validations": {
|
||||||
|
|
|
@ -11,6 +11,7 @@ module.exports = {
|
||||||
description: 'description',
|
description: 'description',
|
||||||
logo: 'logo',
|
logo: 'logo',
|
||||||
icon: 'icon',
|
icon: 'icon',
|
||||||
|
brand: 'brand',
|
||||||
cover_image: 'cover_image',
|
cover_image: 'cover_image',
|
||||||
facebook: 'facebook',
|
facebook: 'facebook',
|
||||||
twitter: 'twitter',
|
twitter: 'twitter',
|
||||||
|
|
|
@ -43,7 +43,7 @@ describe('Settings Content API', function () {
|
||||||
|
|
||||||
// Verify we have the right keys for settings
|
// Verify we have the right keys for settings
|
||||||
const publicProperties = _.filter(_.values(publicSettings), (o) => {
|
const publicProperties = _.filter(_.values(publicSettings), (o) => {
|
||||||
return (o !== 'ghost_head' && o !== 'ghost_foot');
|
return (o !== 'ghost_head' && o !== 'ghost_foot' && o !== 'brand');
|
||||||
});
|
});
|
||||||
publicProperties.push('codeinjection_head', 'codeinjection_foot');
|
publicProperties.push('codeinjection_head', 'codeinjection_foot');
|
||||||
settings.should.have.properties(publicProperties);
|
settings.should.have.properties(publicProperties);
|
||||||
|
|
Loading…
Reference in a new issue