web47core 1.0.3 → 1.0.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2b4f72b9f26745f8ec3e9271900bb50d375b1e77e6a24fdcd459e12c7903778d
4
- data.tar.gz: c4e966240c8255ffb06cdcf5bffd743481eb340f84691c8d83453a10d19ac8f4
3
+ metadata.gz: 19ad57cb88f8e3915846ba74bfb5151c5ebc66be678b731e5b94dfc15e295b91
4
+ data.tar.gz: f01456dc0a54891dc091745a4a338e955f35b139d11a891ca553db36696ff897
5
5
  SHA512:
6
- metadata.gz: b2f1c2d5c5f0be9902a6b0f26065222bba5c7c7f2b932428ef1d2294fdb6ee028038de1826d88f58a67e8606f91130e5745de808e1bc0660a8ed118aae726bca
7
- data.tar.gz: 95f9fa0eb72cd0d1d292d1677a3b782d5547e38fca617a96c1f1fe9a7f0291a145d8b44baefbedaf41c15e56d7f89bc8be46ca3df660f753a77d1e278e40fe7f
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
@@ -0,0 +1,13 @@
1
+ p.clipboard {
2
+ margin: 0 0 0 2px;
3
+ padding: 0;
4
+ span {
5
+ font-size: 1rem;
6
+ }
7
+ a.copy {
8
+ i.material-icons {
9
+ i.material-icons;
10
+ font-size: 1rem;
11
+ }
12
+ }
13
+ }
@@ -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: 'stack-tight') do
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?
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Web47core
4
- VERSION = '1.0.3'
4
+ VERSION = '1.0.4'
5
5
  end
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.3
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-18 00:00:00.000000000 Z
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