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

tabs inserted in jsx

This commit is contained in:
Cevo 2015-09-07 15:43:44 +02:00
parent 6b9bf03941
commit 632c04149d
3 changed files with 31 additions and 19 deletions

View File

@ -37,9 +37,9 @@ class ContractListActions {
}); });
} }
removeContract(contract){ removeContract(contractId){
return Q.Promise((resolve, reject) => { return Q.Promise((resolve, reject) => {
OwnershipFetcher.deleteContract(contract) OwnershipFetcher.deleteContract(contractId)
.then((res) => { .then((res) => {
console.log('Contract deleted'); console.log('Contract deleted');
resolve(res); resolve(res);

View File

@ -32,21 +32,21 @@ let ContractSettings = React.createClass({
this.setState(state); this.setState(state);
}, },
makeContractPublic(contract){ makeContractPublic(contract){
console.log(contract);
ContractListActions.makeContractPublic(contract) ContractListActions.makeContractPublic(contract)
.then(( ) => ContractListActions.fetchContractList()) .then(( ) => ContractListActions.fetchContractList())
.catch((error)=>{ .catch((error)=>{
let notification = new GlobalNotificationModel(error, 'danger', 10000); let notification = new GlobalNotificationModel(error, 'danger', 10000);
GlobalNotificationActions.appendGlobalNotification(notification); GlobalNotificationActions.appendGlobalNotification(notification);
}); });
}, },
removeContract(contract){ removeContract(contract){
console.log(contract); console.log(contract);
ContractListActions.removeContract(contract) ContractListActions.removeContract(contract.id)
.then(( ) => ContractListActions.fetchContractList()) .then(( ) => ContractListActions.fetchContractList())
.catch((error) => {console.log('Error', error); .catch((error) => {
let notification = new GlobalNotificationModel(error, 'danger', 10000); console.log('Error', error);
GlobalNotificationActions.appendGlobalNotification(notification); let notification = new GlobalNotificationModel(error, 'danger', 10000);
GlobalNotificationActions.appendGlobalNotification(notification);
}); });
}, },
getPublicContracts(){ getPublicContracts(){
@ -81,9 +81,13 @@ let ContractSettings = React.createClass({
<ActionPanel title = {contract.name} <ActionPanel title = {contract.name}
content = {contract.name} content = {contract.name}
buttons = {<span> buttons = {<span>
<button className="btn btn-default btn-sm margin-left-2px">UPDATE</button> <button className="btn btn-default btn-sm margin-left-2px">
<button className="btn btn-default btn-sm margin-left-2px" UPDATE
onClick={this.removeContract.bind(this, contract)}>REMOVE</button> </button>
<button className="btn btn-default btn-sm margin-left-2px"
onClick={this.removeContract.bind(this, contract)}>
REMOVE
</button>
</span>} </span>}
/>); />);
} }
@ -98,11 +102,19 @@ let ContractSettings = React.createClass({
return ( return (
<ActionPanel title = {contract.name} <ActionPanel title = {contract.name}
content = {contract.name} content = {contract.name}
buttons = {<span> <button className="btn btn-default btn-sm margin-left-2px">UPDATE</button> buttons = {<span>
<button className="btn btn-default btn-sm margin-left-2px" <button className="btn btn-default btn-sm margin-left-2px">
onClick={this.removeContract.bind(this, contract)}> REMOVE </button> UPDATE
<button className="btn btn-default btn-sm margin-left-2px" </button>
onClick={this.makeContractPublic.bind(this, contract)}>MAKE PUBLIC</button> </span>} <button className="btn btn-default btn-sm margin-left-2px"
onClick={this.removeContract.bind(this, contract)}>
REMOVE
</button>
<button className="btn btn-default btn-sm margin-left-2px"
onClick={this.makeContractPublic.bind(this, contract)}>
MAKE PUBLIC
</button>
</span>}
/>); />);
} }
) : null} ) : null}

View File

@ -27,8 +27,8 @@ let OwnershipFetcher = {
return requests.put('ownership_csontract', { body: contractObj, contract_id: contractObj.id }); return requests.put('ownership_csontract', { body: contractObj, contract_id: contractObj.id });
}, },
deleteContract(contractObj){ deleteContract(contractObjId){
return requests.delete('ownership_contract', {body: contractObj, contract_id: contractObj.id}); return requests.delete('ownership_contract', {contract_id: contractObjId});
} }
}; };