mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-04-08 02:52:39 -05: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
4 changed files with 12 additions and 1 deletions
|
@ -6,6 +6,7 @@ const gating = require('./post-gating');
|
|||
const clean = require('./clean');
|
||||
const extraAttrs = require('./extra-attrs');
|
||||
const postsMetaSchema = require('../../../../../../data/schema').tables.posts_meta;
|
||||
const config = require('../../../../../../config');
|
||||
|
||||
const mapUser = (model, frame) => {
|
||||
const jsonModel = model.toJSON ? model.toJSON(frame.options) : model;
|
||||
|
@ -99,11 +100,17 @@ const mapSettings = (attrs, frame) => {
|
|||
// fields completely.
|
||||
if (_.isArray(attrs)) {
|
||||
attrs = _.filter(attrs, (o) => {
|
||||
if (o.key === 'brand' && !config.get('enableDeveloperExperiments')) {
|
||||
return false;
|
||||
}
|
||||
return o.key !== 'ghost_head' && o.key !== 'ghost_foot';
|
||||
});
|
||||
} else {
|
||||
delete attrs.ghost_head;
|
||||
delete attrs.ghost_foot;
|
||||
if (!config.get('enableDeveloperExperiments')) {
|
||||
delete attrs.brand;
|
||||
}
|
||||
}
|
||||
|
||||
return attrs;
|
||||
|
|
|
@ -42,6 +42,9 @@
|
|||
"icon": {
|
||||
"defaultValue": ""
|
||||
},
|
||||
"brand": {
|
||||
"defaultValue": "{\"primaryColor\":\"\"}"
|
||||
},
|
||||
"default_locale": {
|
||||
"defaultValue": "en",
|
||||
"validations": {
|
||||
|
|
|
@ -11,6 +11,7 @@ module.exports = {
|
|||
description: 'description',
|
||||
logo: 'logo',
|
||||
icon: 'icon',
|
||||
brand: 'brand',
|
||||
cover_image: 'cover_image',
|
||||
facebook: 'facebook',
|
||||
twitter: 'twitter',
|
||||
|
|
|
@ -43,7 +43,7 @@ describe('Settings Content API', function () {
|
|||
|
||||
// Verify we have the right keys for settings
|
||||
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');
|
||||
settings.should.have.properties(publicProperties);
|
||||
|
|
Loading…
Add table
Reference in a new issue