mirror of
https://github.com/wassname/talk.git
synced 2026-07-23 13:10:20 +08:00
Added textarea for closed message on admin
This commit is contained in:
@@ -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 {
|
||||
</p>
|
||||
</ListItemContent>
|
||||
</ListItem>
|
||||
<ListItem className={styles.configSettingInfoBox}>
|
||||
<ListItemContent>
|
||||
{lang.t('configure.closed-comments-desc')}
|
||||
<Textfield
|
||||
onChange={this.updateClosedMessage}
|
||||
value={this.props.settings.closedMessage}
|
||||
label={lang.t('configure.closed-comments-label')}
|
||||
rows={3}/>
|
||||
</ListItemContent>
|
||||
</ListItem>
|
||||
<ListItem className={`${styles.configSettingInfoBox} ${this.props.settings.infoBoxEnable ? null : styles.hidden}`} >
|
||||
<ListItemContent>
|
||||
<Textfield
|
||||
|
||||
@@ -41,7 +41,9 @@
|
||||
"copy-and-paste": "Copy and paste code below into your CMS to embed your comment box in your articles",
|
||||
"moderate": "Moderate",
|
||||
"configure": "Configure",
|
||||
"community": "Community"
|
||||
"community": "Community",
|
||||
"closed-comments-desc": "Write a message for closed threads",
|
||||
"closed-comments-label": "Write a message..."
|
||||
}
|
||||
},
|
||||
"es": {
|
||||
@@ -75,7 +77,9 @@
|
||||
"copy-and-paste": "Copiar y pegar el código de más abajo en tu CMS para colocar la caja de comentarios en tus articulos",
|
||||
"moderate": "Moderar",
|
||||
"configure": "Configurar",
|
||||
"community": "Comunidad"
|
||||
"community": "Comunidad",
|
||||
"closed-comments-desc": "Escribe un mensaje para cuando los comentarios se encuentran cerrados",
|
||||
"closed-comments-label": "Escribe un mensaje..."
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,7 +80,7 @@ class CommentStream extends Component {
|
||||
const rootItem = this.props.items.assets && this.props.items.assets[rootItemId];
|
||||
const {actions, users, comments} = this.props.items;
|
||||
const {loggedIn, user, showSignInDialog} = this.props.auth;
|
||||
const {status} = this.props.config;
|
||||
const {status, closedMessage} = this.props.config;
|
||||
const {activeTab} = this.state;
|
||||
|
||||
return <div className={showSignInDialog ? 'expandForSignin' : ''}>
|
||||
@@ -114,7 +114,7 @@ class CommentStream extends Component {
|
||||
author={user}
|
||||
/>
|
||||
</div>
|
||||
: <p>Comments are closed for this thread.</p>
|
||||
: <p>{this.props.config.closedMessage}</p>
|
||||
}
|
||||
{!loggedIn && <SignInContainer />}
|
||||
{
|
||||
|
||||
@@ -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';
|
||||
|
||||
@@ -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) => {
|
||||
|
||||
+1
-1
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user