1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 08:37:59 +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() { componentDidMount() {
ContractListStore.listen(this.onChange); ContractListStore.listen(this.onChange);
ContractListActions.fetchContractList({is_active: 'True'}); ContractListActions.fetchContractList({is_active: true});
}, },
componentWillUnmount() { componentWillUnmount() {

View File

@ -50,7 +50,7 @@ let CreateContractForm = React.createClass({
}, },
handleCreateSuccess(response) { 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); let notification = new GlobalNotificationModel(getLangText('Contract %s successfully created', response.name), 'success', 5000);
GlobalNotificationActions.appendGlobalNotification(notification); GlobalNotificationActions.appendGlobalNotification(notification);
this.refs.form.reset(); this.refs.form.reset();

View File

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

View File

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

View File

@ -50,21 +50,7 @@ let IkonotvSubmitButton = React.createClass({
enddate={enddate} enddate={enddate}
gallery="IkonoTV archive" gallery="IkonoTV archive"
showPersonalMessage={false} showPersonalMessage={false}
handleSuccess={this.props.handleSuccess}> 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>
</ModalWrapper> </ModalWrapper>
); );