|
|
@@ -1,6 +1,10 @@
|
|
|
import React from 'react';
|
|
|
import PropTypes from 'prop-types';
|
|
|
import { withTranslation } from 'react-i18next';
|
|
|
+import {
|
|
|
+ Card, CardBody,
|
|
|
+ Dropdown, DropdownToggle, DropdownMenu, DropdownItem,
|
|
|
+} from 'reactstrap';
|
|
|
|
|
|
import { createSubscribedElement } from '../../UnstatedUtils';
|
|
|
import { toastSuccess, toastError } from '../../../util/apiNotification';
|
|
|
@@ -16,9 +20,18 @@ class CustomizeBehaviorSetting extends React.Component {
|
|
|
constructor(props) {
|
|
|
super(props);
|
|
|
|
|
|
+ this.state = {
|
|
|
+ isDropdownOpen: false,
|
|
|
+ };
|
|
|
+
|
|
|
+ this.onToggleDropdown = this.onToggleDropdown.bind(this);
|
|
|
this.onClickSubmit = this.onClickSubmit.bind(this);
|
|
|
}
|
|
|
|
|
|
+ onToggleDropdown() {
|
|
|
+ this.setState({ isDropdownOpen: !this.state.isDropdownOpen });
|
|
|
+ }
|
|
|
+
|
|
|
async onClickSubmit() {
|
|
|
const { t, adminCustomizeContainer } = this.props;
|
|
|
|
|
|
@@ -36,119 +49,124 @@ class CustomizeBehaviorSetting extends React.Component {
|
|
|
|
|
|
return (
|
|
|
<React.Fragment>
|
|
|
- <h2 className="admin-setting-header">{t('admin:customize_setting.function')}</h2>
|
|
|
- <p className="well">{t('admin:customize_setting.function_desc')}</p>
|
|
|
-
|
|
|
- <div className="form-group row">
|
|
|
- <div className="col-xs-offset-3 col-xs-6 text-left">
|
|
|
- <CustomizeFunctionOption
|
|
|
- optionId="isEnabledTimeline"
|
|
|
- label={t('admin:customize_setting.function_options.timeline')}
|
|
|
- isChecked={adminCustomizeContainer.state.isEnabledTimeline}
|
|
|
- onChecked={() => { adminCustomizeContainer.switchEnableTimeline() }}
|
|
|
- >
|
|
|
- <p className="help-block">
|
|
|
- {t('admin:customize_setting.function_options.timeline_desc1')}<br />
|
|
|
- {t('admin:customize_setting.function_options.timeline_desc2')}<br />
|
|
|
- {t('admin:customize_setting.function_options.timeline_desc3')}
|
|
|
- </p>
|
|
|
- </CustomizeFunctionOption>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div className="row">
|
|
|
+ <div className="col-12">
|
|
|
+ <h2 className="admin-setting-header">{t('admin:customize_setting.function')}</h2>
|
|
|
+ <Card className="card well my-3">
|
|
|
+ <CardBody className="px-0 py-2">
|
|
|
+ {t('admin:customize_setting.function_desc')}
|
|
|
+ </CardBody>
|
|
|
+ </Card>
|
|
|
+
|
|
|
+
|
|
|
+ <div className="form-group row">
|
|
|
+ <div className="offset-3 col-6 text-left">
|
|
|
+ <CustomizeFunctionOption
|
|
|
+ optionId="isEnabledTimeline"
|
|
|
+ label={t('admin:customize_setting.function_options.timeline')}
|
|
|
+ isChecked={adminCustomizeContainer.state.isEnabledTimeline}
|
|
|
+ onChecked={() => { adminCustomizeContainer.switchEnableTimeline() }}
|
|
|
+ >
|
|
|
+ <p className="form-text text-muted">
|
|
|
+ {t('admin:customize_setting.function_options.timeline_desc1')}<br />
|
|
|
+ {t('admin:customize_setting.function_options.timeline_desc2')}<br />
|
|
|
+ {t('admin:customize_setting.function_options.timeline_desc3')}
|
|
|
+ </p>
|
|
|
+ </CustomizeFunctionOption>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- <div className="form-group row">
|
|
|
- <div className="col-xs-offset-3 col-xs-6 text-left">
|
|
|
- <CustomizeFunctionOption
|
|
|
- optionId="isSavedStatesOfTabChanges"
|
|
|
- label={t('admin:customize_setting.function_options.tab_switch')}
|
|
|
- isChecked={adminCustomizeContainer.state.isSavedStatesOfTabChanges}
|
|
|
- onChecked={() => { adminCustomizeContainer.switchSavedStatesOfTabChanges() }}
|
|
|
- >
|
|
|
- <p className="help-block">
|
|
|
- {t('admin:customize_setting.function_options.tab_switch_desc1')}<br />
|
|
|
- {t('admin:customize_setting.function_options.tab_switch_desc2')}
|
|
|
- </p>
|
|
|
- </CustomizeFunctionOption>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div className="form-group row">
|
|
|
+ <div className="offset-3 col-6 text-left">
|
|
|
+ <CustomizeFunctionOption
|
|
|
+ optionId="isSavedStatesOfTabChanges"
|
|
|
+ label={t('admin:customize_setting.function_options.tab_switch')}
|
|
|
+ isChecked={adminCustomizeContainer.state.isSavedStatesOfTabChanges}
|
|
|
+ onChecked={() => { adminCustomizeContainer.switchSavedStatesOfTabChanges() }}
|
|
|
+ >
|
|
|
+ <p className="form-text text-muted">
|
|
|
+ {t('admin:customize_setting.function_options.tab_switch_desc1')}<br />
|
|
|
+ {t('admin:customize_setting.function_options.tab_switch_desc2')}
|
|
|
+ </p>
|
|
|
+ </CustomizeFunctionOption>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- <div className="form-group row">
|
|
|
- <div className="col-xs-offset-3 col-xs-6 text-left">
|
|
|
- <CustomizeFunctionOption
|
|
|
- optionId="isEnabledAttachTitleHeader"
|
|
|
- label={t('admin:customize_setting.function_options.attach_title_header')}
|
|
|
- isChecked={adminCustomizeContainer.state.isEnabledAttachTitleHeader}
|
|
|
- onChecked={() => { adminCustomizeContainer.switchEnabledAttachTitleHeader() }}
|
|
|
- >
|
|
|
- <p className="help-block">
|
|
|
- {t('admin:customize_setting.function_options.attach_title_header_desc')}
|
|
|
- </p>
|
|
|
- </CustomizeFunctionOption>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div className="form-group row">
|
|
|
+ <div className="offset-3 col-6 text-left">
|
|
|
+ <CustomizeFunctionOption
|
|
|
+ optionId="isEnabledAttachTitleHeader"
|
|
|
+ label={t('admin:customize_setting.function_options.attach_title_header')}
|
|
|
+ isChecked={adminCustomizeContainer.state.isEnabledAttachTitleHeader}
|
|
|
+ onChecked={() => { adminCustomizeContainer.switchEnabledAttachTitleHeader() }}
|
|
|
+ >
|
|
|
+ <p className="form-text text-muted">
|
|
|
+ {t('admin:customize_setting.function_options.attach_title_header_desc')}
|
|
|
+ </p>
|
|
|
+ </CustomizeFunctionOption>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- <div className="form-group row">
|
|
|
- <div className="col-xs-offset-3 col-xs-6 text-left">
|
|
|
- <div className="my-0 btn-group">
|
|
|
- <label>{t('admin:customize_setting.function_options.recent_created__n_draft_num_desc')}</label>
|
|
|
- <div className="dropdown">
|
|
|
- <button className="btn btn-default dropdown-toggle w-100" type="button" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">
|
|
|
- <span className="pull-left">{adminCustomizeContainer.state.currentRecentCreatedLimit}</span>
|
|
|
- <span className="bs-caret pull-right">
|
|
|
- <span className="caret" />
|
|
|
- </span>
|
|
|
- </button>
|
|
|
- {/* TODO adjust dropdown after BS4 */}
|
|
|
- <ul className="dropdown-menu" role="menu">
|
|
|
- <li key={10} role="presentation" type="button" onClick={() => { adminCustomizeContainer.switchRecentCreatedLimit(10) }}>
|
|
|
- <a role="menuitem">10</a>
|
|
|
- </li>
|
|
|
- <li key={30} role="presentation" type="button" onClick={() => { adminCustomizeContainer.switchRecentCreatedLimit(30) }}>
|
|
|
- <a role="menuitem">30</a>
|
|
|
- </li>
|
|
|
- <li key={50} role="presentation" type="button" onClick={() => { adminCustomizeContainer.switchRecentCreatedLimit(50) }}>
|
|
|
- <a role="menuitem">50</a>
|
|
|
- </li>
|
|
|
- </ul>
|
|
|
+ <div className="form-group row">
|
|
|
+ <div className="offset-3 col-6 text-left">
|
|
|
+ <div className="my-0 w-100">
|
|
|
+ <label>{t('admin:customize_setting.function_options.recent_created__n_draft_num_desc')}</label>
|
|
|
+ </div>
|
|
|
+ <Dropdown isOpen={this.state.isDropdownOpen} toggle={this.onToggleDropdown}>
|
|
|
+ <DropdownToggle className="text-right col-6" caret>
|
|
|
+ <span className="float-left">{adminCustomizeContainer.state.currentRecentCreatedLimit}</span>
|
|
|
+ </DropdownToggle>
|
|
|
+ <DropdownMenu className="dropdown-menu" role="menu">
|
|
|
+ <DropdownItem key={10} role="presentation" onClick={() => { adminCustomizeContainer.switchRecentCreatedLimit(10) }}>
|
|
|
+ <a role="menuitem">10</a>
|
|
|
+ </DropdownItem>
|
|
|
+ <DropdownItem key={30} role="presentation" onClick={() => { adminCustomizeContainer.switchRecentCreatedLimit(30) }}>
|
|
|
+ <a role="menuitem">30</a>
|
|
|
+ </DropdownItem>
|
|
|
+ <DropdownItem key={50} role="presentation" onClick={() => { adminCustomizeContainer.switchRecentCreatedLimit(50) }}>
|
|
|
+ <a role="menuitem">50</a>
|
|
|
+ </DropdownItem>
|
|
|
+ </DropdownMenu>
|
|
|
+ </Dropdown>
|
|
|
+ <p className="form-text text-muted">
|
|
|
+ {t('admin:customize_setting.function_options.recently_created_n_draft_num_desc')}
|
|
|
+ </p>
|
|
|
</div>
|
|
|
- <p className="help-block">
|
|
|
- {t('admin:customize_setting.function_options.recently_created_n_draft_num_desc')}
|
|
|
- </p>
|
|
|
</div>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
|
|
|
- <div className="form-group row">
|
|
|
- <div className="col-xs-offset-3 col-xs-6 text-left">
|
|
|
- <CustomizeFunctionOption
|
|
|
- optionId="isEnabledStaleNotification"
|
|
|
- label={t('admin:customize_setting.function_options.stale_notification')}
|
|
|
- isChecked={adminCustomizeContainer.state.isEnabledStaleNotification}
|
|
|
- onChecked={() => { adminCustomizeContainer.switchEnableStaleNotification() }}
|
|
|
- >
|
|
|
- <p className="help-block">
|
|
|
- {t('admin:customize_setting.function_options.stale_notification_desc')}
|
|
|
- </p>
|
|
|
- </CustomizeFunctionOption>
|
|
|
- </div>
|
|
|
- </div>
|
|
|
+ <div className="form-group row">
|
|
|
+ <div className="offset-3 col-6 text-left">
|
|
|
+ <CustomizeFunctionOption
|
|
|
+ optionId="isEnabledStaleNotification"
|
|
|
+ label={t('admin:customize_setting.function_options.stale_notification')}
|
|
|
+ isChecked={adminCustomizeContainer.state.isEnabledStaleNotification}
|
|
|
+ onChecked={() => { adminCustomizeContainer.switchEnableStaleNotification() }}
|
|
|
+ >
|
|
|
+ <p className="form-text text-muted">
|
|
|
+ {t('admin:customize_setting.function_options.stale_notification_desc')}
|
|
|
+ </p>
|
|
|
+ </CustomizeFunctionOption>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
+
|
|
|
+ <div className="form-group row">
|
|
|
+ <div className="col-xs-offset-3 col-xs-6 text-left">
|
|
|
+ <CustomizeFunctionOption
|
|
|
+ optionId="isAllReplyShown"
|
|
|
+ label={t('admin:customize_setting.function_options.show_all_reply_comments')}
|
|
|
+ isChecked={adminCustomizeContainer.state.isAllReplyShown || false}
|
|
|
+ onChecked={() => { adminCustomizeContainer.switchIsAllReplyShown() }}
|
|
|
+ >
|
|
|
+ <p className="help-block">
|
|
|
+ {t('admin:customize_setting.function_options.show_all_reply_comments_desc')}
|
|
|
+ </p>
|
|
|
+ </CustomizeFunctionOption>
|
|
|
+ </div>
|
|
|
+ </div>
|
|
|
|
|
|
- <div className="form-group row">
|
|
|
- <div className="col-xs-offset-3 col-xs-6 text-left">
|
|
|
- <CustomizeFunctionOption
|
|
|
- optionId="isAllReplyShown"
|
|
|
- label={t('admin:customize_setting.function_options.show_all_reply_comments')}
|
|
|
- isChecked={adminCustomizeContainer.state.isAllReplyShown || false}
|
|
|
- onChecked={() => { adminCustomizeContainer.switchIsAllReplyShown() }}
|
|
|
- >
|
|
|
- <p className="help-block">
|
|
|
- {t('admin:customize_setting.function_options.show_all_reply_comments_desc')}
|
|
|
- </p>
|
|
|
- </CustomizeFunctionOption>
|
|
|
+ <AdminUpdateButtonRow onClick={this.onClickSubmit} disabled={adminCustomizeContainer.state.retrieveError != null} />
|
|
|
</div>
|
|
|
</div>
|
|
|
-
|
|
|
- <AdminUpdateButtonRow onClick={this.onClickSubmit} disabled={adminCustomizeContainer.state.retrieveError != null} />
|
|
|
</React.Fragment>
|
|
|
);
|
|
|
}
|