forked from zer.ooo/web
fix the copy button so it actually works~
This commit is contained in:
parent
23115b1598
commit
f3bbbf746a
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" %}
|
{% extends "base_bootstrap.html.twig" %}
|
||||||
|
|
||||||
|
{% block head %}
|
||||||
|
{{ parent() }}
|
||||||
|
|
||||||
|
<script src="/js/clipboard.min.js"></script>
|
||||||
|
<script src="/js/invites.js"></script>
|
||||||
|
{% endblock %}
|
||||||
|
|
||||||
{% block content %}
|
{% block content %}
|
||||||
<div class="container">
|
<div class="container">
|
||||||
<div class="row">
|
<div class="row">
|
||||||
|
@ -33,7 +40,7 @@
|
||||||
<kbd>{{ invite.getInvite() }}</kbd>
|
<kbd>{{ invite.getInvite() }}</kbd>
|
||||||
</td>
|
</td>
|
||||||
<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>
|
</td>
|
||||||
</tr>
|
</tr>
|
||||||
{% else %}
|
{% else %}
|
||||||
|
|
Loading…
Reference in a new issue