Merge pull request #12 from EaterOfCode/fixCopyButton

fix the copy button so it actually works~
master
Corné Oppelaar 9 years ago committed by GitHub
commit 28a4fcd342

File diff suppressed because one or more lines are too long

@ -0,0 +1,23 @@
$(function () {
var clipboard = new Clipboard('.copy');
clipboard.on('success', function(e) {
$(e.trigger).text('Copied!')
setTimeout(
function () {
$(e.trigger).text('Copy');
},
2000
);
});
clipboard.on('error', function(e) {
$(e.trigger).text('Couldn\t copy :(')
setTimeout(
function () {
$(e.trigger).text('Copy');
},
2000
);
});
});

@ -1,5 +1,12 @@
{% extends "base_bootstrap.html.twig" %}
{% block head %}
{{ parent() }}
<script src="/js/clipboard.min.js"></script>
<script src="/js/invites.js"></script>
{% endblock %}
{% block content %}
<div class="container">
<div class="row">
@ -33,7 +40,7 @@
<kbd>{{ invite.getInvite() }}</kbd>
</td>
<td>
<button class="btn btn-default">Copy</button>
<button class="btn btn-default copy pull-right" data-clipboard-text="{{ invite.getInvite() }}">Copy</button>
</td>
</tr>
{% else %}
@ -45,4 +52,4 @@
</table>
</div>
</div>
{% endblock %}
{% endblock %}

Loading…
Cancel
Save