mirror of
https://github.com/ascribe/onion.git
synced 2025-02-14 21:10:27 +01:00
Merge remote-tracking branch 'remotes/origin/AD-435-hash-locally-for-when-a-artist-do'
Conflicts: js/components/ascribe_forms/form_loan.js
This commit is contained in:
commit
bab29d6ffa
@ -7,7 +7,8 @@ import OwnershipFetcher from '../fetchers/ownership_fetcher';
|
|||||||
class LoanContractActions {
|
class LoanContractActions {
|
||||||
constructor() {
|
constructor() {
|
||||||
this.generateActions(
|
this.generateActions(
|
||||||
'updateLoanContract'
|
'updateLoanContract',
|
||||||
|
'flushLoanContract'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,8 +6,6 @@ import classNames from 'classnames';
|
|||||||
import EditionListActions from '../../actions/edition_list_actions';
|
import EditionListActions from '../../actions/edition_list_actions';
|
||||||
import EditionListStore from '../../stores/edition_list_store';
|
import EditionListStore from '../../stores/edition_list_store';
|
||||||
|
|
||||||
import OverlayTrigger from 'react-bootstrap/lib/OverlayTrigger';
|
|
||||||
import Tooltip from 'react-bootstrap/lib/Tooltip';
|
|
||||||
import Button from 'react-bootstrap/lib/Button';
|
import Button from 'react-bootstrap/lib/Button';
|
||||||
|
|
||||||
import CreateEditionsButton from '../ascribe_buttons/create_editions_button';
|
import CreateEditionsButton from '../ascribe_buttons/create_editions_button';
|
||||||
|
@ -113,11 +113,19 @@ let Piece = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handlePollingSuccess(pieceId, numEditions) {
|
handlePollingSuccess(pieceId, numEditions) {
|
||||||
|
|
||||||
|
// we need to refresh the num_editions property of the actual piece we're looking at
|
||||||
PieceActions.updateProperty({
|
PieceActions.updateProperty({
|
||||||
key: 'num_editions',
|
key: 'num_editions',
|
||||||
value: numEditions
|
value: numEditions
|
||||||
});
|
});
|
||||||
|
|
||||||
|
// as well as its representation in the collection
|
||||||
|
// btw.: It's not sufficient to just set num_editions to numEditions, since a single accordion
|
||||||
|
// list item also uses the firstEdition property which we can only get from the server in that case.
|
||||||
|
// Therefore we need to at least refetch the changed piece from the server or on our case simply all
|
||||||
|
PieceListActions.fetchPieceList(this.state.page, this.state.pageSize, this.state.search, this.state.orderBy, this.state.orderAsc);
|
||||||
|
|
||||||
let notification = new GlobalNotificationModel('Editions successfully created', 'success', 10000);
|
let notification = new GlobalNotificationModel('Editions successfully created', 'success', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
},
|
},
|
||||||
|
@ -36,6 +36,7 @@ let LoanForm = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
|
LoanContractActions.flushLoanContract();
|
||||||
LoanContractStore.unlisten(this.onChange);
|
LoanContractStore.unlisten(this.onChange);
|
||||||
},
|
},
|
||||||
|
|
||||||
@ -53,13 +54,16 @@ let LoanForm = React.createClass({
|
|||||||
|
|
||||||
getContractCheckbox() {
|
getContractCheckbox() {
|
||||||
if(this.state.contractKey && this.state.contractUrl) {
|
if(this.state.contractKey && this.state.contractUrl) {
|
||||||
|
// we need to define a key on the InputCheckboxes as otherwise
|
||||||
|
// react is not rerendering them on a store switch and is keeping
|
||||||
|
// the default value of the component (which is in that case true)
|
||||||
return (
|
return (
|
||||||
<Property
|
<Property
|
||||||
name="terms"
|
name="terms"
|
||||||
className="ascribe-settings-property-collapsible-toggle"
|
className="ascribe-settings-property-collapsible-toggle"
|
||||||
style={{paddingBottom: 0}}>
|
style={{paddingBottom: 0}}>
|
||||||
<InputCheckbox
|
<InputCheckbox
|
||||||
key='contract_terms'
|
key="terms_explicitly"
|
||||||
defaultChecked={false}>
|
defaultChecked={false}>
|
||||||
<span>
|
<span>
|
||||||
{getLangText('I agree to the')}
|
{getLangText('I agree to the')}
|
||||||
@ -77,7 +81,7 @@ let LoanForm = React.createClass({
|
|||||||
style={{paddingBottom: 0}}
|
style={{paddingBottom: 0}}
|
||||||
hidden={true}>
|
hidden={true}>
|
||||||
<InputCheckbox
|
<InputCheckbox
|
||||||
key='implicit_terms'
|
key="terms_implicitly"
|
||||||
defaultChecked={true} />
|
defaultChecked={true} />
|
||||||
</Property>
|
</Property>
|
||||||
);
|
);
|
||||||
|
@ -17,6 +17,12 @@ class LoanContractStore {
|
|||||||
this.contractUrl = contractUrl;
|
this.contractUrl = contractUrl;
|
||||||
this.contractEmail = contractEmail;
|
this.contractEmail = contractEmail;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
onFlushLoanContract() {
|
||||||
|
this.contractKey = null;
|
||||||
|
this.contractUrl = null;
|
||||||
|
this.contractEmail = null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default alt.createStore(LoanContractStore, 'LoanContractStore');
|
export default alt.createStore(LoanContractStore, 'LoanContractStore');
|
||||||
|
@ -80,7 +80,6 @@ class PieceListStore {
|
|||||||
|
|
||||||
let piece = filteredPieceList[0];
|
let piece = filteredPieceList[0];
|
||||||
piece[key] = value;
|
piece[key] = value;
|
||||||
|
|
||||||
} else {
|
} else {
|
||||||
throw new Error('Could not find a matching piece in piece list since its either not there or piecelist contains duplicates.');
|
throw new Error('Could not find a matching piece in piece list since its either not there or piecelist contains duplicates.');
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user