web47core 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/assets/javascript/clipboard.coffee +34 -0
- data/app/assets/stylesheets/clipboard.scss +13 -0
- data/app/helpers/core_link_helper.rb +1 -1
- data/lib/web47core/version.rb +1 -1
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 19ad57cb88f8e3915846ba74bfb5151c5ebc66be678b731e5b94dfc15e295b91
|
4
|
+
data.tar.gz: f01456dc0a54891dc091745a4a338e955f35b139d11a891ca553db36696ff897
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5898e05f8e14c6193dd0d67fe4708a73963080b35845a21523619fe91124b154168e768a6fed1fd4075dbc27dbb4a2a27553289d26aba359d3e975dc7cd6dda9
|
7
|
+
data.tar.gz: 2f3fb0df2af5f3c372b640b0074ed54f510ff4cc54638bb2bb07b440b752c3e1dc1324bbd569126ffb2edc0cdddd54adaabb12d8e12f2356fb22a879422bc073
|
@@ -0,0 +1,34 @@
|
|
1
|
+
#
|
2
|
+
# Enable copy capability to the machines copy/paste buffer
|
3
|
+
#
|
4
|
+
$(document).ready ->
|
5
|
+
if clipboardEnabled()
|
6
|
+
$('a.copy').on 'click', (e) ->
|
7
|
+
node = e.target
|
8
|
+
textField = document.createElement('textarea')
|
9
|
+
node.parentNode.insertBefore(textField, node)
|
10
|
+
try
|
11
|
+
textField.innerText = $(this).data('clipboard-text')
|
12
|
+
textField.select()
|
13
|
+
textField.focus()
|
14
|
+
if document.execCommand('copy')
|
15
|
+
M.toast({html: 'Copied!'}, 3000);
|
16
|
+
else
|
17
|
+
M.toast({html: 'Unable to copy text'}, 3000);
|
18
|
+
catch error
|
19
|
+
M.toast({html: 'Unable to copy text'}, 3000);
|
20
|
+
finally
|
21
|
+
textField.parentNode.removeChild(textField)
|
22
|
+
|
23
|
+
else
|
24
|
+
$('.copy').hide()
|
25
|
+
|
26
|
+
#
|
27
|
+
# Test that we can issue the execCommand for copy and that it returns
|
28
|
+
#
|
29
|
+
clipboardEnabled = ->
|
30
|
+
try
|
31
|
+
document.execCommand('copy')
|
32
|
+
true
|
33
|
+
catch error
|
34
|
+
false
|
@@ -17,7 +17,7 @@ module CoreLinkHelper
|
|
17
17
|
# Setup the text as copy text
|
18
18
|
#
|
19
19
|
def copy_tag(copy_text, options = {})
|
20
|
-
content_tag(:p, class: '
|
20
|
+
content_tag(:p, class: 'clipboard') do
|
21
21
|
concat(content_tag(:span) { copy_text })
|
22
22
|
concat(copy_text_tag(copy_text, options))
|
23
23
|
concat(download_tag(options[:download_url], options)) if options[:download_url].present?
|
data/lib/web47core/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: web47core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Schroeder
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-08-
|
11
|
+
date: 2020-08-20 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -570,7 +570,9 @@ files:
|
|
570
570
|
- LICENSE
|
571
571
|
- README.md
|
572
572
|
- app/assets/images/1x1.png
|
573
|
+
- app/assets/javascript/clipboard.coffee
|
573
574
|
- app/assets/javascript/flash.coffee
|
575
|
+
- app/assets/stylesheets/clipboard.scss
|
574
576
|
- app/controllers/exceptions_controller.rb
|
575
577
|
- app/controllers/notifications_controller.rb
|
576
578
|
- app/controllers/status_controller.rb
|