Merge pull request #731 from ethereum/contractUI

Contract ui - Misc
pull/1/head
yann300 7 years ago committed by GitHub
commit 42b5e1634d
  1. 13
      assets/css/browser-solidity.css
  2. 14
      assets/css/universal-dapp.css
  3. 4
      src/app/tabs/compile-tab.js
  4. 6
      src/app/tabs/run-tab.js
  5. 4
      src/universal-dapp.js

@ -180,19 +180,6 @@
font-weight: bold; font-weight: bold;
} }
.contract.hidesub {
padding-bottom: 0;
margin: 0;
}
.contract.hidesub > *:not(.title) {
display: none;
}
.contract.hidesub > .title:before {
content: "\25B6";
}
#output .udapp { #output .udapp {
border: 0 none; border: 0 none;
box-shadow: none; box-shadow: none;

@ -109,12 +109,6 @@
cursor: pointer; cursor: pointer;
} }
.udapp .instance.hidesub .title {
margin-bottom: 0;
padding-right: 1.5em;
word-wrap: break-word;
}
.udapp .instance .title:before { .udapp .instance .title:before {
content: "\25BC"; content: "\25BC";
opacity: 0.5; opacity: 0.5;
@ -123,14 +117,6 @@
margin-top: 0.2em; margin-top: 0.2em;
} }
.udapp .instance.hidesub > *:not(.title) {
display: none;
}
.udapp .instance.hidesub > .title:before {
content: "\25B6";
}
#runTabView .contractProperty { #runTabView .contractProperty {
overflow: auto; overflow: auto;
margin-bottom: 0.4em; margin-bottom: 0.4em;

@ -319,7 +319,7 @@ function compileTab (container, appAPI, appEvents, opts) {
function details () { function details () {
var select = el.querySelector('select') var select = el.querySelector('select')
if (select.children.length > 0 && select.selectedIndex >= 0) { if (select.children.length > 0 && select.selectedIndex >= 0) {
var contractName = select.children[select.selectedIndex].innerText var contractName = select.children[select.selectedIndex].innerHTML
var details = contractsDetails[contractName] var details = contractsDetails[contractName]
var keys = Object.keys(contractsDetails[contractName]) var keys = Object.keys(contractsDetails[contractName])
var log = yo`<div class="${css.detailsJSON}"></div>` var log = yo`<div class="${css.detailsJSON}"></div>`
@ -334,7 +334,7 @@ function compileTab (container, appAPI, appEvents, opts) {
function publish (appAPI) { function publish (appAPI) {
var selectContractNames = document.querySelector(`.${css.contractNames.classNames[0]}`) var selectContractNames = document.querySelector(`.${css.contractNames.classNames[0]}`)
if (selectContractNames.children.length > 0 && selectContractNames.selectedIndex >= 0) { if (selectContractNames.children.length > 0 && selectContractNames.selectedIndex >= 0) {
var contract = contractsDetails[selectContractNames.children[selectContractNames.selectedIndex].innerText] var contract = contractsDetails[selectContractNames.children[selectContractNames.selectedIndex].innerHTML]
publishOnSwarm(contract, appAPI, function (err) { publishOnSwarm(contract, appAPI, function (err) {
if (err) { if (err) {
alert('Failed to publish metadata: ' + err) alert('Failed to publish metadata: ' + err)

@ -278,7 +278,7 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
function setInputParamsPlaceHolder () { function setInputParamsPlaceHolder () {
createButtonInput.value = '' createButtonInput.value = ''
if (appAPI.getContracts() && selectContractNames.selectedIndex >= 0 && selectContractNames.children.length > 0) { if (appAPI.getContracts() && selectContractNames.selectedIndex >= 0 && selectContractNames.children.length > 0) {
var contract = appAPI.getContracts()[selectContractNames.children[selectContractNames.selectedIndex].innerText] var contract = appAPI.getContracts()[selectContractNames.children[selectContractNames.selectedIndex].innerHTML]
var ctrabi = txHelper.getConstructorInterface(contract.interface) var ctrabi = txHelper.getConstructorInterface(contract.interface)
if (ctrabi.inputs.length) { if (ctrabi.inputs.length) {
createButtonInput.setAttribute('placeholder', txHelper.inputParametersDeclarationToString(ctrabi.inputs)) createButtonInput.setAttribute('placeholder', txHelper.inputParametersDeclarationToString(ctrabi.inputs))
@ -296,7 +296,7 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
function createInstance () { function createInstance () {
var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`) var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`)
var contracts = appAPI.getContracts() var contracts = appAPI.getContracts()
var contract = appAPI.getContracts()[contractNames.children[contractNames.selectedIndex].innerText] var contract = appAPI.getContracts()[contractNames.children[contractNames.selectedIndex].innerHTML]
var constructor = txHelper.getConstructorInterface(contract.interface) var constructor = txHelper.getConstructorInterface(contract.interface)
var args = createButtonInput.value var args = createButtonInput.value
txFormat.buildData(contract, contracts, true, constructor, args, appAPI.udapp(), appAPI.executionContext(), (error, data) => { txFormat.buildData(contract, contracts, true, constructor, args, appAPI.udapp(), appAPI.executionContext(), (error, data) => {
@ -338,7 +338,7 @@ function contractDropdown (appAPI, appEvents, instanceContainer) {
function loadFromAddress (appAPI) { function loadFromAddress (appAPI) {
noInstancesText.style.display = 'none' noInstancesText.style.display = 'none'
var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`) var contractNames = document.querySelector(`.${css.contractNames.classNames[0]}`)
var contract = appAPI.getContracts()[contractNames.children[contractNames.selectedIndex].innerText] var contract = appAPI.getContracts()[contractNames.children[contractNames.selectedIndex].innerHTML]
var address = atAddressButtonInput.value var address = atAddressButtonInput.value
instanceContainer.appendChild(appAPI.udapp().renderInstance(contract, address, selectContractNames.value)) instanceContainer.appendChild(appAPI.udapp().renderInstance(contract, address, selectContractNames.value))
} }

@ -47,6 +47,7 @@ var css = csjs`
} }
.instance { .instance {
${styles.displayBox} ${styles.displayBox}
margin-bottom: 2px;
padding: 10px 15px 6px 15px; padding: 10px 15px 6px 15px;
} }
.instance .title:before { .instance .title:before {
@ -57,9 +58,6 @@ var css = csjs`
content: "\\25B8"; content: "\\25B8";
margin-right: 5%; margin-right: 5%;
} }
.instance.hidesub {
margin: 0;
}
.instance.hidesub > * { .instance.hidesub > * {
display: none; display: none;
} }

Loading…
Cancel
Save