Incorporating feedback from @chriseth

pull/1/head
Dave Hoover 9 years ago
parent 712a33943a
commit 2b9a2bc7b3
  1. 4
      src/app.js
  2. 4
      src/app/compiler.js
  3. 10
      src/app/editor.js
  4. 10
      src/app/renderer.js

@ -210,7 +210,7 @@ var run = function() {
return false;
}
function fileTabFromKey() {
function activeFileTab() {
var name = editor.getCacheFile();
return $('#files .file').filter(function(){ return $(this).find('.name').text() == name; });
}
@ -227,7 +227,7 @@ var run = function() {
}
if (editor.cacheFileIsPresent()) {
var active = fileTabFromKey();
var active = activeFileTab();
active.addClass('active');
editor.resetSession();
}

@ -21,7 +21,7 @@ function Compiler(web3, editor, handleGithubCall, outputField, hidingRHP, update
function onChange() {
var input = editor.getValue();
if (input === "") {
window.localStorage.setItem(editor.getRawCacheFile(), '');
editor.setCacheFileContent('');
return;
}
if (input === previousInput)
@ -38,7 +38,7 @@ function Compiler(web3, editor, handleGithubCall, outputField, hidingRHP, update
sourceAnnotations = [];
outputField.empty();
var input = editor.getValue();
window.localStorage.setItem(editor.getRawCacheFile(), input);
editor.setCacheFileContent(input)
var files = {};
files[editor.getCacheFile()] = input;

@ -11,15 +11,15 @@ function Editor(loadingFromGist) {
untitledCount = (untitledCount - 0) + 1;
SOL_CACHE_FILE = SOL_CACHE_UNTITLED + untitledCount;
sessions[SOL_CACHE_FILE] = null;
window.localStorage[SOL_CACHE_FILE] = '';
this.setCacheFileContent('');
};
this.setCacheFile = function(cacheFile) {
SOL_CACHE_FILE = utils.fileKey(cacheFile);
this.setCacheFileContent = function(content) {
window.localStorage.setItem(SOL_CACHE_FILE, content);
};
this.getRawCacheFile = function() {
return SOL_CACHE_FILE;
this.setCacheFile = function(cacheFile) {
SOL_CACHE_FILE = utils.fileKey(cacheFile);
};
this.getCacheFile = function() {

@ -83,8 +83,8 @@ function Renderer(web3, editor, compiler, updateFiles) {
};
this.error = renderError;
var combined = function(contractName, interface, bytecode){
return JSON.stringify([{name: contractName, interface: interface, bytecode: bytecode}]);
var combined = function(contractName, jsonInterface, bytecode){
return JSON.stringify([{name: contractName, interface: jsonInterface, bytecode: bytecode}]);
};
function renderContracts(data, source) {
@ -224,15 +224,15 @@ function Renderer(web3, editor, compiler, updateFiles) {
return text;
};
function gethDeploy(contractName, interface, bytecode){
function gethDeploy(contractName, jsonInterface, bytecode){
var code = "";
var funABI = getConstructorInterface(JSON.parse(interface));
var funABI = getConstructorInterface(JSON.parse(jsonInterface));
funABI.inputs.forEach(function(inp) {
code += "var " + inp.name + " = /* var of type " + inp.type + " here */ ;\n";
});
code += "var " + contractName + "Contract = web3.eth.contract(" + interface.replace("\n","") + ");"
code += "var " + contractName + "Contract = web3.eth.contract(" + jsonInterface.replace("\n","") + ");"
+"\nvar " + contractName + " = " + contractName + "Contract.new(";
funABI.inputs.forEach(function(inp) {

Loading…
Cancel
Save