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

Incorporating feedback from @chriseth

parent 712a3394
...@@ -210,7 +210,7 @@ var run = function() { ...@@ -210,7 +210,7 @@ var run = function() {
return false; return false;
} }
function fileTabFromKey() { function activeFileTab() {
var name = editor.getCacheFile(); var name = editor.getCacheFile();
return $('#files .file').filter(function(){ return $(this).find('.name').text() == name; }); return $('#files .file').filter(function(){ return $(this).find('.name').text() == name; });
} }
...@@ -227,7 +227,7 @@ var run = function() { ...@@ -227,7 +227,7 @@ var run = function() {
} }
if (editor.cacheFileIsPresent()) { if (editor.cacheFileIsPresent()) {
var active = fileTabFromKey(); var active = activeFileTab();
active.addClass('active'); active.addClass('active');
editor.resetSession(); editor.resetSession();
} }
......
...@@ -21,7 +21,7 @@ function Compiler(web3, editor, handleGithubCall, outputField, hidingRHP, update ...@@ -21,7 +21,7 @@ function Compiler(web3, editor, handleGithubCall, outputField, hidingRHP, update
function onChange() { function onChange() {
var input = editor.getValue(); var input = editor.getValue();
if (input === "") { if (input === "") {
window.localStorage.setItem(editor.getRawCacheFile(), ''); editor.setCacheFileContent('');
return; return;
} }
if (input === previousInput) if (input === previousInput)
...@@ -38,7 +38,7 @@ function Compiler(web3, editor, handleGithubCall, outputField, hidingRHP, update ...@@ -38,7 +38,7 @@ function Compiler(web3, editor, handleGithubCall, outputField, hidingRHP, update
sourceAnnotations = []; sourceAnnotations = [];
outputField.empty(); outputField.empty();
var input = editor.getValue(); var input = editor.getValue();
window.localStorage.setItem(editor.getRawCacheFile(), input); editor.setCacheFileContent(input)
var files = {}; var files = {};
files[editor.getCacheFile()] = input; files[editor.getCacheFile()] = input;
......
...@@ -11,15 +11,15 @@ function Editor(loadingFromGist) { ...@@ -11,15 +11,15 @@ function Editor(loadingFromGist) {
untitledCount = (untitledCount - 0) + 1; untitledCount = (untitledCount - 0) + 1;
SOL_CACHE_FILE = SOL_CACHE_UNTITLED + untitledCount; SOL_CACHE_FILE = SOL_CACHE_UNTITLED + untitledCount;
sessions[SOL_CACHE_FILE] = null; sessions[SOL_CACHE_FILE] = null;
window.localStorage[SOL_CACHE_FILE] = ''; this.setCacheFileContent('');
}; };
this.setCacheFile = function(cacheFile) { this.setCacheFileContent = function(content) {
SOL_CACHE_FILE = utils.fileKey(cacheFile); window.localStorage.setItem(SOL_CACHE_FILE, content);
}; };
this.getRawCacheFile = function() { this.setCacheFile = function(cacheFile) {
return SOL_CACHE_FILE; SOL_CACHE_FILE = utils.fileKey(cacheFile);
}; };
this.getCacheFile = function() { this.getCacheFile = function() {
......
...@@ -83,8 +83,8 @@ function Renderer(web3, editor, compiler, updateFiles) { ...@@ -83,8 +83,8 @@ function Renderer(web3, editor, compiler, updateFiles) {
}; };
this.error = renderError; this.error = renderError;
var combined = function(contractName, interface, bytecode){ var combined = function(contractName, jsonInterface, bytecode){
return JSON.stringify([{name: contractName, interface: interface, bytecode: bytecode}]); return JSON.stringify([{name: contractName, interface: jsonInterface, bytecode: bytecode}]);
}; };
function renderContracts(data, source) { function renderContracts(data, source) {
...@@ -224,15 +224,15 @@ function Renderer(web3, editor, compiler, updateFiles) { ...@@ -224,15 +224,15 @@ function Renderer(web3, editor, compiler, updateFiles) {
return text; return text;
}; };
function gethDeploy(contractName, interface, bytecode){ function gethDeploy(contractName, jsonInterface, bytecode){
var code = ""; var code = "";
var funABI = getConstructorInterface(JSON.parse(interface)); var funABI = getConstructorInterface(JSON.parse(jsonInterface));
funABI.inputs.forEach(function(inp) { funABI.inputs.forEach(function(inp) {
code += "var " + inp.name + " = /* var of type " + inp.type + " here */ ;\n"; 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("; +"\nvar " + contractName + " = " + contractName + "Contract.new(";
funABI.inputs.forEach(function(inp) { 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