mirror of
https://github.com/wassname/talk.git
synced 2026-07-19 11:28:50 +08:00
Merge branch 'master'
Conflicts: client/coral-admin/src/translations.json
This commit is contained in:
@@ -39,7 +39,7 @@ export const updateDomainlist = (listName, list) => {
|
||||
};
|
||||
|
||||
export const saveSettingsToServer = () => (dispatch, getState) => {
|
||||
let settings = getState().settings.toJS().settings;
|
||||
let settings = getState().settings.toJS();
|
||||
if (settings.charCount) {
|
||||
settings.charCount = parseInt(settings.charCount);
|
||||
}
|
||||
|
||||
@@ -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
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
<Card className={`${styles.configSettingInfoBox}`}>
|
||||
<Card className={styles.configSettingInfoBox}>
|
||||
<div className={styles.content}>
|
||||
{lang.t('configure.close-after')}
|
||||
<br />
|
||||
@@ -188,6 +194,18 @@ const CommentSettings = ({fetchingSettings, title, updateSettings, settingsError
|
||||
</div>
|
||||
</div>
|
||||
</Card>
|
||||
<Card className={styles.configSettingInfoBox}>
|
||||
<div className={styles.content}>
|
||||
{lang.t('configure.custom-css-url')}
|
||||
<p>{lang.t('configure.custom-css-url-desc')}</p>
|
||||
<br />
|
||||
<Textfield
|
||||
style={{width: '100%'}}
|
||||
label={lang.t('configure.custom-css-url')}
|
||||
value={settings.customCssUrl}
|
||||
onChange={updateCustomCssUrl(updateSettings)} />
|
||||
</div>
|
||||
</Card>
|
||||
</div>
|
||||
);
|
||||
};
|
||||
|
||||
@@ -165,7 +165,9 @@ class Configure extends Component {
|
||||
}
|
||||
}
|
||||
|
||||
const mapStateToProps = state => state.settings.toJS();
|
||||
const mapStateToProps = state => ({
|
||||
settings: state.settings.toJS()
|
||||
});
|
||||
export default connect(mapStateToProps)(Configure);
|
||||
|
||||
const lang = new I18n(translations);
|
||||
|
||||
@@ -2,14 +2,12 @@ import {Map, List} from 'immutable';
|
||||
import * as actions from '../actions/settings';
|
||||
|
||||
const initialState = Map({
|
||||
settings: Map({
|
||||
wordlist: Map({
|
||||
banned: List(),
|
||||
suspect: List()
|
||||
}),
|
||||
domains: Map({
|
||||
whitelist: List()
|
||||
})
|
||||
wordlist: Map({
|
||||
banned: List(),
|
||||
suspect: List()
|
||||
}),
|
||||
domains: Map({
|
||||
whitelist: List()
|
||||
}),
|
||||
saveSettingsError: null,
|
||||
fetchSettingsError: null,
|
||||
@@ -54,10 +52,10 @@ export default function settings (state = initialState, action) {
|
||||
.set('fetchSettingsError', action.error);
|
||||
case actions.WORDLIST_UPDATED:
|
||||
return state
|
||||
.setIn(['settings', 'wordlist', action.listName], action.list);
|
||||
.setIn(['wordlist', action.listName], action.list);
|
||||
case actions.DOMAINLIST_UPDATED:
|
||||
return state
|
||||
.setIn(['settings', 'domains', action.listName], action.list);
|
||||
.setIn(['domains', action.listName], action.list);
|
||||
default:
|
||||
return state;
|
||||
}
|
||||
|
||||
@@ -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.",
|
||||
"dashboard": "Dashboard",
|
||||
"enable-pre-moderation": "Enable pre-moderation",
|
||||
"enable-pre-moderation-text": "Moderators must approve any comment before it is published.",
|
||||
@@ -158,6 +160,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.",
|
||||
"dashboard": "Panel",
|
||||
"enable-pre-moderation": "Habilitar pre-moderación",
|
||||
"enable-pre-moderation-text": "Los moderadores deben aprobar cada comentario antes de que sea publicado.",
|
||||
|
||||
@@ -24,6 +24,10 @@ const SettingSchema = new Schema({
|
||||
type: Boolean,
|
||||
default: false
|
||||
},
|
||||
customCssUrl: {
|
||||
type: String,
|
||||
default: ''
|
||||
},
|
||||
infoBoxContent: {
|
||||
type: String,
|
||||
default: ''
|
||||
|
||||
@@ -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.
|
||||
|
||||
@@ -5,6 +5,9 @@
|
||||
<link rel="stylesheet" type="text/css" href="/client/embed/stream/default.css">
|
||||
<link href="https://fonts.googleapis.com/css?family=Lato|Open+Sans" rel="stylesheet">
|
||||
<link href="https://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
|
||||
<% if (locals.customCssUrl) { %>
|
||||
<link href="<%= customCssUrl %>" rel="stylesheet" type="text/css">
|
||||
<% } %>
|
||||
</head>
|
||||
<body>
|
||||
<div id="coralStream"></div>
|
||||
|
||||
Reference in New Issue
Block a user