1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-23 17:56:28 +02:00

contract, contractagreement migration

contractagreement added to loanpiece
This commit is contained in:
diminator 2015-09-14 14:16:53 +02:00
parent ef22707680
commit 7fd5516b79
5 changed files with 19 additions and 22 deletions

View File

@ -35,7 +35,7 @@ let ContractAgreementForm = React.createClass({
componentDidMount() {
ContractListStore.listen(this.onChange);
ContractListActions.fetchContractList({is_active: 'True'});
ContractListActions.fetchContractList({is_active: true});
},
componentWillUnmount() {

View File

@ -50,7 +50,7 @@ let CreateContractForm = React.createClass({
},
handleCreateSuccess(response) {
ContractListActions.fetchContractList({is_active: 'True'});
ContractListActions.fetchContractList({is_active: true});
let notification = new GlobalNotificationModel(getLangText('Contract %s successfully created', response.name), 'success', 5000);
GlobalNotificationActions.appendGlobalNotification(notification);
this.refs.form.reset();

View File

@ -17,6 +17,7 @@ import ContractAgreementListActions from '../../actions/contract_agreement_list_
import AppConstants from '../../constants/application_constants';
import { mergeOptions } from '../../utils/general_utils';
import { getLangText } from '../../utils/lang_utils';
@ -67,7 +68,10 @@ let LoanForm = React.createClass({
},
getFormData(){
return this.props.id;
return mergeOptions(
this.props.id,
this.getContractAgreementId()
);
},
handleOnChange(event) {
@ -79,6 +83,13 @@ let LoanForm = React.createClass({
}
},
getContractAgreementId() {
if (this.state.contractAgreementList && this.state.contractAgreementList.length > 0) {
return {'contract_agreement_id': this.state.contractAgreementList[0].id};
}
return null;
},
getContractCheckbox() {
if(this.state.contractAgreementList && this.state.contractAgreementList.length > 0) {
// we need to define a key on the InputCheckboxes as otherwise
@ -97,7 +108,7 @@ let LoanForm = React.createClass({
<span>
{getLangText('I agree to the')}&nbsp;
<a href={contract.blob.url_safe} target="_blank">
{getLangText('terms of')} {contract.issuer}
{getLangText('terms of ')} {contract.issuer}
</a>
</span>
</InputCheckbox>

View File

@ -26,7 +26,7 @@ let ContractSettings = React.createClass({
componentDidMount() {
ContractListStore.listen(this.onChange);
ContractListActions.fetchContractList({is_active: 'True'});
ContractListActions.fetchContractList({is_active: true});
},
componentWillUnmount() {
@ -42,7 +42,7 @@ let ContractSettings = React.createClass({
contract.is_public = true;
ContractListActions.changeContract(contract)
.then(() => {
ContractListActions.fetchContractList({is_active: 'True'});
ContractListActions.fetchContractList({is_active: true});
let notification = getLangText('Contract %s is now public', contract.name);
notification = new GlobalNotificationModel(notification, 'success', 4000);
GlobalNotificationActions.appendGlobalNotification(notification);
@ -58,7 +58,7 @@ let ContractSettings = React.createClass({
return () => {
ContractListActions.removeContract(contract.id)
.then((response) => {
ContractListActions.fetchContractList({is_active: 'True'});
ContractListActions.fetchContractList({is_active: true});
let notification = new GlobalNotificationModel(response.notification, 'success', 4000);
GlobalNotificationActions.appendGlobalNotification(notification);
})

View File

@ -50,21 +50,7 @@ let IkonotvSubmitButton = React.createClass({
enddate={enddate}
gallery="IkonoTV archive"
showPersonalMessage={false}
handleSuccess={this.props.handleSuccess}>
<Property
name="terms"
className="ascribe-settings-property-collapsible-toggle"
style={{paddingBottom: 0}}>
<InputCheckbox>
<span>
{' ' + getLangText('I agree to the Terms of Service of IkonoTV Archive') + ' '}
(<a href="https://s3-us-west-2.amazonaws.com/ascribe0/whitelabel/ikonotv/ikono-tos.pdf" target="_blank" style={{fontSize: '0.9em', color: 'rgba(0,0,0,0.7)'}}>
{getLangText('read')}
</a>)
</span>
</InputCheckbox>
</Property>
</LoanForm>
handleSuccess={this.props.handleSuccess} />
</ModalWrapper>
);