Skip to content
This repository has been archived by the owner on Jan 3, 2019. It is now read-only.

Commit

Permalink
Move copy to clipboard alert into ractive
Browse files Browse the repository at this point in the history
  • Loading branch information
haustraliaer committed Jul 29, 2014
1 parent 2f24a9f commit a5f10e4
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
2 changes: 1 addition & 1 deletion app/widgets/modal-qr/content.ract
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
<span class="_icon">
{{>svg_clipboard}}
</span>
<span class="_title">Copy to clipboard</span>
<span class="_title">{{clipboard_msg}}</span>
</a>
</div>
</div>
Expand Down
10 changes: 8 additions & 2 deletions app/widgets/modal-qr/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,15 @@ var getNetwork = require('hive-network')

module.exports = function showTooltip(data){

var ractiveData = data
ractiveData.clipboard_msg = 'Copy to clipboard'

var ractive = new Ractive({
el: document.getElementById('tooltip'),
partials: {
content: require('./content.ract').template,
},
data: data
data: ractiveData
})

var canvas = ractive.nodes['qr-canvas']
Expand All @@ -25,7 +28,10 @@ module.exports = function showTooltip(data){

ractive.on('copy', function(){
cordova.plugins.clipboard.copy(ractive.get('address'));
alert('Copied to clipboard');
ractive.set('clipboard_msg', 'Address copied!')
setTimeout(function(){
ractive.set('clipboard_msg', 'Copy to clipboard')
}, 1000)
})

return ractive
Expand Down

0 comments on commit a5f10e4

Please sign in to comment.