mirror of
https://github.com/TryGhost/Ghost.git
synced 2025-02-10 23:36:14 -05:00
Added color scheme helper parameter
refs https://github.com/TryGhost/Team/issues/1664
This commit is contained in:
parent
14020f46d2
commit
be69d83141
1 changed files with 10 additions and 3 deletions
|
@ -1,14 +1,20 @@
|
||||||
const {SafeString} = require('../services/handlebars');
|
const {SafeString} = require('../services/handlebars');
|
||||||
const {config, urlUtils, getFrontendKey, labs} = require('../services/proxy');
|
const {config, urlUtils, getFrontendKey, labs} = require('../services/proxy');
|
||||||
|
|
||||||
async function comments() {
|
async function comments(options) {
|
||||||
// todo: For now check on the comment id to exclude normal pages (we probably have a better way to do this)
|
// todo: For now check on the comment id to exclude normal pages (we probably have a better way to do this)
|
||||||
|
|
||||||
const commentId = this.comment_id;
|
const commentId = this.comment_id;
|
||||||
|
|
||||||
if (!commentId) {
|
if (!commentId) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
let colorScheme = 'auto';
|
||||||
|
if (options.hash.color_scheme === 'dark' || options.hash.color_scheme === 'light') {
|
||||||
|
colorScheme = options.hash.color_scheme;
|
||||||
|
}
|
||||||
|
|
||||||
const frontendKey = await getFrontendKey();
|
const frontendKey = await getFrontendKey();
|
||||||
|
|
||||||
const data = {
|
const data = {
|
||||||
|
@ -17,7 +23,8 @@ async function comments() {
|
||||||
admin: urlUtils.urlFor('admin', true),
|
admin: urlUtils.urlFor('admin', true),
|
||||||
key: frontendKey,
|
key: frontendKey,
|
||||||
'post-id': this.id,
|
'post-id': this.id,
|
||||||
'sentry-dsn': '' /* todo: insert sentry dsn key here */
|
'sentry-dsn': '', /* todo: insert sentry dsn key here */
|
||||||
|
'color-scheme': colorScheme
|
||||||
};
|
};
|
||||||
|
|
||||||
let dataAttributes = '';
|
let dataAttributes = '';
|
||||||
|
|
Loading…
Add table
Reference in a new issue