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
ff8fceaf
Commit
ff8fceaf
authored
May 04, 2017
by
ninabreznik
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test changes made by Yann and restyle copy-to-clipboard
parent
073b26a1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
30 additions
and
40 deletions
+30
-40
universal-dapp.js
src/universal-dapp.js
+30
-40
No files found.
src/universal-dapp.js
View file @
ff8fceaf
...
@@ -52,14 +52,22 @@ var css = csjs`
...
@@ -52,14 +52,22 @@ var css = csjs`
`
`
var
cssInstance
=
csjs
`
var
cssInstance
=
csjs
`
.title extends
${
styles
.
titleBox
}
{
.title {
display: flex;
justify-content: center;
justify-content: center;
margin-bottom: 1em;
padding: 1em;
font-size: .95em;
font-size: .95em;
cursor: pointer;
cursor: pointer;
background-color:
${
styles
.
colors
.
violet
}
;
background-color:
${
styles
.
colors
.
violet
}
;
border: 2px dotted
${
styles
.
colors
.
blue
}
;
border: 2px dotted
${
styles
.
colors
.
blue
}
;
border-radius: 5px;
}
}
.title:hover {
.titleText {
margin-right: 1em;
word-break: break-all;
}
.titleText:hover {
opacity: .8;
opacity: .8;
}
}
.instance .title:before {
.instance .title:before {
...
@@ -77,28 +85,16 @@ var cssInstance = csjs`
...
@@ -77,28 +85,16 @@ var cssInstance = csjs`
.instance.hidesub > *:not(.title) {
.instance.hidesub > *:not(.title) {
display: none;
display: none;
}
}
.copyToClipboard extends
${
styles
.
infoTextBox
}
{
margin-top: 1em;
display: flex;
flex-wrap: wrap;
justify-content: center;
cursor: pointer;
}
.copyToClipboard:hover {
background-color:
${
styles
.
colors
.
green
}
}
.address extends
${
styles
.
button
}
{
text-align: center;
width: 100%;
padding: .1em;
}
.copy extends
${
styles
.
button
}
{
.copy extends
${
styles
.
button
}
{
border: 1px dotted
${
styles
.
colors
.
grey
}
;
border-radius: 5px;
text-align: center;
text-align: center;
width: 75%
;
padding: 1em .3em
;
padding: .1em
;
min-width: 30%
;
}
}
.copy:hover, .address:hover {
.copy:hover{
opacity: 1;
background-color:
${
styles
.
colors
.
lightGrey
}
;
opacity: .8;
}
}
`
`
...
@@ -353,10 +349,19 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
...
@@ -353,10 +349,19 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
var
context
=
self
.
executionContext
.
isVM
()
?
'memory'
:
'blockchain'
var
context
=
self
.
executionContext
.
isVM
()
?
'memory'
:
'blockchain'
address
=
(
address
.
slice
(
0
,
2
)
===
'0x'
?
''
:
'0x'
)
+
address
.
toString
(
'hex'
)
address
=
(
address
.
slice
(
0
,
2
)
===
'0x'
?
''
:
'0x'
)
+
address
.
toString
(
'hex'
)
var
$title
=
$
(
`<span class="
${
cssInstance
.
title
}
"/>`
).
text
(
contract
.
name
+
''
+
' at '
+
address
.
substring
(
0
,
10
)
+
'...'
+
' ('
+
context
+
')'
)
var
title
=
yo
`
$title
.
click
(
function
()
{
<div class="
${
cssInstance
.
title
}
">
<div class="
${
cssInstance
.
titleText
}
" onclick=
${
toggleClass
}
>
${
contract
.
name
}
at
${
address
}
(
${
context
}
) </div>
<div class="
${
cssInstance
.
copy
}
" onclick=
${
copyToClipboard
}
> <i class="fa fa-clipboard" aria-hidden="true"></i> Copy address </div>
</div>
`
function
toggleClass
()
{
$instance
.
toggleClass
(
`
${
cssInstance
.
hidesub
}
`
)
$instance
.
toggleClass
(
`
${
cssInstance
.
hidesub
}
`
)
})
}
function
copyToClipboard
()
{
copy
(
address
)
}
var
$events
=
$
(
'<div class="events"/>'
)
var
$events
=
$
(
'<div class="events"/>'
)
...
@@ -416,22 +421,7 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
...
@@ -416,22 +421,7 @@ UniversalDApp.prototype.getInstanceInterface = function (contract, address, $tar
var
eventFilter
=
self
.
web3
.
eth
.
contract
(
abi
).
at
(
address
).
allEvents
()
var
eventFilter
=
self
.
web3
.
eth
.
contract
(
abi
).
at
(
address
).
allEvents
()
eventFilter
.
watch
(
parseLogs
)
eventFilter
.
watch
(
parseLogs
)
}
}
$instance
.
append
(
$title
)
$instance
.
get
(
0
).
appendChild
(
title
)
var
instanceAddress
=
yo
`
<div class="
${
cssInstance
.
copyToClipboard
}
" onclick=
${
copyToClipboard
}
>
<div class="
${
cssInstance
.
address
}
">
${
address
}
</div>
<div class="
${
cssInstance
.
copy
}
">
<i class="fa fa-clipboard" aria-hidden="true"></i>
Copy address to clipboard
</div>
</div>`
$instance
.
append
(
instanceAddress
)
function
copyToClipboard
()
{
var
address
=
this
.
innerText
.
split
(
'
\
n'
)[
0
]
copy
(
address
)
}
// Add the fallback function
// Add the fallback function
var
fallback
=
self
.
getFallbackInterface
(
abi
)
var
fallback
=
self
.
getFallbackInterface
(
abi
)
...
...
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