Skip to content

Commit 3b817ec

Browse files
committed
Merge pull request #652 from LearningLocker/issue/click-to-copy
Adds click to copy for credentials.
2 parents a5769bf + f14c669 commit 3b817ec

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

app/views/layouts/master.blade.php

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,27 @@
8686
{{ HTML::script('assets/js/libs/bootstrap/bootstrap.min.js') }}
8787
{{ HTML::script('assets/js/respond.min.js') }}
8888
{{ HTML::script('assets/js/placeholder.js') }}
89+
<script type="text/javascript">
90+
(function (window, document) {
91+
var copyables = [].slice.call(document.querySelectorAll('.copyable'));
92+
var copy = function(event) {
93+
window.getSelection().removeAllRanges();
94+
var range = document.createRange();
95+
document.createElement
96+
range.selectNode(event.currentTarget);
97+
window.getSelection().addRange(range);
98+
document.execCommand('copy');
99+
window.getSelection().removeAllRanges();
100+
if (!window.LL.copyalert) {
101+
window.alert('{{trans("Copied")}}');
102+
window.LL.copyalert = true;
103+
}
104+
};
105+
copyables.map(function (copyable) {
106+
copyable.addEventListener('click', copy);
107+
});
108+
})(window, document);
109+
</script>
89110
@show
90111
@show
91112
</body>

app/views/partials/client/item.blade.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<td>{{ $client->authority['name'] }}</td>
2-
<td>{{ $client->api['basic_key'] }}</td>
3-
<td>{{ $client->api['basic_secret'] }}</td>
2+
<td><a href="#" class="copyable" title="Click to copy">{{ $client->api['basic_key'] }}</a></td>
3+
<td><a href="#" class="copyable" title="Click to copy">{{ $client->api['basic_secret'] }}</a></td>
44
<td class="text-center">
55
<a
66
href="{{ URL() }}/lrs/{{ $lrs->_id }}/client/{{ $client->_id }}/edit"

0 commit comments

Comments
 (0)