From 2e7979a47e1104ef6095592326705c6aa0d24954 Mon Sep 17 00:00:00 2001 From: john <johnbarlas39@gmail.com> Date: Sat, 22 Apr 2017 16:20:22 +0300 Subject: [PATCH] make upload warning message dynamic --- app/components/BookBuilder/Chapter/UploadButton.jsx | 4 +++- app/components/BookBuilder/Chapter/UploadWarningModal.jsx | 7 +++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/app/components/BookBuilder/Chapter/UploadButton.jsx b/app/components/BookBuilder/Chapter/UploadButton.jsx index 697d7f0..cdb280d 100644 --- a/app/components/BookBuilder/Chapter/UploadButton.jsx +++ b/app/components/BookBuilder/Chapter/UploadButton.jsx @@ -75,13 +75,15 @@ export class UploadButton extends React.Component { if (!this.isLocked()) return null const { showModal } = this.state - const { modalContainer } = this.props + const { chapter, modalContainer } = this.props + const type = chapter.subCategory return ( <UploadWarningModal container={modalContainer} show={showModal} toggle={this.toggleModal} + type={type} /> ) } diff --git a/app/components/BookBuilder/Chapter/UploadWarningModal.jsx b/app/components/BookBuilder/Chapter/UploadWarningModal.jsx index 3f946bb..a8fe28f 100644 --- a/app/components/BookBuilder/Chapter/UploadWarningModal.jsx +++ b/app/components/BookBuilder/Chapter/UploadWarningModal.jsx @@ -4,9 +4,11 @@ import AbstractModal from '../../common/AbstractModal' class UploadWarningModal extends React.Component { renderBody () { + const { type } = this.props + return ( <div> - You are not allowed to import contents while a chapter is being edited. + You are not allowed to import contents while a { type } is being edited. </div> ) } @@ -31,7 +33,8 @@ class UploadWarningModal extends React.Component { UploadWarningModal.propTypes = { container: React.PropTypes.object.isRequired, show: React.PropTypes.bool.isRequired, - toggle: React.PropTypes.func.isRequired + toggle: React.PropTypes.func.isRequired, + type: React.PropTypes.string.isRequired } export default UploadWarningModal -- GitLab