1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-28 00:28:00 +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); resolve(res);
}) })
.catch( (err) => { .catch( (err) => {
if(typeof err === 'undefined') { console.logGlobal(err);
resolve(err); reject(err);
}
else{
reject(err);
}
}); });
}); });
} }

View File

@ -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() {

View File

@ -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();
}, },

View File

@ -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);
}); });
}; };
}, },

View File

@ -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 });
}, },