mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 10:25:08 +01:00
contract list make public
This commit is contained in:
parent
a87879dd3d
commit
17f7be9257
@ -44,12 +44,8 @@ class ContractListActions {
|
|||||||
resolve(res);
|
resolve(res);
|
||||||
})
|
})
|
||||||
.catch( (err) => {
|
.catch( (err) => {
|
||||||
if(typeof err === 'undefined') {
|
console.logGlobal(err);
|
||||||
resolve(err);
|
reject(err);
|
||||||
}
|
|
||||||
else{
|
|
||||||
reject(err);
|
|
||||||
}
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -56,8 +56,7 @@ let ContractAgreementForm = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
getFormData(){
|
getFormData(){
|
||||||
return {'appendix': {'default': this.refs.form.refs.appendix.state.value},
|
return {'appendix': {'default': this.refs.form.refs.appendix.state.value}};
|
||||||
'contract': this.state.contractList[this.state.selectedContract].id};
|
|
||||||
},
|
},
|
||||||
|
|
||||||
getContracts() {
|
getContracts() {
|
||||||
|
@ -50,12 +50,12 @@ let CreateContractForm = React.createClass({
|
|||||||
},
|
},
|
||||||
|
|
||||||
handleCreateSuccess(response) {
|
handleCreateSuccess(response) {
|
||||||
ContractListActions.fetchContractList();
|
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);
|
||||||
|
//
|
||||||
// also refresh contract lists for the rest of the contract settings page
|
//// also refresh contract lists for the rest of the contract settings page
|
||||||
ContractListActions.fetchContractList();
|
//ContractListActions.fetchContractList();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
||||||
|
@ -26,7 +26,7 @@ let ContractSettings = React.createClass({
|
|||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
ContractListStore.listen(this.onChange);
|
ContractListStore.listen(this.onChange);
|
||||||
ContractListActions.fetchContractList();
|
ContractListActions.fetchContractList({is_active: 'True'});
|
||||||
},
|
},
|
||||||
|
|
||||||
componentWillUnmount() {
|
componentWillUnmount() {
|
||||||
@ -41,22 +41,31 @@ let ContractSettings = React.createClass({
|
|||||||
return () => {
|
return () => {
|
||||||
contract.is_public = true;
|
contract.is_public = true;
|
||||||
ContractListActions.changeContract(contract)
|
ContractListActions.changeContract(contract)
|
||||||
.then(() => ContractListActions.fetchContractList())
|
.then(() => {
|
||||||
|
ContractListActions.fetchContractList({is_active: 'True'});
|
||||||
|
let notification = getLangText('Contract %s is now public', contract.name);
|
||||||
|
notification = new GlobalNotificationModel(notification, 'success', 4000);
|
||||||
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
let notification = new GlobalNotificationModel(err, 'danger', 10000);
|
let notification = new GlobalNotificationModel(err, 'danger', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
removeContract(contract) {
|
removeContract(contract) {
|
||||||
return () => {
|
return () => {
|
||||||
ContractListActions.removeContract(contract.id)
|
ContractListActions.removeContract(contract.id)
|
||||||
.then(( ) => ContractListActions.fetchContractList())
|
.then((response) => {
|
||||||
|
ContractListActions.fetchContractList({is_active: 'True'});
|
||||||
|
let notification = new GlobalNotificationModel(response.notification, 'success', 4000);
|
||||||
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
|
})
|
||||||
.catch((err) => {
|
.catch((err) => {
|
||||||
let notification = new GlobalNotificationModel(err, 'danger', 10000);
|
let notification = new GlobalNotificationModel(err, 'danger', 10000);
|
||||||
GlobalNotificationActions.appendGlobalNotification(notification);
|
GlobalNotificationActions.appendGlobalNotification(notification);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -24,7 +24,6 @@ let OwnershipFetcher = {
|
|||||||
},
|
},
|
||||||
|
|
||||||
makeContractPublic(contractObj){
|
makeContractPublic(contractObj){
|
||||||
console.log(ApiUrls.ownership_contract);
|
|
||||||
return requests.put(ApiUrls.ownership_contract, { body: contractObj, contract_id: contractObj.id });
|
return requests.put(ApiUrls.ownership_contract, { body: contractObj, contract_id: contractObj.id });
|
||||||
},
|
},
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user