mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
slide breadcrumbs
This commit is contained in:
parent
12dde0458c
commit
cf86e352e4
@ -4,11 +4,14 @@ import React from 'react';
|
|||||||
import Router from 'react-router';
|
import Router from 'react-router';
|
||||||
import ReactAddons from 'react/addons';
|
import ReactAddons from 'react/addons';
|
||||||
|
|
||||||
|
import Col from 'react-bootstrap/lib/Col';
|
||||||
|
|
||||||
let State = Router.State;
|
let State = Router.State;
|
||||||
let Navigation = Router.Navigation;
|
let Navigation = Router.Navigation;
|
||||||
|
|
||||||
let SlidesContainer = React.createClass({
|
let SlidesContainer = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
|
breadcrumbs: React.PropTypes.arrayOf(React.PropTypes.string),
|
||||||
children: React.PropTypes.arrayOf(React.PropTypes.element),
|
children: React.PropTypes.arrayOf(React.PropTypes.element),
|
||||||
forwardProcess: React.PropTypes.bool.isRequired
|
forwardProcess: React.PropTypes.bool.isRequired
|
||||||
},
|
},
|
||||||
@ -132,6 +135,35 @@ let SlidesContainer = React.createClass({
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
renderBreadCrumbs() {
|
||||||
|
if (this.props.breadcrumbs) {
|
||||||
|
let numSlides = this.props.breadcrumbs.length;
|
||||||
|
let columnWidth = Math.floor(12 / numSlides);
|
||||||
|
return (
|
||||||
|
<div className="row" style={{width: this.state.containerWidth}}>
|
||||||
|
<div className="col-md-8 col-md-offset-2 col-sm-10 col-sm-offset-1 col-xs-12">
|
||||||
|
<div className="no-margin row ascribe-breadcrumb-container">
|
||||||
|
{this.props.breadcrumbs.map((breadcrumb, i) => {
|
||||||
|
return (
|
||||||
|
<Col className="no-padding" sm={columnWidth}>
|
||||||
|
<div className="ascribe-breadcrumb">
|
||||||
|
<a className={this.state.slideNum === i ? 'active' : ''}>
|
||||||
|
{i + 1}. {this.props.breadcrumbs[i]}
|
||||||
|
<span className={i === numSlides - 1 ? 'invisible' : '' + 'pull-right glyphicon glyphicon-chevron-right'}>
|
||||||
|
</span>
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</Col>
|
||||||
|
);
|
||||||
|
})}
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
},
|
||||||
|
|
||||||
// Since we need to give the slides a width, we need to call ReactAddons.addons.cloneWithProps
|
// Since we need to give the slides a width, we need to call ReactAddons.addons.cloneWithProps
|
||||||
// Also, a key is nice to have!
|
// Also, a key is nice to have!
|
||||||
renderChildren() {
|
renderChildren() {
|
||||||
@ -151,15 +183,16 @@ let SlidesContainer = React.createClass({
|
|||||||
<div
|
<div
|
||||||
className="container ascribe-sliding-container-wrapper"
|
className="container ascribe-sliding-container-wrapper"
|
||||||
ref="containerWrapper">
|
ref="containerWrapper">
|
||||||
|
{this.renderBreadCrumbs()}
|
||||||
<div
|
<div
|
||||||
className="container ascribe-sliding-container"
|
className="container ascribe-sliding-container"
|
||||||
style={{
|
style={{
|
||||||
width: this.state.containerWidth * React.Children.count(this.props.children),
|
width: this.state.containerWidth * React.Children.count(this.props.children),
|
||||||
transform: 'translateX(' + (-1) * this.state.containerWidth * this.state.slideNum + 'px)'
|
transform: 'translateX(' + (-1) * this.state.containerWidth * this.state.slideNum + 'px)'
|
||||||
}}>
|
}}>
|
||||||
<div className="row">
|
<div className="row">
|
||||||
{this.renderChildren()}
|
{this.renderChildren()}
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
|
@ -80,14 +80,6 @@ let CylandAdditionalDataForm = React.createClass({
|
|||||||
<div className="ascribe-form-header">
|
<div className="ascribe-form-header">
|
||||||
<h3>Provide supporting materials</h3>
|
<h3>Provide supporting materials</h3>
|
||||||
</div>
|
</div>
|
||||||
<FurtherDetailsFileuploader
|
|
||||||
submitKey={this.submitKey}
|
|
||||||
setIsUploadReady={this.setIsUploadReady}
|
|
||||||
isReadyForFormSubmission={this.isReadyForFormSubmission}
|
|
||||||
editable={true}
|
|
||||||
pieceId={this.props.piece.id}
|
|
||||||
otherData={this.props.piece.other_data}
|
|
||||||
multiple={false}/>
|
|
||||||
<Property
|
<Property
|
||||||
name='artist_bio'
|
name='artist_bio'
|
||||||
label={getLangText('Artist Biography')}
|
label={getLangText('Artist Biography')}
|
||||||
@ -108,6 +100,14 @@ let CylandAdditionalDataForm = React.createClass({
|
|||||||
placeholder={getLangText('Enter a conceptual overview...')}
|
placeholder={getLangText('Enter a conceptual overview...')}
|
||||||
required="required"/>
|
required="required"/>
|
||||||
</Property>
|
</Property>
|
||||||
|
<FurtherDetailsFileuploader
|
||||||
|
submitKey={this.submitKey}
|
||||||
|
setIsUploadReady={this.setIsUploadReady}
|
||||||
|
isReadyForFormSubmission={this.isReadyForFormSubmission}
|
||||||
|
editable={true}
|
||||||
|
pieceId={this.props.piece.id}
|
||||||
|
otherData={this.props.piece.other_data}
|
||||||
|
multiple={false}/>
|
||||||
</Form>
|
</Form>
|
||||||
);
|
);
|
||||||
} else {
|
} else {
|
||||||
|
@ -102,6 +102,13 @@ let CylandRegisterPiece = React.createClass({
|
|||||||
this.refs.slidesContainer.setSlideNum(2);
|
this.refs.slidesContainer.setSlideNum(2);
|
||||||
},
|
},
|
||||||
|
|
||||||
|
handleLoanSuccess(response) {
|
||||||
|
let notification = new GlobalNotificationModel(response.notification, 'success', 10000);
|
||||||
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
|
||||||
|
this.transitionTo('piece', {pieceId: this.state.piece.id});
|
||||||
|
},
|
||||||
|
|
||||||
changeSlide() {
|
changeSlide() {
|
||||||
// only transition to the login store, if user is not logged in
|
// only transition to the login store, if user is not logged in
|
||||||
// ergo the currentUser object is not properly defined
|
// ergo the currentUser object is not properly defined
|
||||||
@ -124,6 +131,7 @@ let CylandRegisterPiece = React.createClass({
|
|||||||
return (
|
return (
|
||||||
<SlidesContainer
|
<SlidesContainer
|
||||||
ref="slidesContainer"
|
ref="slidesContainer"
|
||||||
|
breadcrumbs={['Register work', 'Additional Details', 'Loan']}
|
||||||
forwardProcess={true}>
|
forwardProcess={true}>
|
||||||
<div>
|
<div>
|
||||||
<Row className="no-margin">
|
<Row className="no-margin">
|
||||||
@ -173,7 +181,8 @@ let CylandRegisterPiece = React.createClass({
|
|||||||
gallery="Cyland Archive"
|
gallery="Cyland Archive"
|
||||||
startdate={today}
|
startdate={today}
|
||||||
enddate={datetimeWhenWeAllWillBeFlyingCoolHoverboardsAndDinosaursWillLiveAgain}
|
enddate={datetimeWhenWeAllWillBeFlyingCoolHoverboardsAndDinosaursWillLiveAgain}
|
||||||
showPersonalMessage={false}/>
|
showPersonalMessage={false}
|
||||||
|
handleSuccess={this.handleLoanSuccess}/>
|
||||||
</Col>
|
</Col>
|
||||||
</Row>
|
</Row>
|
||||||
</div>
|
</div>
|
||||||
|
@ -15,4 +15,30 @@
|
|||||||
position: relative;
|
position: relative;
|
||||||
min-height: 1px;
|
min-height: 1px;
|
||||||
float:left;
|
float:left;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
.ascribe-breadcrumb-container{
|
||||||
|
div:last-child {
|
||||||
|
.ascribe-breadcrumb {
|
||||||
|
border-right: 1px solid #EEE;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
.ascribe-breadcrumb {
|
||||||
|
padding: 1em;
|
||||||
|
border: 1px solid #EEE;
|
||||||
|
border-right: 1px solid rgba(0, 0, 0, 0);
|
||||||
|
margin-bottom: 0.6em;
|
||||||
|
|
||||||
|
.active {
|
||||||
|
color: #666;
|
||||||
|
}
|
||||||
|
a {
|
||||||
|
color: #DDD;
|
||||||
|
text-decoration: none;
|
||||||
|
font-size: 1.1em;
|
||||||
|
font-style: italic;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user