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

contract list make public

This commit is contained in:
diminator 2015-09-09 11:11:16 +02:00
parent a87879dd3d
commit 17f7be9257
5 changed files with 21 additions and 18 deletions

View File

@ -44,12 +44,8 @@ class ContractListActions {
resolve(res);
})
.catch( (err) => {
if(typeof err === 'undefined') {
resolve(err);
}
else{
reject(err);
}
console.logGlobal(err);
reject(err);
});
});
}

View File

@ -56,8 +56,7 @@ let ContractAgreementForm = React.createClass({
},
getFormData(){
return {'appendix': {'default': this.refs.form.refs.appendix.state.value},
'contract': this.state.contractList[this.state.selectedContract].id};
return {'appendix': {'default': this.refs.form.refs.appendix.state.value}};
},
getContracts() {

View File

@ -50,12 +50,12 @@ let CreateContractForm = React.createClass({
},
handleCreateSuccess(response) {
ContractListActions.fetchContractList();
ContractListActions.fetchContractList({is_active: 'True'});
let notification = new GlobalNotificationModel(getLangText('Contract %s successfully created', response.name), 'success', 5000);
GlobalNotificationActions.appendGlobalNotification(notification);
// also refresh contract lists for the rest of the contract settings page
ContractListActions.fetchContractList();
//
//// also refresh contract lists for the rest of the contract settings page
//ContractListActions.fetchContractList();
},

View File

@ -26,7 +26,7 @@ let ContractSettings = React.createClass({
componentDidMount() {
ContractListStore.listen(this.onChange);
ContractListActions.fetchContractList();
ContractListActions.fetchContractList({is_active: 'True'});
},
componentWillUnmount() {
@ -41,22 +41,31 @@ let ContractSettings = React.createClass({
return () => {
contract.is_public = true;
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) => {
let notification = new GlobalNotificationModel(err, 'danger', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
});
});
};
},
removeContract(contract) {
return () => {
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) => {
let notification = new GlobalNotificationModel(err, 'danger', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
});
});
};
},

View File

@ -24,7 +24,6 @@ let OwnershipFetcher = {
},
makeContractPublic(contractObj){
console.log(ApiUrls.ownership_contract);
return requests.put(ApiUrls.ownership_contract, { body: contractObj, contract_id: contractObj.id });
},