1
0
mirror of https://github.com/ascribe/onion.git synced 2025-01-03 18:35:09 +01:00

Merge pull request #49 from ascribe/AD-1149-final-changes

AD-1149 Final Changes
This commit is contained in:
Brett Sun 2015-12-07 10:25:25 +01:00
commit c3c493dc48
18 changed files with 92 additions and 62 deletions

View File

@ -78,7 +78,6 @@ let AccordionListItemEditionWidget = React.createClass({
return ( return (
<AscribeSpinner <AscribeSpinner
size='sm' size='sm'
color='white'
classNames='pull-right margin-left-2px'/> classNames='pull-right margin-left-2px'/>
); );
} else { } else {

View File

@ -2,7 +2,7 @@
import React from 'react'; import React from 'react';
let accordionListItemThumbnailPlaceholder = React.createClass({ let AccordionListItemThumbnailPlaceholder = React.createClass({
render() { render() {
return ( return (
<span className="ascribe-logo-circle"> <span className="ascribe-logo-circle">
@ -12,4 +12,4 @@ let accordionListItemThumbnailPlaceholder = React.createClass({
} }
}); });
export default accordionListItemThumbnailPlaceholder; export default AccordionListItemThumbnailPlaceholder;

View File

@ -195,7 +195,7 @@ let EditionSummary = React.createClass({
getStatus(){ getStatus(){
let status = null; let status = null;
if (this.props.edition.status.length > 0){ if (this.props.edition.status.length > 0){
let statusStr = this.props.edition.status.join().replace(/_/, ' '); let statusStr = this.props.edition.status.join(', ').replace(/_/g, ' ');
status = <EditionDetailProperty label="STATUS" value={ statusStr }/>; status = <EditionDetailProperty label="STATUS" value={ statusStr }/>;
if (this.props.edition.pending_new_owner && this.props.edition.acl.acl_withdraw_transfer){ if (this.props.edition.pending_new_owner && this.props.edition.acl.acl_withdraw_transfer){
status = ( status = (

View File

@ -94,8 +94,10 @@ let EditionActionPanel = React.createClass({
}, },
render(){ render(){
let { edition, currentUser } = this.props; const {
let ActionPanelButtonListType = this.props.actionPanelButtonListType; actionPanelButtonListType: ActionPanelButtonListType,
edition,
currentUser } = this.props;
if (edition && if (edition &&
edition.notifications && edition.notifications &&

View File

@ -37,7 +37,7 @@ let ConsignForm = React.createClass({
getInitialState() { getInitialState() {
return { return {
email: this.props.email email: this.props.email || ''
}; };
}, },
@ -69,7 +69,7 @@ let ConsignForm = React.createClass({
ref='form' ref='form'
url={url} url={url}
getFormData={this.getFormData} getFormData={this.getFormData}
handleSuccess={this.props.handleSuccess} handleSuccess={handleSuccess}
buttons={ buttons={
<div className="modal-footer"> <div className="modal-footer">
<p className="pull-right"> <p className="pull-right">

View File

@ -210,7 +210,7 @@ let LoanForm = React.createClass({
<input <input
type="password" type="password"
placeholder={getLangText('Enter your password')} placeholder={getLangText('Enter your password')}
required={showPassword ? 'required' : ''}/> required={showPassword}/>
</Property> </Property>
{children} {children}
</Form> </Form>

View File

@ -53,12 +53,10 @@ const InputContractAgreementCheckbox = React.createClass({
}, },
componentWillReceiveProps({ email: nextEmail }) { componentWillReceiveProps({ email: nextEmail }) {
const { contractAgreementList } = this.state;
if (this.props.email !== nextEmail) { if (this.props.email !== nextEmail) {
if (isEmail(nextEmail)) { if (isEmail(nextEmail)) {
this.getContractAgreementsOrCreatePublic(nextEmail); this.getContractAgreementsOrCreatePublic(nextEmail);
} else if (contractAgreementList && contractAgreementList.length > 0) { } else if (this.getContractAgreement()) {
ContractAgreementListActions.flushContractAgreementList(); ContractAgreementListActions.flushContractAgreementList();
} }
} }
@ -70,6 +68,8 @@ const InputContractAgreementCheckbox = React.createClass({
onStoreChange(state) { onStoreChange(state) {
const contractAgreement = this.getContractAgreement(state.contractAgreementList); const contractAgreement = this.getContractAgreement(state.contractAgreementList);
// If there is no contract available, hide this `Property` from the user
this.props.setExpanded(!!contractAgreement); this.props.setExpanded(!!contractAgreement);
state = mergeOptions(state, { state = mergeOptions(state, {
@ -97,16 +97,21 @@ const InputContractAgreementCheckbox = React.createClass({
}, },
onChange(event) { onChange(event) {
// Sync the value between our `InputCheckbox` and this component's `terms`
// so the parent `Property` is able to get the correct value of this component
// when the `Form` queries it.
this.setState({ this.setState({
value: React.addons.update(this.state.value, { value: React.addons.update(this.state.value, {
terms: { $set: event.target.value } terms: { $set: event.target.value }
}) })
}); });
// Propagate change events from the checkbox up to the parent `Property`
this.props.onChange(event); this.props.onChange(event);
}, },
getContractAgreement(contractAgreementList = this.state.contractAgreementList) { getContractAgreement(contractAgreementList = this.state.contractAgreementList) {
if (contractAgreementList && contractAgreementList.length > 0) { if (contractAgreementList && contractAgreementList.length) {
return contractAgreementList[0]; return contractAgreementList[0];
} }
}, },

View File

@ -96,18 +96,21 @@ const InputFineUploader = React.createClass({
}, },
render() { render() {
const { fileInputElement, const {
keyRoutine,
createBlobRoutine,
validation,
setIsUploadReady,
isReadyForFormSubmission,
areAssetsDownloadable, areAssetsDownloadable,
enableLocalHashing, enableLocalHashing,
uploadMethod, createBlobRoutine,
disabled,
fileClassToUpload, fileClassToUpload,
disabled } = this.props; fileInputElement,
let editable = this.props.isFineUploaderActive; isFineUploaderActive,
isReadyForFormSubmission,
keyRoutine,
setIsUploadReady,
uploadMethod,
validation } = this.props;
let editable = isFineUploaderActive;
// if disabled is actually set by property, we want to override // if disabled is actually set by property, we want to override
// isFineUploaderActive // isFineUploaderActive

View File

@ -239,6 +239,10 @@ const Property = React.createClass({
this.setState({ expanded }); this.setState({ expanded });
}, },
handleCheckboxToggle() {
this.setExpanded(!this.state.expanded);
},
renderChildren(style) { renderChildren(style) {
// Input's props should only be cloned and propagated down the tree, // Input's props should only be cloned and propagated down the tree,
// if the component is actually being shown (!== 'expanded === false') // if the component is actually being shown (!== 'expanded === false')
@ -280,10 +284,6 @@ const Property = React.createClass({
} }
}, },
handleCheckboxToggle() {
this.setState({expanded: !this.state.expanded});
},
getCheckbox() { getCheckbox() {
const { checkboxLabel } = this.props; const { checkboxLabel } = this.props;

View File

@ -30,7 +30,7 @@ let PieceListBulkModal = React.createClass({
}, },
render() { render() {
if (Object.keys(this.props.availableAcls).length > 0) { if (Object.keys(this.props.availableAcls).length) {
return ( return (
<div className={this.props.className}> <div className={this.props.className}>
<div className="row no-margin"> <div className="row no-margin">

View File

@ -7,26 +7,26 @@ let AscribeSpinner = React.createClass({
propTypes: { propTypes: {
classNames: React.PropTypes.string, classNames: React.PropTypes.string,
size: React.PropTypes.oneOf(['sm', 'md', 'lg']), size: React.PropTypes.oneOf(['sm', 'md', 'lg']),
color: React.PropTypes.oneOf(['blue', 'dark-blue', 'light-blue', 'pink', 'black', 'loop']) color: React.PropTypes.oneOf(['black', 'blue', 'dark-blue', 'light-blue', 'pink', 'white', 'loop'])
}, },
getDefaultProps() { getDefaultProps() {
return { return {
inline: false, inline: false,
size: 'md', size: 'md'
color: 'loop'
}; };
}, },
render() { render() {
const { classNames: classes, color, size } = this.props;
return ( return (
<div <div
className={ className={classNames('spinner-wrapper-' + size,
classNames('spinner-wrapper-' + this.props.size, color ? 'spinner-wrapper-' + color : null,
'spinner-wrapper-' + this.props.color, classes)}>
this.props.classNames)}> <div className='spinner-circle' />
<div className={classNames('spinner-circle')}></div> <div className='spinner-inner'>A</div>
<div className={classNames('spinner-inner')}>A</div>
</div> </div>
); );
} }

View File

@ -6,7 +6,7 @@ import Vivi23AccordionListItemThumbnailPlaceholder from './23vivi_accordion_list
import MarketPieceList from '../market/market_piece_list'; import MarketPieceList from '../market/market_piece_list';
let vivi23PieceList = React.createClass({ let Vivi23PieceList = React.createClass({
propTypes: { propTypes: {
location: React.PropTypes.object location: React.PropTypes.object
}, },
@ -21,4 +21,4 @@ let vivi23PieceList = React.createClass({
}); });
export default vivi23PieceList; export default Vivi23PieceList;

View File

@ -144,8 +144,7 @@ let MarketSubmitButton = React.createClass({
} else { } else {
return ( return (
<AclProxy <AclProxy
aclObject={{'acl_consign': availableAcls.acl_consign && canSubmit}} show={availableAcls.acl_consign && canSubmit}>
aclName='acl_consign'>
<ModalWrapper <ModalWrapper
trigger={triggerButton} trigger={triggerButton}
handleSuccess={handleSuccess} handleSuccess={handleSuccess}

View File

@ -32,6 +32,7 @@ let MarketAdditionalDataForm = React.createClass({
React.PropTypes.number, React.PropTypes.number,
React.PropTypes.string React.PropTypes.string
]), ]),
editable: React.PropTypes.bool,
isInline: React.PropTypes.bool, isInline: React.PropTypes.bool,
showHeading: React.PropTypes.bool, showHeading: React.PropTypes.bool,
showNotification: React.PropTypes.bool, showNotification: React.PropTypes.bool,
@ -41,6 +42,7 @@ let MarketAdditionalDataForm = React.createClass({
getDefaultProps() { getDefaultProps() {
return { return {
editable: true,
submitLabel: getLangText('Register work') submitLabel: getLangText('Register work')
}; };
}, },
@ -53,7 +55,7 @@ let MarketAdditionalDataForm = React.createClass({
{ {
// Allow the form to be submitted if there's already an additional image uploaded // Allow the form to be submitted if there's already an additional image uploaded
isUploadReady: this.isUploadReadyOnChange(pieceStore.piece), isUploadReady: this.isUploadReadyOnChange(pieceStore.piece),
forceUpdateKey: 0, forceUpdateKey: 0
}); });
}, },
@ -70,9 +72,7 @@ let MarketAdditionalDataForm = React.createClass({
}, },
onChange(state) { onChange(state) {
this.setState(state); Object.assign({}, state, {
this.setState({
// Allow the form to be submitted if the updated piece already has an additional image uploaded // Allow the form to be submitted if the updated piece already has an additional image uploaded
isUploadReady: this.isUploadReadyOnChange(state.piece), isUploadReady: this.isUploadReadyOnChange(state.piece),
@ -85,6 +85,8 @@ let MarketAdditionalDataForm = React.createClass({
*/ */
forceUpdateKey: this.state.forceUpdateKey + 1 forceUpdateKey: this.state.forceUpdateKey + 1
}); });
this.setState(state);
}, },
getFormData() { getFormData() {
@ -130,9 +132,11 @@ let MarketAdditionalDataForm = React.createClass({
}, },
render() { render() {
const { isInline, handleSuccess, showHeading, showNotification, submitLabel } = this.props; const { editable, isInline, handleSuccess, showHeading, showNotification, submitLabel } = this.props;
const { piece } = this.state; const { piece } = this.state;
let buttons, spinner, heading; let buttons, heading;
let spinner = <AscribeSpinner color='dark-blue' size='lg' />;
if (!isInline) { if (!isInline) {
buttons = ( buttons = (
@ -146,7 +150,9 @@ let MarketAdditionalDataForm = React.createClass({
spinner = ( spinner = (
<div className="modal-footer"> <div className="modal-footer">
<img src={AppConstants.baseUrl + 'static/img/ascribe_animated_small.gif'} /> <p className="pull-right">
{spinner}
</p>
</div> </div>
); );
@ -169,7 +175,8 @@ let MarketAdditionalDataForm = React.createClass({
handleSuccess={showNotification ? this.handleSuccessWithNotification : handleSuccess} handleSuccess={showNotification ? this.handleSuccessWithNotification : handleSuccess}
getFormData={this.getFormData} getFormData={this.getFormData}
buttons={buttons} buttons={buttons}
spinner={spinner}> spinner={spinner}
disabled={!this.props.editable || !piece.acl.acl_edit}>
{heading} {heading}
<FurtherDetailsFileuploader <FurtherDetailsFileuploader
label={getLangText('Marketplace Thumbnail Image')} label={getLangText('Marketplace Thumbnail Image')}
@ -178,10 +185,12 @@ let MarketAdditionalDataForm = React.createClass({
setIsUploadReady={this.setIsUploadReady} setIsUploadReady={this.setIsUploadReady}
isReadyForFormSubmission={formSubmissionValidation.atLeastOneUploadedFile} isReadyForFormSubmission={formSubmissionValidation.atLeastOneUploadedFile}
pieceId={piece.id} pieceId={piece.id}
otherData={piece.other_data} /> otherData={piece.other_data}
editable={editable} />
<Property <Property
name='artist_bio' name='artist_bio'
label={getLangText('Artist Bio')}> label={getLangText('Artist Bio')}
expanded={editable || !!piece.extra_data.artist_bio}>
<InputTextAreaToggable <InputTextAreaToggable
rows={1} rows={1}
defaultValue={piece.extra_data.artist_bio} defaultValue={piece.extra_data.artist_bio}
@ -190,7 +199,8 @@ let MarketAdditionalDataForm = React.createClass({
</Property> </Property>
<Property <Property
name='work_description' name='work_description'
label={getLangText('Work Description')}> label={getLangText('Work Description')}
expanded={editable || !!piece.extra_data.work_description}>
<InputTextAreaToggable <InputTextAreaToggable
rows={1} rows={1}
defaultValue={piece.extra_data.work_description} defaultValue={piece.extra_data.work_description}
@ -199,7 +209,8 @@ let MarketAdditionalDataForm = React.createClass({
</Property> </Property>
<Property <Property
name='technology_details' name='technology_details'
label={getLangText('Technology Details')}> label={getLangText('Technology Details')}
expanded={editable || !!piece.extra_data.technology_details}>
<InputTextAreaToggable <InputTextAreaToggable
rows={1} rows={1}
defaultValue={piece.extra_data.technology_details} defaultValue={piece.extra_data.technology_details}
@ -208,7 +219,8 @@ let MarketAdditionalDataForm = React.createClass({
</Property> </Property>
<Property <Property
name='display_instructions' name='display_instructions'
label={getLangText('Display Instructions')}> label={getLangText('Display Instructions')}
expanded={editable || !!piece.extra_data.display_instructions}>
<InputTextAreaToggable <InputTextAreaToggable
rows={1} rows={1}
defaultValue={piece.extra_data.display_instructions} defaultValue={piece.extra_data.display_instructions}
@ -220,7 +232,7 @@ let MarketAdditionalDataForm = React.createClass({
} else { } else {
return ( return (
<div className="ascribe-loading-position"> <div className="ascribe-loading-position">
<AscribeSpinner color='dark-blue' size='lg' /> {spinner}
</div> </div>
); );
} }

View File

@ -82,7 +82,7 @@ let MarketRegisterPiece = React.createClass({
handleAdditionalDataSuccess() { handleAdditionalDataSuccess() {
this.refreshPieceList(); this.refreshPieceList();
this.history.pushState(null, `/collection`); this.history.pushState(null, '/collection');
}, },
// We need to increase the step to lock the forms that are already filled out // We need to increase the step to lock the forms that are already filled out

View File

@ -52,6 +52,13 @@ $ascribe--spinner-size-sm: 15px;
} }
} }
.spinner-wrapper-white {
color: $ascribe-white;
.spinner-circle {
border-color: $ascribe-white;
}
}
.spinner-wrapper-lg { .spinner-wrapper-lg {
width: $ascribe--spinner-size-lg; width: $ascribe--spinner-size-lg;
height: $ascribe--spinner-size-lg; height: $ascribe--spinner-size-lg;

View File

@ -331,6 +331,9 @@ $vivi23--highlight-color: #de2600;
.spinner-inner { .spinner-inner {
display: none; display: none;
} }
.btn-secondary .spinner-circle {
border-color: $vivi23--bg-color;
}
// video player // video player
.ascribe-media-player .vjs-default-skin { .ascribe-media-player .vjs-default-skin {