1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 00:28:00 +02:00

add functionality to make a forwarded process slide container

This commit is contained in:
Tim Daubenschütz 2015-08-12 16:11:15 +02:00
parent d3bf990ca5
commit 0cf5815f42
6 changed files with 24 additions and 19 deletions

View File

@ -140,7 +140,7 @@ let LoanForm = React.createClass({
<div className="modal-footer">
<img src={AppConstants.baseUrl + 'static/img/ascribe_animated_small.gif'} />
</div>}>
<div className={classnames({'ascribe-form-header': true, 'hidden': !!this.props.loanHeading})}>
<div className={classnames({'ascribe-form-header': true, 'hidden': !this.props.loanHeading})}>
<h3>{this.props.loanHeading}</h3>
</div>
<Property

View File

@ -9,7 +9,8 @@ let Navigation = Router.Navigation;
let SlidesContainer = React.createClass({
propTypes: {
children: React.PropTypes.arrayOf(React.PropTypes.element)
children: React.PropTypes.arrayOf(React.PropTypes.element),
forwardProcess: React.PropTypes.bool.isRequired
},
mixins: [State, Navigation],
@ -108,13 +109,17 @@ let SlidesContainer = React.createClass({
// we push a new state on it ONCE (ever).
// Otherwise, we're able to use the browsers history.forward() method
// to keep the stack clean
if(this.state.historyLength === window.history.length) {
if(this.props.forwardProcess) {
queryParams.slide_num = slideNum;
this.transitionTo(this.getPathname(), null, queryParams);
} else {
window.history.forward();
if(this.state.historyLength === window.history.length) {
queryParams.slide_num = slideNum;
this.transitionTo(this.getPathname(), null, queryParams);
} else {
window.history.forward();
}
}
}

View File

@ -103,7 +103,7 @@ let Header = React.createClass({
);
collection = <NavItemLink to="pieces" query={this.getQuery()}>{getLangText('COLLECTION')}</NavItemLink>;
addNewWork = this.props.showAddWork ? <NavItemLink to="register_piece">+ {getLangText('NEW WORK')}</NavItemLink> : null;
addNewWork = this.props.showAddWork ? <NavItemLink to="register_piece" query={{'slide_num': 0}}>+ {getLangText('NEW WORK')}</NavItemLink> : null;
}
else {
account = <NavItemLink to="login">{getLangText('LOGIN')}</NavItemLink>;

View File

@ -117,7 +117,8 @@ let RegisterPiece = React.createClass( {
}
},
changeSlide() {
// basically redirects to the second slide (index: 1), when the user is not logged in
onLoggedOut() {
// only transition to the login store, if user is not logged in
// ergo the currentUser object is not properly defined
if(this.state.currentUser && !this.state.currentUser.email) {
@ -125,11 +126,6 @@ let RegisterPiece = React.createClass( {
}
},
// basically redirects to the second slide (index: 1), when the user is not logged in
onLoggedOut() {
this.refs.slidesContainer.setSlideNum(1);
},
onLogin() {
// once the currentUser object from UserStore is defined (eventually the user was transitioned
// to the login form via the slider and successfully logged in), we can direct him back to the
@ -141,10 +137,12 @@ let RegisterPiece = React.createClass( {
render() {
return (
<SlidesContainer ref="slidesContainer">
<SlidesContainer
ref="slidesContainer"
forwardProcess={false}>
<div
onClick={this.changeSlide}
onFocus={this.changeSlide}>
onClick={this.onLoggedOut}
onFocus={this.onLoggedOut}>
<Row className="no-margin">
<Col xs={12} sm={10} md={8} smOffset={1} mdOffset={2}>
<RegisterPieceForm

View File

@ -78,7 +78,7 @@ let CylandAdditionalDataForm = React.createClass({
</div>
}>
<div className="ascribe-form-header">
<h3>Additional Information</h3>
<h3>Provide supporting materials</h3>
</div>
<FurtherDetailsFileuploader
submitKey={this.submitKey}

View File

@ -122,7 +122,9 @@ let CylandRegisterPiece = React.createClass({
datetimeWhenWeAllWillBeFlyingCoolHoverboardsAndDinosaursWillLiveAgain.add(1000, 'years');
return (
<SlidesContainer ref="slidesContainer">
<SlidesContainer
ref="slidesContainer"
forwardProcess={true}>
<div>
<Row className="no-margin">
<Col xs={12} sm={10} md={8} smOffset={1} mdOffset={2}>
@ -139,7 +141,7 @@ let CylandRegisterPiece = React.createClass({
style={{paddingBottom: 0}}>
<InputCheckbox>
<span>
{' ' + getLangText('I agree to the Terms of Service the art price') + ' '}
{' ' + getLangText('I agree to the Terms of Service of Cyland Archive') + ' '}
(<a href="https://s3-us-west-2.amazonaws.com/ascribe0/whitelabel/cyland/terms_and_contract.pdf" target="_blank" style={{fontSize: '0.9em', color: 'rgba(0,0,0,0.7)'}}>
{getLangText('read')}
</a>)