@@ -11,7 +11,7 @@ const PasswordReset = require('../forms/PasswordReset');
1111const Message = require ( '../../../components/I18N/Message' ) ;
1212const { Modal, Button, Glyphicon} = require ( 'react-bootstrap' ) ;
1313
14- const Dialog = require ( '../../../components/ misc/Dialog' ) ;
14+ const Dialog = require ( '../../misc/Dialog' ) ;
1515const assign = require ( 'object-assign' ) ;
1616
1717const Spinner = require ( 'react-spinkit' ) ;
@@ -26,6 +26,8 @@ const PasswordResetModal = React.createClass({
2626 authHeader : React . PropTypes . string ,
2727 show : React . PropTypes . bool ,
2828 options : React . PropTypes . object ,
29+
30+
2931 onPasswordChange : React . PropTypes . func ,
3032 onPasswordChanged : React . PropTypes . func ,
3133 onClose : React . PropTypes . func ,
@@ -75,8 +77,8 @@ const PasswordResetModal = React.createClass({
7577 renderLoading ( ) {
7678 return this . state . loading ? < Spinner spinnerName = "circle" key = "loadingSpinner" noFadeIn /> : null ;
7779 } ,
78- render ( ) {
79- const footer = ( < span role = "footer" > < div style = { { "float" : "left" } } > { this . renderLoading ( ) } </ div >
80+ getFooter ( ) {
81+ return ( < span role = "footer" > < div style = { { "float" : "left" } } > { this . renderLoading ( ) } </ div >
8082 < Button
8183 ref = "passwordChangeButton"
8284 key = "passwordChangeButton"
@@ -93,28 +95,36 @@ const PasswordResetModal = React.createClass({
9395 bsSize = { this . props . buttonSize }
9496 onClick = { this . props . onClose } > < Message msgId = "close" /> </ Button > : < span /> }
9597 </ span > ) ;
96- const body = ( < PasswordReset role = "body" ref = "passwordResetForm"
98+ } ,
99+ getBody ( ) {
100+ return ( < PasswordReset role = "body" ref = "passwordResetForm"
97101 onChange = { ( ) => {
98102 this . setState ( { passwordValid : this . refs . passwordResetForm . isValid ( ) } ) ;
99103 } } /> ) ;
100- return this . props . useModal ? (
104+ } ,
105+ renderModal ( ) {
106+ return (
101107 < Modal { ...this . props . options } show = { this . props . show } onHide = { this . props . onClose } >
102108 < Modal . Header key = "passwordChange" closeButton >
103109 < Modal . Title > < Message msgId = "user.changePwd" /> </ Modal . Title >
104110 </ Modal . Header >
105111 < Modal . Body >
106- { body }
112+ { this . getBody ( ) }
107113 </ Modal . Body >
108114 < Modal . Footer >
109- { footer }
115+ { this . getFooter ( ) }
110116 </ Modal . Footer >
111- </ Modal > ) : (
112- < Dialog id = "mapstore-changepassword-panel" style = { assign ( { } , this . props . style , { display : this . props . show ? "block" : "none" } ) } >
117+ </ Modal > ) ;
118+ } ,
119+ renderDialog ( ) {
120+ return ( this . props . show ) ? ( < Dialog modal id = "mapstore-changepassword-panel" style = { assign ( { } , this . props . style , { display : "block" } ) } >
113121 < span role = "header" > < span className = "changepassword-panel-title" > < Message msgId = "user.changePwd" /> </ span > < button onClick = { this . props . onClose } className = "login-panel-close close" > { this . props . closeGlyph ? < Glyphicon glyph = { this . props . closeGlyph } /> : < span > ×</ span > } </ button > </ span >
114- { body }
115- { footer }
116- </ Dialog >
117- ) ;
122+ { this . getBody ( ) }
123+ { this . getFooter ( ) }
124+ </ Dialog > ) : null ;
125+ } ,
126+ render ( ) {
127+ return this . props . useModal ? this . renderModal ( ) : this . renderDialog ( ) ;
118128 }
119129} ) ;
120130
0 commit comments