1
0
mirror of https://github.com/ascribe/onion.git synced 2024-06-23 17:56:28 +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) => {
OwnershipFetcher.deleteContract(contract)
OwnershipFetcher.deleteContract(contractId)
.then((res) => {
console.log('Contract deleted');
resolve(res);

View File

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

View File

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