diff --git a/client/coral-admin/src/containers/Configure/CommentSettings.js b/client/coral-admin/src/containers/Configure/CommentSettings.js index 1051bb0ba..5a14cf565 100644 --- a/client/coral-admin/src/containers/Configure/CommentSettings.js +++ b/client/coral-admin/src/containers/Configure/CommentSettings.js @@ -51,6 +51,12 @@ const updateClosedMessage = (updateSettings) => (event) => { updateSettings({closedMessage}); }; +const updateCustomCssUrl = (updateSettings) => (event) => { + console.log('updateCustomCssUrl', event.target.value); + const customCssUrl = event.target.value; + updateSettings({customCssUrl}); +}; + // If we are changing the measure we need to recalculate using the old amount // Same thing if we are just changing the amount const updateClosedTimeout = (updateSettings, ts, isMeasure) => (event) => { @@ -165,7 +171,7 @@ const CommentSettings = ({fetchingSettings, title, updateSettings, settingsError - +
{lang.t('configure.close-after')}
@@ -188,6 +194,18 @@ const CommentSettings = ({fetchingSettings, title, updateSettings, settingsError
+ +
+ {lang.t('configure.custom-css-url')} +

{lang.t('configure.custom-css-url-desc')}

+
+ +
+
); }; diff --git a/client/coral-admin/src/translations.json b/client/coral-admin/src/translations.json index 42028c3a2..fc507400e 100644 --- a/client/coral-admin/src/translations.json +++ b/client/coral-admin/src/translations.json @@ -48,6 +48,8 @@ "copy": "Copy to Clipboard" }, "configure": { + "custom-css-url": "Custom CSS URL", + "custom-css-url-desc": "URL of a CSS stylesheet that will override default Embed Stream styles. Can be internal or external.", "enable-pre-moderation": "Enable pre-moderation", "enable-pre-moderation-text": "Moderators must approve any comment before it is published.", "require-email-verification": "Require Email Verification", @@ -157,6 +159,8 @@ "username_flags": "" }, "configure": { + "custom-css-url": "URL CSS a medida", + "custom-css-url-desc": "URL de una hoja de estilo que va a sobrescribir los estilos por defecto de Embed Stream. Puede ser interna o externa.", "enable-pre-moderation": "Habilitar pre-moderación", "enable-pre-moderation-text": "Los moderadores deben aprobar cada comentario antes de que sea publicado.", "require-email-verification": "Necesita confirmación de correo", diff --git a/models/setting.js b/models/setting.js index adbf60d83..0987b141d 100644 --- a/models/setting.js +++ b/models/setting.js @@ -24,6 +24,10 @@ const SettingSchema = new Schema({ type: Boolean, default: false }, + customCssUrl: { + type: String, + default: '' + }, infoBoxContent: { type: String, default: '' diff --git a/routes/embed/index.js b/routes/embed/index.js index 400d2eb4b..ccc872c1f 100644 --- a/routes/embed/index.js +++ b/routes/embed/index.js @@ -1,10 +1,14 @@ const express = require('express'); const router = express.Router(); +const SettingsService = require('../../services/settings'); router.use('/:embed', (req, res, next) => { switch (req.params.embed) { case 'stream': - return res.render('embed/stream', {}); + return SettingsService.retrieve() + .then(({customCssUrl}) => { + return res.render('embed/stream', {customCssUrl}); + }); default: // will return a 404. diff --git a/views/embed/stream.ejs b/views/embed/stream.ejs index 722864338..77b392b5f 100644 --- a/views/embed/stream.ejs +++ b/views/embed/stream.ejs @@ -5,6 +5,9 @@ + <% if (locals.customCssUrl) { %> + + <% } %>