1
0
mirror of https://github.com/ascribe/onion.git synced 2024-11-15 01:25:17 +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:
diminator 2015-07-29 15:55:16 +02:00
commit bab29d6ffa
6 changed files with 22 additions and 6 deletions

View File

@ -7,7 +7,8 @@ import OwnershipFetcher from '../fetchers/ownership_fetcher';
class LoanContractActions {
constructor() {
this.generateActions(
'updateLoanContract'
'updateLoanContract',
'flushLoanContract'
);
}

View File

@ -6,8 +6,6 @@ import classNames from 'classnames';
import EditionListActions from '../../actions/edition_list_actions';
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 CreateEditionsButton from '../ascribe_buttons/create_editions_button';

View File

@ -113,11 +113,19 @@ let Piece = React.createClass({
},
handlePollingSuccess(pieceId, numEditions) {
// we need to refresh the num_editions property of the actual piece we're looking at
PieceActions.updateProperty({
key: 'num_editions',
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);
GlobalNotificationActions.appendGlobalNotification(notification);
},

View File

@ -36,6 +36,7 @@ let LoanForm = React.createClass({
},
componentWillUnmount() {
LoanContractActions.flushLoanContract();
LoanContractStore.unlisten(this.onChange);
},
@ -53,13 +54,16 @@ let LoanForm = React.createClass({
getContractCheckbox() {
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 (
<Property
name="terms"
className="ascribe-settings-property-collapsible-toggle"
style={{paddingBottom: 0}}>
<InputCheckbox
key='contract_terms'
key="terms_explicitly"
defaultChecked={false}>
<span>
{getLangText('I agree to the')}&nbsp;
@ -77,7 +81,7 @@ let LoanForm = React.createClass({
style={{paddingBottom: 0}}
hidden={true}>
<InputCheckbox
key='implicit_terms'
key="terms_implicitly"
defaultChecked={true} />
</Property>
);

View File

@ -17,6 +17,12 @@ class LoanContractStore {
this.contractUrl = contractUrl;
this.contractEmail = contractEmail;
}
onFlushLoanContract() {
this.contractKey = null;
this.contractUrl = null;
this.contractEmail = null;
}
}
export default alt.createStore(LoanContractStore, 'LoanContractStore');

View File

@ -80,7 +80,6 @@ class PieceListStore {
let piece = filteredPieceList[0];
piece[key] = value;
} else {
throw new Error('Could not find a matching piece in piece list since its either not there or piecelist contains duplicates.');
}