mirror of
https://github.com/ascribe/onion.git
synced 2024-12-22 17:33:14 +01:00
Merge remote-tracking branch 'remotes/origin/master' into AD-43-in-piece_detail-add-generic-field-
Conflicts: gulpfile.js added notifications cleaned up proptypes
This commit is contained in:
parent
30ee436f4c
commit
509aa111ab
@ -9,6 +9,9 @@ import ShareForm from '../ascribe_forms/form_share_email';
|
|||||||
import ModalWrapper from '../ascribe_modal/modal_wrapper';
|
import ModalWrapper from '../ascribe_modal/modal_wrapper';
|
||||||
import AppConstants from '../../constants/application_constants';
|
import AppConstants from '../../constants/application_constants';
|
||||||
|
|
||||||
|
import GlobalNotificationModel from '../../models/global_notification_model';
|
||||||
|
import GlobalNotificationActions from '../../actions/global_notification_actions';
|
||||||
|
|
||||||
let AclButton = React.createClass({
|
let AclButton = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
action: React.PropTypes.oneOf(AppConstants.aclList).isRequired,
|
action: React.PropTypes.oneOf(AppConstants.aclList).isRequired,
|
||||||
@ -23,31 +26,40 @@ let AclButton = React.createClass({
|
|||||||
return {
|
return {
|
||||||
title: 'Consign artwork',
|
title: 'Consign artwork',
|
||||||
tooltip: 'Have someone else sell the artwork',
|
tooltip: 'Have someone else sell the artwork',
|
||||||
form: <ConsignForm />
|
form: <ConsignForm />,
|
||||||
|
handleSuccess: this.showNotification
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (this.props.action === 'transfer') {
|
else if (this.props.action === 'transfer') {
|
||||||
return {
|
return {
|
||||||
title: 'Transfer artwork',
|
title: 'Transfer artwork',
|
||||||
tooltip: 'Transfer the ownership of the artwork',
|
tooltip: 'Transfer the ownership of the artwork',
|
||||||
form: <TransferForm />
|
form: <TransferForm />,
|
||||||
|
handleSuccess: this.showNotification
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (this.props.action === 'loan'){
|
else if (this.props.action === 'loan'){
|
||||||
return {
|
return {
|
||||||
title: 'Loan artwork',
|
title: 'Loan artwork',
|
||||||
tooltip: 'Loan your artwork for a limited period of time',
|
tooltip: 'Loan your artwork for a limited period of time',
|
||||||
form: <LoanForm />
|
form: <LoanForm />,
|
||||||
|
handleSuccess: this.showNotification
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
else if (this.props.action === 'share'){
|
else if (this.props.action === 'share'){
|
||||||
return {
|
return {
|
||||||
title: 'Share artwork',
|
title: 'Share artwork',
|
||||||
tooltip: 'Share the artwork',
|
tooltip: 'Share the artwork',
|
||||||
form: <ShareForm />
|
form: <ShareForm />,
|
||||||
|
handleSuccess: this.showNotification
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
showNotification(response){
|
||||||
|
this.props.handleSuccess();
|
||||||
|
let notification = new GlobalNotificationModel(response.notification, 'success');
|
||||||
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
},
|
||||||
render() {
|
render() {
|
||||||
let shouldDisplay = this.props.availableAcls.indexOf(this.props.action) > -1;
|
let shouldDisplay = this.props.availableAcls.indexOf(this.props.action) > -1;
|
||||||
let aclProps = this.actionProperties();
|
let aclProps = this.actionProperties();
|
||||||
@ -60,7 +72,7 @@ let AclButton = React.createClass({
|
|||||||
}
|
}
|
||||||
currentUser={ this.props.currentUser }
|
currentUser={ this.props.currentUser }
|
||||||
editions={ this.props.editions }
|
editions={ this.props.editions }
|
||||||
handleSuccess={ this.props.handleSuccess }
|
handleSuccess={ aclProps.handleSuccess }
|
||||||
title={ aclProps.title }
|
title={ aclProps.title }
|
||||||
tooltip={ aclProps.tooltip }>
|
tooltip={ aclProps.tooltip }>
|
||||||
{ aclProps.form }
|
{ aclProps.form }
|
||||||
|
@ -2,12 +2,13 @@
|
|||||||
|
|
||||||
import React from 'react';
|
import React from 'react';
|
||||||
|
|
||||||
/*
|
|
||||||
Is this even used somewhere?
|
|
||||||
Deprecate? 5.6.15 - Tim
|
|
||||||
|
|
||||||
*/
|
|
||||||
let ButtonSubmitOrClose = React.createClass({
|
let ButtonSubmitOrClose = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
submitted: React.PropTypes.bool.isRequired,
|
||||||
|
text: React.PropTypes.string.isRequired,
|
||||||
|
onClose: React.PropTypes.func.isRequired
|
||||||
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.props.submitted){
|
if (this.props.submitted){
|
||||||
return (
|
return (
|
||||||
|
@ -4,6 +4,10 @@ import React from 'react';
|
|||||||
import Alert from 'react-bootstrap/lib/Alert';
|
import Alert from 'react-bootstrap/lib/Alert';
|
||||||
|
|
||||||
let AlertDismissable = React.createClass({
|
let AlertDismissable = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
error: React.PropTypes.array.isRequired
|
||||||
|
},
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
alertVisible: true
|
alertVisible: true
|
||||||
@ -20,7 +24,6 @@ let AlertDismissable = React.createClass({
|
|||||||
|
|
||||||
render() {
|
render() {
|
||||||
if (this.state.alertVisible) {
|
if (this.state.alertVisible) {
|
||||||
let key = this.props.error;
|
|
||||||
return (
|
return (
|
||||||
<Alert bsStyle='danger' onDismiss={this.hide}>
|
<Alert bsStyle='danger' onDismiss={this.hide}>
|
||||||
{this.props.error}
|
{this.props.error}
|
||||||
|
@ -11,6 +11,7 @@ import ButtonSubmitOrClose from '../ascribe_buttons/button_submit_close';
|
|||||||
let ConsignForm = React.createClass({
|
let ConsignForm = React.createClass({
|
||||||
mixins: [FormMixin],
|
mixins: [FormMixin],
|
||||||
|
|
||||||
|
|
||||||
url() {
|
url() {
|
||||||
return ApiUrls.ownership_consigns;
|
return ApiUrls.ownership_consigns;
|
||||||
},
|
},
|
||||||
|
@ -5,6 +5,11 @@ import React from 'react';
|
|||||||
import AlertMixin from '../../mixins/alert_mixin';
|
import AlertMixin from '../../mixins/alert_mixin';
|
||||||
|
|
||||||
let InputCheckbox = React.createClass({
|
let InputCheckbox = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
submitted: React.PropTypes.bool.isRequired,
|
||||||
|
required: React.PropTypes.string.isRequired,
|
||||||
|
label: React.PropTypes.string.isRequired
|
||||||
|
},
|
||||||
|
|
||||||
mixins: [AlertMixin],
|
mixins: [AlertMixin],
|
||||||
|
|
||||||
|
@ -6,6 +6,10 @@ import AlertMixin from '../../mixins/alert_mixin';
|
|||||||
import DatePicker from 'react-datepicker/dist/react-datepicker';
|
import DatePicker from 'react-datepicker/dist/react-datepicker';
|
||||||
|
|
||||||
let InputDate = React.createClass({
|
let InputDate = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
submitted: React.PropTypes.bool,
|
||||||
|
placeholderText: React.PropTypes.string
|
||||||
|
},
|
||||||
|
|
||||||
mixins: [AlertMixin],
|
mixins: [AlertMixin],
|
||||||
|
|
||||||
@ -20,11 +24,10 @@ let InputDate = React.createClass({
|
|||||||
handleChange(date) {
|
handleChange(date) {
|
||||||
this.setState({
|
this.setState({
|
||||||
value: date,
|
value: date,
|
||||||
value_formatted: date.format("YYYY-MM-DD")});
|
value_formatted: date.format('YYYY-MM-DD')});
|
||||||
},
|
},
|
||||||
|
|
||||||
render: function () {
|
render: function () {
|
||||||
let className = 'form-control input-text-ascribe';
|
|
||||||
let alerts = (this.props.submitted) ? null : this.state.alerts;
|
let alerts = (this.props.submitted) ? null : this.state.alerts;
|
||||||
return (
|
return (
|
||||||
<div className="form-group">
|
<div className="form-group">
|
||||||
@ -37,24 +40,6 @@ let InputDate = React.createClass({
|
|||||||
placeholderText={this.props.placeholderText}/>
|
placeholderText={this.props.placeholderText}/>
|
||||||
</div>
|
</div>
|
||||||
);
|
);
|
||||||
// CAN THIS BE REMOVED???
|
|
||||||
//
|
|
||||||
// - Tim?
|
|
||||||
//
|
|
||||||
//return (
|
|
||||||
// <div className="input-group date"
|
|
||||||
// ref={this.props.name + "_picker"}
|
|
||||||
// onChange={this.handleChange}>
|
|
||||||
// <input className={className}
|
|
||||||
// ref={this.props.name}
|
|
||||||
// placeholder={this.props.placeholder}
|
|
||||||
// required={this.props.required}
|
|
||||||
// type="text"/>
|
|
||||||
// <span className="input-group-addon input-text-ascribe">
|
|
||||||
// <span className="glyphicon glyphicon-calendar" style={{"color": "black"}}></span>
|
|
||||||
// </span>
|
|
||||||
// </div>
|
|
||||||
//)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -5,6 +5,10 @@ import React from 'react';
|
|||||||
import AlertMixin from '../../mixins/alert_mixin';
|
import AlertMixin from '../../mixins/alert_mixin';
|
||||||
|
|
||||||
let InputHidden = React.createClass({
|
let InputHidden = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
submitted: React.PropTypes.bool,
|
||||||
|
value: React.PropTypes.string
|
||||||
|
},
|
||||||
|
|
||||||
mixins: [AlertMixin],
|
mixins: [AlertMixin],
|
||||||
|
|
||||||
|
@ -5,6 +5,13 @@ import React from 'react';
|
|||||||
import AlertMixin from '../../mixins/alert_mixin';
|
import AlertMixin from '../../mixins/alert_mixin';
|
||||||
|
|
||||||
let InputText = React.createClass({
|
let InputText = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
submitted: React.PropTypes.bool,
|
||||||
|
onBlur: React.PropTypes.func,
|
||||||
|
type: React.PropTypes.string,
|
||||||
|
required: React.PropTypes.string,
|
||||||
|
placeHolder: React.PropTypes.string
|
||||||
|
},
|
||||||
|
|
||||||
mixins: [AlertMixin],
|
mixins: [AlertMixin],
|
||||||
|
|
||||||
|
@ -5,6 +5,11 @@ import React from 'react';
|
|||||||
import AlertMixin from '../../mixins/alert_mixin';
|
import AlertMixin from '../../mixins/alert_mixin';
|
||||||
|
|
||||||
let InputTextArea = React.createClass({
|
let InputTextArea = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
submitted: React.PropTypes.bool,
|
||||||
|
required: React.PropTypes.string,
|
||||||
|
defaultValue: React.PropTypes.string
|
||||||
|
},
|
||||||
|
|
||||||
mixins: [AlertMixin],
|
mixins: [AlertMixin],
|
||||||
|
|
||||||
|
@ -8,6 +8,15 @@ import Button from 'react-bootstrap/lib/Button';
|
|||||||
|
|
||||||
let InputTextAreaToggable = React.createClass({
|
let InputTextAreaToggable = React.createClass({
|
||||||
|
|
||||||
|
propTypes: {
|
||||||
|
editable: React.PropTypes.bool.isRequired,
|
||||||
|
submitted: React.PropTypes.bool,
|
||||||
|
rows: React.PropTypes.number.isRequired,
|
||||||
|
onSubmit: React.PropTypes.func.isRequired,
|
||||||
|
required: React.PropTypes.string,
|
||||||
|
defaultValue: React.PropTypes.string
|
||||||
|
},
|
||||||
|
|
||||||
mixins: [AlertMixin],
|
mixins: [AlertMixin],
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
|
@ -11,6 +11,16 @@ import Tooltip from 'react-bootstrap/lib/Tooltip';
|
|||||||
import ModalMixin from '../../mixins/modal_mixin';
|
import ModalMixin from '../../mixins/modal_mixin';
|
||||||
|
|
||||||
let ModalWrapper = React.createClass({
|
let ModalWrapper = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
title: React.PropTypes.string.isRequired,
|
||||||
|
editions: React.PropTypes.array.isRequired,
|
||||||
|
currentUser: React.PropTypes.object.isRequired,
|
||||||
|
onRequestHide: React.PropTypes.func,
|
||||||
|
handleSuccess: React.PropTypes.func.isRequired,
|
||||||
|
button: React.PropTypes.object.isRequired,
|
||||||
|
children: React.PropTypes.object,
|
||||||
|
tooltip: React.PropTypes.string.isRequired
|
||||||
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return (
|
return (
|
||||||
@ -32,13 +42,21 @@ let ModalWrapper = React.createClass({
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
//
|
|
||||||
let ModalBody = React.createClass({
|
let ModalBody = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
editions: React.PropTypes.array,
|
||||||
|
currentUser: React.PropTypes.object,
|
||||||
|
onRequestHide: React.PropTypes.func,
|
||||||
|
handleSuccess: React.PropTypes.func,
|
||||||
|
children: React.PropTypes.object,
|
||||||
|
title: React.PropTypes.string.isRequired
|
||||||
|
},
|
||||||
|
|
||||||
mixins: [ModalMixin],
|
mixins: [ModalMixin],
|
||||||
|
|
||||||
handleSuccess(){
|
handleSuccess(response){
|
||||||
this.props.handleSuccess();
|
this.props.handleSuccess(response);
|
||||||
this.props.onRequestHide();
|
this.props.onRequestHide();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -93,7 +93,6 @@ let PieceListBulkModal = React.createClass({
|
|||||||
.forEach((pieceId) => {
|
.forEach((pieceId) => {
|
||||||
EditionListActions.fetchEditionList(pieceId, this.state.orderBy, this.state.orderAsc);
|
EditionListActions.fetchEditionList(pieceId, this.state.orderBy, this.state.orderAsc);
|
||||||
});
|
});
|
||||||
GlobalNotificationActions.updateGlobalNotification({message: 'Transfer successful'});
|
|
||||||
EditionListActions.clearAllEditionSelections();
|
EditionListActions.clearAllEditionSelections();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -73,6 +73,12 @@ let Edition = React.createClass({
|
|||||||
handleSuccess={this.props.loadEdition}
|
handleSuccess={this.props.loadEdition}
|
||||||
edition={this.props.edition}/>
|
edition={this.props.edition}/>
|
||||||
</CollapsibleEditionDetails>
|
</CollapsibleEditionDetails>
|
||||||
|
<CollapsibleEditionDetails
|
||||||
|
title="Further Details">
|
||||||
|
<EditionFurtherDetails
|
||||||
|
handleSuccess={this.props.loadEdition}
|
||||||
|
edition={this.props.edition}/>
|
||||||
|
</CollapsibleEditionDetails>
|
||||||
|
|
||||||
<CollapsibleEditionDetails
|
<CollapsibleEditionDetails
|
||||||
title="Provenance/Ownership History"
|
title="Provenance/Ownership History"
|
||||||
@ -310,12 +316,29 @@ let EditionDetailHistoryIterator = React.createClass({
|
|||||||
|
|
||||||
let EditionPersonalNote = React.createClass({
|
let EditionPersonalNote = React.createClass({
|
||||||
propTypes: {
|
propTypes: {
|
||||||
edition: React.PropTypes.object
|
edition: React.PropTypes.object,
|
||||||
|
handleSuccess: React.PropTypes.func
|
||||||
},
|
},
|
||||||
|
|
||||||
prepareSavePersonalNote() {
|
render() {
|
||||||
let personalNote = React.findDOMNode(this.refs.personalNote).value;
|
return (
|
||||||
this.props.savePersonalNote(personalNote);
|
<Row>
|
||||||
|
<Col md={12} className="ascribe-edition-personal-note">
|
||||||
|
<PersonalNoteForm
|
||||||
|
handleSuccess={this.props.handleSuccess}
|
||||||
|
editions={[this.props.edition]} />
|
||||||
|
</Col>
|
||||||
|
</Row>
|
||||||
|
);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
let EditionFurtherDetails = React.createClass({
|
||||||
|
propTypes: {
|
||||||
|
edition: React.PropTypes.object,
|
||||||
|
handleSuccess: React.PropTypes.func
|
||||||
},
|
},
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
|
@ -27,7 +27,10 @@ let PieceList = React.createClass({
|
|||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
let page = this.props.query.page || 1;
|
let page = this.props.query.page || 1;
|
||||||
PieceListStore.listen(this.onChange);
|
PieceListStore.listen(this.onChange);
|
||||||
PieceListActions.fetchPieceList(page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc);
|
if (this.state.pieceList.length === 0){
|
||||||
|
PieceListActions.fetchPieceList(page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc);
|
||||||
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
@ -6,6 +6,11 @@ import React from 'react';
|
|||||||
import AlertDismissable from '../components/ascribe_forms/alert';
|
import AlertDismissable from '../components/ascribe_forms/alert';
|
||||||
|
|
||||||
export const FormMixin = {
|
export const FormMixin = {
|
||||||
|
propTypes: {
|
||||||
|
editions: React.PropTypes.array,
|
||||||
|
currentUser: React.PropTypes.object
|
||||||
|
},
|
||||||
|
|
||||||
getInitialState() {
|
getInitialState() {
|
||||||
return {
|
return {
|
||||||
submitted: false,
|
submitted: false,
|
||||||
@ -21,7 +26,7 @@ export const FormMixin = {
|
|||||||
this.clearErrors();
|
this.clearErrors();
|
||||||
fetch
|
fetch
|
||||||
.post(this.url(), { body: this.getFormData() })
|
.post(this.url(), { body: this.getFormData() })
|
||||||
.then(() => this.handleSuccess() )
|
.then(this.handleSuccess)
|
||||||
.catch(this.handleError);
|
.catch(this.handleError);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -34,9 +39,9 @@ export const FormMixin = {
|
|||||||
}
|
}
|
||||||
this.setState({errors: []});
|
this.setState({errors: []});
|
||||||
},
|
},
|
||||||
handleSuccess(){
|
handleSuccess(response){
|
||||||
if ('handleSuccess' in this.props){
|
if ('handleSuccess' in this.props){
|
||||||
this.props.handleSuccess();
|
this.props.handleSuccess(response);
|
||||||
}
|
}
|
||||||
|
|
||||||
},
|
},
|
||||||
|
Loading…
Reference in New Issue
Block a user