fix the copy button so it actually works~

master
Corne Oppelaar 9 years ago
parent 23115b1598
commit f3bbbf746a

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" %} {% 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 %}
@ -45,4 +52,4 @@
</table> </table>
</div> </div>
</div> </div>
{% endblock %} {% endblock %}

Loading…
Cancel
Save