Add clipboard button to upload modal. Fixes #1401.

This commit is contained in:
Bart Kamphorst
2019-09-02 12:33:11 +02:00
parent d1b1375629
commit 77aaeef5ff
4 changed files with 22 additions and 2 deletions
@@ -1,6 +1,7 @@
//= require jquery-1.7.2.min
//= require identicon
//= require mousetrap.min
//= require clipboard.min
//= require gollum
//= require gollum.dialog
//= require gollum.placeholder
File diff suppressed because one or more lines are too long
@@ -119,6 +119,7 @@ $(document).ready(function() {
}
if ($('#minibutton-upload-page').length) {
new ClipboardJS('#ClipboardJSlink');
$('#minibutton-upload-page').parent().removeClass('jaws');
$('#minibutton-upload-page').click(function(e) {
e.preventDefault();
@@ -161,7 +162,10 @@ $(document).ready(function() {
$('#gollum-dialog-action-ok').attr('disabled', true);
$('input:file').on('change', function() {
if ($(this).val()) {
news = 'Your uploaded file will be accessible at<br>/' + uploadDest + '/' + $('input[type=file]').val().split('\\').pop();
filename = $('input[type=file]').val().split('\\').pop();
upload_path = '/' + uploadDest + '/' + filename;
clipboard_button = '<button class="btn btn-sm mb-2" id="ClipboardJSlink" data-clipboard-text="' + upload_path + '"><%=rocticon('clippy')%></button>'
news = 'Your uploaded file will be accessible at<br>' + clipboard_button + '&nbsp;' + upload_path;
$(".context").html(news);
$('#gollum-dialog-action-ok').attr('disabled', false);
+9 -1
View File
@@ -16,8 +16,16 @@ https://github.com/stewartlord/identicon.js/blob/master/README.md
---
CSS Spinner by Franz Heidl is used under the MIT license
CSS Spinner by Franz Heidl is used under the MIT license.
https://github.com/franzheidl/spinners
lib/gollum/public/gollum/stylesheets/_spinners.scss
---
ClipboardJS is used under the MIT license.
https://github.com/zenorocha/clipboard.js
lib/gollum/public/gollum/javascript/clipboard.min.js