1
0
mirror of https://github.com/ascribe/onion.git synced 2024-12-23 01:39:36 +01:00

Revert "Add consign error to market white labels"

This reverts commit cb972eb448.
Unfortunately, the edition's `acl_edit` can still be true when
the piece's `acl_edit` is false, so there is no good way on
the frontend right now to tell when to show the error message.

For now we'll assume submissions to marketplaces are all new
and ignore this edge case.
This commit is contained in:
Brett Sun 2015-12-07 10:17:42 +01:00
parent cb972eb448
commit 41ef51c478
3 changed files with 19 additions and 103 deletions

View File

@ -3,8 +3,6 @@
import React from 'react'; import React from 'react';
import classNames from 'classnames'; import classNames from 'classnames';
import MarketConsignError from '../market_consign_error';
import MarketAdditionalDataForm from '../market_forms/market_additional_data_form'; import MarketAdditionalDataForm from '../market_forms/market_additional_data_form';
import AclFormFactory from '../../../../../ascribe_forms/acl_form_factory'; import AclFormFactory from '../../../../../ascribe_forms/acl_form_factory';
@ -14,7 +12,6 @@ import ModalWrapper from '../../../../../ascribe_modal/modal_wrapper';
import AclProxy from '../../../../../acl_proxy'; import AclProxy from '../../../../../acl_proxy';
import EditionListActions from '../../../../../../actions/edition_list_actions';
import PieceActions from '../../../../../../actions/piece_actions'; import PieceActions from '../../../../../../actions/piece_actions';
import WhitelabelActions from '../../../../../../actions/whitelabel_actions'; import WhitelabelActions from '../../../../../../actions/whitelabel_actions';
import WhitelabelStore from '../../../../../../stores/whitelabel_store'; import WhitelabelStore from '../../../../../../stores/whitelabel_store';
@ -92,11 +89,6 @@ let MarketSubmitButton = React.createClass({
this.refs.consignModal.show(); this.refs.consignModal.show();
}, },
handleConsignError() {
// Unselect failed editions
EditionListActions.clearAllEditionSelections();
},
render() { render() {
const { availableAcls, currentUser, className, editions, handleSuccess } = this.props; const { availableAcls, currentUser, className, editions, handleSuccess } = this.props;
const { whitelabel: { name: whitelabelName = 'Market', user: whitelabelAdminEmail } } = this.state; const { whitelabel: { name: whitelabelName = 'Market', user: whitelabelAdminEmail } } = this.state;
@ -128,45 +120,27 @@ let MarketSubmitButton = React.createClass({
); );
if (solePieceId && !canSubmit) { if (solePieceId && !canSubmit) {
if (availableAcls.acl_edit) { return (
return ( <AclProxy
<AclProxy aclObject={availableAcls}
aclObject={availableAcls} aclName='acl_consign'>
aclName='acl_consign'>
<ModalWrapper
trigger={triggerButton}
handleSuccess={this.handleAdditionalDataSuccess.bind(this, solePieceId)}
title={getLangText('Add additional information')}>
<MarketAdditionalDataForm
pieceId={solePieceId}
submitLabel={getLangText('Continue to consignment')} />
</ModalWrapper>
<ModalWrapper
ref="consignModal"
handleSuccess={handleSuccess}
title={getLangText('Consign artwork')}>
{consignForm}
</ModalWrapper>
</AclProxy>
);
} else {
// Oops, well this is a difficult situation...
// The user's likely already transferred another edition from the piece so
// they can't update the missing fields that are necessary for consignment
// to marketplaces.
// Let's show an error in response to explain the problem and let them
// contact the whitelabel themselves.
return (
<ModalWrapper <ModalWrapper
trigger={triggerButton} trigger={triggerButton}
handleSuccess={this.handleConsignError} handleSuccess={this.handleAdditionalDataSuccess.bind(this, solePieceId)}
title={getLangText("Oops, we can't consign this piece to %s", whitelabelName)}> title={getLangText('Add additional information')}>
<MarketConsignError <MarketAdditionalDataForm
whitelabelName={whitelabelName} /> pieceId={solePieceId}
submitLabel={getLangText('Continue to consignment')} />
</ModalWrapper> </ModalWrapper>
);
} <ModalWrapper
ref="consignModal"
handleSuccess={handleSuccess}
title={getLangText('Consign artwork')}>
{consignForm}
</ModalWrapper>
</AclProxy>
);
} else { } else {
return ( return (
<AclProxy <AclProxy

View File

@ -1,51 +0,0 @@
'use strict'
import React from 'react';
import { getLangText } from '../../../../../utils/lang_utils';
let MarketConsignError = React.createClass({
propTypes: {
handleSuccess: React.PropTypes.func,
whitelabelName: React.PropTypes.string
},
handleSuccess() {
const { handleSuccess, whitelabelName } = this.props;
/* eslint-disable */
Intercom('showNewMessage', getLangText("I'm having trouble consigning my edition to %s because I don't " +
"have the permissions to edit its details.", whitelabelName));
/* eslint-enable */
if (typeof handleSuccess === 'function') {
handleSuccess();
}
},
render() {
const { handleSuccess, whitelabelName } = this.props;
return (
<div className="ascribe-form-error-popup">
<div className="error-popup-content">
<p>
{getLangText('Unfortunately, %s requires you to provide more information ' +
"about this edition, but it appears that you don't have the " +
'permissions to edit the piece associated with this edition.', whitelabelName)}
</p>
<p>
{getLangText('Please contact us if you would still like to consign this piece to %s.', whitelabelName)}
</p>
</div>
<button
onClick={this.handleSuccess}
className="btn btn-default btn-wide">
{getLangText('Contact us for help')}
</button>
</div>
);
}
});
export default MarketConsignError;

View File

@ -24,10 +24,3 @@
width: 100%; width: 100%;
} }
} }
.ascribe-form-error-popup {
.error-popup-content {
margin-bottom: 30px;
margin-top: 20px;
}
}