Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
B
baas-ide
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
JIRA
JIRA
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
guxukai
baas-ide
Commits
e52e7610
Commit
e52e7610
authored
Oct 25, 2016
by
yann300
Committed by
GitHub
Oct 25, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #262 from ethereum/ballot
Move ballot example into src/app/example-contracts
parents
e5141cab
0de29490
Show whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
14 additions
and
47 deletions
+14
-47
index.html
index.html
+0
-4
package.json
package.json
+0
-1
editor.js
src/app/editor.js
+4
-9
example-contracts.js
src/app/example-contracts.js
+6
-29
requests.js
test-browser/mockcompiler/requests.js
+2
-2
ballot.js
test-browser/tests/ballot.js
+1
-1
simpleContract.js
test-browser/tests/simpleContract.js
+1
-1
No files found.
index.html
View file @
e52e7610
...
@@ -35,13 +35,9 @@
...
@@ -35,13 +35,9 @@
<link
rel=
"stylesheet"
href=
"assets/css/font-awesome.min.css"
>
<link
rel=
"stylesheet"
href=
"assets/css/font-awesome.min.css"
>
<link
rel=
"icon"
type=
"x-icon"
href=
"icon.png"
>
<link
rel=
"icon"
type=
"x-icon"
href=
"icon.png"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, user-scalable=no"
>
<meta
name=
"viewport"
content=
"width=device-width, initial-scale=1, user-scalable=no"
>
<script
src=
"assets/js/ballot.sol.js"
></script>
</head>
</head>
<body>
<body>
<div
id=
"editor"
>
<div
id=
"editor"
>
<span
class=
"newFile"
title=
"New File"
><i
class=
"fa fa-file-code-o"
></i></span>
<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>
<span
class=
"uploadFile"
title=
"Upload"
><label
class=
"fa fa-upload"
><input
type=
"file"
class=
"inputFile"
multiple
/></label></span>
...
...
package.json
View file @
e52e7610
...
@@ -59,7 +59,6 @@
...
@@ -59,7 +59,6 @@
"private"
:
true
,
"private"
:
true
,
"semistandard"
:
{
"semistandard"
:
{
"ignore"
:
[
"ignore"
:
[
"assets/js/"
,
"build/"
,
"build/"
,
"src/mode-solidity.js"
,
"src/mode-solidity.js"
,
"nightwatch.js"
,
"nightwatch.js"
,
...
...
src/app/editor.js
View file @
e52e7610
/* global
BALLOT_EXAMPLE,
FileReader */
/* global FileReader */
'use strict'
;
'use strict'
;
var
utils
=
require
(
'./utils'
);
var
utils
=
require
(
'./utils'
);
var
examples
=
require
(
'./example-contracts'
);
var
ace
=
require
(
'brace'
);
var
ace
=
require
(
'brace'
);
require
(
'../mode-solidity.js'
);
require
(
'../mode-solidity.js'
);
...
@@ -169,16 +170,10 @@ function Editor (loadingFromGist, storage) {
...
@@ -169,16 +170,10 @@ function Editor (loadingFromGist, storage) {
}
}
function
setupStuff
(
files
)
{
function
setupStuff
(
files
)
{
var
untitledCount
=
''
;
if
(
files
.
length
===
0
)
{
if
(
files
.
length
===
0
)
{
if
(
loadingFromGist
)
return
;
if
(
loadingFromGist
)
return
;
// Backwards-compatibility
files
.
push
(
utils
.
fileKey
(
examples
.
ballot
.
name
));
while
(
storage
.
exists
(
SOL_CACHE_UNTITLED
+
untitledCount
))
{
storage
.
set
(
utils
.
fileKey
(
examples
.
ballot
.
name
),
examples
.
ballot
.
content
);
untitledCount
=
(
untitledCount
-
0
)
+
1
;
}
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
}
}
SOL_CACHE_FILE
=
files
[
0
];
SOL_CACHE_FILE
=
files
[
0
];
...
...
assets/js/ballot.sol
.js
→
src/app/example-contracts
.js
View file @
e52e7610
/*
var
ballot
=
`pragma solidity ^0.4.0;
* 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;
contract Ballot {
contract Ballot {
struct Voter {
struct Voter {
...
@@ -88,5 +62,8 @@ contract Ballot {
...
@@ -88,5 +62,8 @@ contract Ballot {
winningProposal = proposal;
winningProposal = proposal;
}
}
}
}
}
}`
;
*/
});
module
.
exports
=
{
ballot
:
{
name
:
'ballot.sol'
,
content
:
ballot
}
};
test-browser/mockcompiler/requests.js
View file @
e52e7610
module
.
exports
=
{
module
.
exports
=
{
'testSimpleContract'
:
{
'testSimpleContract'
:
{
'sources'
:
{
'sources'
:
{
'Untitled
1
'
:
'contract test1 {} contract test2 {}'
'Untitled'
:
'contract test1 {} contract test2 {}'
}
}
},
},
'ballot'
:
{
'ballot'
:
{
'sources'
:
{
'sources'
:
{
'Untitled
1
'
:
`pragma solidity ^0.4.0;
'Untitled'
:
`pragma solidity ^0.4.0;
contract Ballot {
contract Ballot {
struct Voter {
struct Voter {
...
...
test-browser/tests/ballot.js
View file @
e52e7610
...
@@ -14,7 +14,7 @@ function runTests (browser, testData) {
...
@@ -14,7 +14,7 @@ function runTests (browser, testData) {
.
waitForElementVisible
(
'.newFile'
,
10000
);
.
waitForElementVisible
(
'.newFile'
,
10000
);
browser
.
assert
.
notEqual
(
testData
,
null
);
browser
.
assert
.
notEqual
(
testData
,
null
);
// TODO add Ballot tests. -> setValue('#input textarea', ... ) is not working properly with that contract.
// TODO add Ballot tests. -> setValue('#input textarea', ... ) is not working properly with that contract.
/* testBallot(browser, testData.ballot.sources.Untitled
1
, function () {
/* testBallot(browser, testData.ballot.sources.Untitled, function () {
browser.end();
browser.end();
});*/
});*/
}
}
...
...
test-browser/tests/simpleContract.js
View file @
e52e7610
...
@@ -13,7 +13,7 @@ function runTests (browser, testData) {
...
@@ -13,7 +13,7 @@ function runTests (browser, testData) {
.
url
(
'http://127.0.0.1:8080/#version=builtin'
)
.
url
(
'http://127.0.0.1:8080/#version=builtin'
)
.
waitForElementVisible
(
'.newFile'
,
10000
);
.
waitForElementVisible
(
'.newFile'
,
10000
);
browser
.
assert
.
notEqual
(
testData
,
null
);
browser
.
assert
.
notEqual
(
testData
,
null
);
testSimpleContract
(
browser
,
testData
.
testSimpleContract
.
sources
.
Untitled
1
,
function
()
{
testSimpleContract
(
browser
,
testData
.
testSimpleContract
.
sources
.
Untitled
,
function
()
{
browser
.
end
();
browser
.
end
();
});
});
}
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment