Commit 2b9a2bc7 authored by Dave Hoover's avatar Dave Hoover

Incorporating feedback from @chriseth

parent 712a3394
......@@ -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) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment