From fb392422eae88c96be5016c1e8d26bcd21a53e30 Mon Sep 17 00:00:00 2001
From: Dan Zajdband
Date: Thu, 8 Dec 2016 12:44:02 -0500
Subject: [PATCH] Added textarea for closed message on admin
---
.../src/containers/Configure/Configure.js | 16 ++++++++++++++++
client/coral-admin/src/translations.json | 8 ++++++--
client/coral-embed-stream/src/CommentStream.js | 4 ++--
client/coral-framework/actions/config.js | 1 +
client/coral-framework/reducers/config.js | 3 ++-
models/setting.js | 2 +-
6 files changed, 28 insertions(+), 6 deletions(-)
diff --git a/client/coral-admin/src/containers/Configure/Configure.js b/client/coral-admin/src/containers/Configure/Configure.js
index a9e2f3ef2..e171fc27d 100644
--- a/client/coral-admin/src/containers/Configure/Configure.js
+++ b/client/coral-admin/src/containers/Configure/Configure.js
@@ -28,6 +28,7 @@ class Configure extends React.Component {
// InfoBox has two settings. Enable or not and the content of it if it is enable.
this.updateInfoBoxEnable = this.updateInfoBoxEnable.bind(this);
this.updateInfoBoxContent = this.updateInfoBoxContent.bind(this);
+ this.updateClosedMessage = this.updateClosedMessage.bind(this);
this.saveSettings = this.saveSettings.bind(this);
}
@@ -51,6 +52,11 @@ class Configure extends React.Component {
this.props.dispatch(updateSettings({infoBoxContent}));
}
+ updateClosedMessage (event) {
+ const closedMessage = event.target.value;
+ this.props.dispatch(updateSettings({closedMessage}));
+ }
+
saveSettings () {
this.props.dispatch(saveSettingsToServer());
}
@@ -78,6 +84,16 @@ class Configure extends React.Component {
+
+
+ {lang.t('configure.closed-comments-desc')}
+
+
+
@@ -114,7 +114,7 @@ class CommentStream extends Component {
author={user}
/>
- : Comments are closed for this thread.
+ : {this.props.config.closedMessage}
}
{!loggedIn && }
{
diff --git a/client/coral-framework/actions/config.js b/client/coral-framework/actions/config.js
index 6dc880434..e004fa1eb 100644
--- a/client/coral-framework/actions/config.js
+++ b/client/coral-framework/actions/config.js
@@ -5,6 +5,7 @@ import coralApi from '../helpers/response';
* Action name constants
*/
+export const UPDATE_SETTINGS = 'UPDATE_SETTINGS';
export const OPEN_COMMENTS = 'OPEN_COMMENTS';
export const CLOSE_COMMENTS = 'CLOSE_COMMENTS';
export const ADD_ITEM = 'ADD_ITEM';
diff --git a/client/coral-framework/reducers/config.js b/client/coral-framework/reducers/config.js
index 9620f5b97..7fbccaa49 100644
--- a/client/coral-framework/reducers/config.js
+++ b/client/coral-framework/reducers/config.js
@@ -5,7 +5,8 @@ import * as actions from '../actions/config';
const initialState = Map({
features: Map({}),
- status: 'open'
+ status: 'open',
+ closedMessage: ''
});
export default (state = initialState, action) => {
diff --git a/models/setting.js b/models/setting.js
index 5d71b8c97..2414381fa 100644
--- a/models/setting.js
+++ b/models/setting.js
@@ -99,7 +99,7 @@ SettingService.update = (settings) => Setting.findOneAndUpdate(selector, {
* @param {Object} settings the source settings object
* @return {Object} the filtered settings object
*/
-SettingService.public = (settings) => _.pick(settings, ['moderation', 'infoBoxEnable', 'infoBoxContent']);
+SettingService.public = (settings) => _.pick(settings, ['moderation', 'infoBoxEnable', 'infoBoxContent', 'closedMessage']);
/**
* This is run once when the app starts to ensure settings are populated.