Skip to content

Commit

Permalink
Move ballot example into src/app/example-contracts
Browse files Browse the repository at this point in the history
  • Loading branch information
axic committed Oct 25, 2016
1 parent e5141ca commit ff65dbd
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 36 deletions.
4 changes: 0 additions & 4 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -35,13 +35,9 @@
<link rel="stylesheet" href="assets/css/font-awesome.min.css">
<link rel="icon" type="x-icon" href="icon.png">
<meta name="viewport" content="width=device-width, initial-scale=1, user-scalable=no">

<script src="assets/js/ballot.sol.js"></script>

</head>
<body>


<div id="editor">
<span class="newFile" title="New File"><i class="fa fa-file-code-o"></i></span>
<span class="uploadFile" title="Upload"><label class="fa fa-upload"><input type="file" class="inputFile" multiple /></label></span>
Expand Down
1 change: 0 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,6 @@
"private": true,
"semistandard": {
"ignore": [
"assets/js/",
"build/",
"src/mode-solidity.js",
"nightwatch.js",
Expand Down
5 changes: 3 additions & 2 deletions src/app/editor.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
/* global BALLOT_EXAMPLE, FileReader */
/* global FileReader */
'use strict';

var utils = require('./utils');
var examples = require('./example-contracts');

var ace = require('brace');
require('../mode-solidity.js');
Expand Down Expand Up @@ -178,7 +179,7 @@ function Editor (loadingFromGist, storage) {
}
SOL_CACHE_FILE = SOL_CACHE_UNTITLED + untitledCount;
files.push(SOL_CACHE_FILE);
storage.set(SOL_CACHE_FILE, BALLOT_EXAMPLE); // defined in assets/js/ballot.sol.js
storage.set(SOL_CACHE_FILE, examples.ballot);
}

SOL_CACHE_FILE = files[0];
Expand Down
35 changes: 6 additions & 29 deletions assets/js/ballot.sol.js → src/app/example-contracts.js
Original file line number Diff line number Diff line change
@@ -1,30 +1,4 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2014, 2015, the individual contributors
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

var multi = function (func) { return func.toString().match(/[^]*\/\*([^]*)\*\/\}$/)[1]; };

var BALLOT_EXAMPLE = multi(function () { /*pragma solidity ^0.4.0;
var ballot = `pragma solidity ^0.4.0;
contract Ballot {
struct Voter {
Expand Down Expand Up @@ -88,5 +62,8 @@ contract Ballot {
winningProposal = proposal;
}
}
}
*/});
}`;

module.exports = {
ballot: ballot
};

0 comments on commit ff65dbd

Please sign in to comment.