Merge pull request #12 from EaterOfCode/fixCopyButton
fix the copy button so it actually works~
This commit is contained in:
commit
28a4fcd342
3 changed files with 39 additions and 2 deletions
7
public/js/clipboard.min.js
vendored
Normal file
7
public/js/clipboard.min.js
vendored
Normal file
File diff suppressed because one or more lines are too long
23
public/js/invites.js
Normal file
23
public/js/invites.js
Normal file
|
@ -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…
Reference in a new issue