workarea-core 3.4.16 → 3.4.17
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/javascripts/workarea/core/modules/copy_to_clipboard.js +42 -0
- data/app/models/workarea/catalog/product_image.rb +8 -7
- data/config/locales/en.yml +2 -0
- data/lib/workarea/ext/freedom_patches/mongoid_simple_tags.rb +4 -0
- data/lib/workarea/version.rb +1 -1
- data/test/lib/workarea/ext/freedom_patches/mongoid_simple_tags_test.rb +34 -0
- data/test/models/workarea/catalog/product_image_test.rb +7 -0
- 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: 7fcb35b8eb25e8cb2efe8c0d9c8a507cb21a4e4b4b4cc30ee09f865047a01727
|
4
|
+
data.tar.gz: 5c99b1025b090027a38a408a7ff534f7cd1a470d6d8df987fd018e2b4c7ee784
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e1471b3fec9635c5e773d5e1a9d3347323265935cb9142223a6b23f44d356ed9fd91ff347ee662e1228867bf2615bb6f353b38419134383955147ecb7f4b675
|
7
|
+
data.tar.gz: e2acb9fe4cba0e7c5b581ee1f60b11c4f952e08abfe94ce154b2e382d6a3b5c7ac50334f5ac1bd718737c8a30a7ce7e426afd3cbad9a94dfdc887969658ea445
|
@@ -0,0 +1,42 @@
|
|
1
|
+
/**
|
2
|
+
* Manages the handling of copying text to clipboard
|
3
|
+
*
|
4
|
+
* @namespace WORKAREA.copyToClipboard
|
5
|
+
*/
|
6
|
+
WORKAREA.registerModule('copyToClipboard', (function () {
|
7
|
+
'use strict';
|
8
|
+
|
9
|
+
var copyText = function(event) {
|
10
|
+
var $button = $(event.target),
|
11
|
+
buttonText = $button.text(),
|
12
|
+
node = document.querySelector($button.data('copyToClipboard')),
|
13
|
+
range = document.createRange();
|
14
|
+
|
15
|
+
range.selectNode(node);
|
16
|
+
window.getSelection().addRange(range);
|
17
|
+
|
18
|
+
if (document.execCommand('copy')) {
|
19
|
+
$button.text(I18n.t('workarea.messages.copied'));
|
20
|
+
} else {
|
21
|
+
$button.text(I18n.t('workarea.messages.copy_failed'));
|
22
|
+
}
|
23
|
+
|
24
|
+
window.setTimeout(function() { $button.text(buttonText); }, 3000);
|
25
|
+
|
26
|
+
// NOTE: Should use removeRange(range) when it is supported
|
27
|
+
window.getSelection().removeAllRanges();
|
28
|
+
},
|
29
|
+
|
30
|
+
/**
|
31
|
+
* @method
|
32
|
+
* @name init
|
33
|
+
* @memberof WORKAREA.copyToClipboard
|
34
|
+
*/
|
35
|
+
init = function ($scope) {
|
36
|
+
$('[data-copy-to-clipboard]', $scope).on('click', copyText);
|
37
|
+
};
|
38
|
+
|
39
|
+
return {
|
40
|
+
init: init
|
41
|
+
};
|
42
|
+
}()));
|
@@ -18,13 +18,14 @@ module Workarea
|
|
18
18
|
# - http://markevans.github.io/dragonfly/imagemagick/#analysers
|
19
19
|
# - http://markevans.github.io/dragonfly/models/#magic-attributes
|
20
20
|
#
|
21
|
-
field :image_width, type: Integer
|
22
|
-
field :image_height, type: Integer
|
23
|
-
field :image_aspect_ratio, type: Float
|
24
|
-
field :image_portrait, type: Boolean
|
25
|
-
field :image_landscape, type: Boolean
|
26
|
-
field :image_format, type: String
|
27
|
-
field :image_image, type: Boolean
|
21
|
+
field :image_width, type: Integer
|
22
|
+
field :image_height, type: Integer
|
23
|
+
field :image_aspect_ratio, type: Float
|
24
|
+
field :image_portrait, type: Boolean
|
25
|
+
field :image_landscape, type: Boolean
|
26
|
+
field :image_format, type: String
|
27
|
+
field :image_image, type: Boolean
|
28
|
+
field :image_inverse_aspect_ratio, type: Float
|
28
29
|
|
29
30
|
embedded_in :product,
|
30
31
|
class_name: 'Workarea::Catalog::Product',
|
data/config/locales/en.yml
CHANGED
@@ -90,6 +90,8 @@ en:
|
|
90
90
|
success: Success
|
91
91
|
generic_error_text: Sorry, there was an error processing your request.
|
92
92
|
loading: Loading...
|
93
|
+
copied: Copied!
|
94
|
+
copy_failed: Failed to Copy!
|
93
95
|
payment:
|
94
96
|
insufficient_payment: "Your payment is insufficient. The remaining balance is %{balance}."
|
95
97
|
transaction_failure: "There was a problem processing your payment. %{message}"
|
data/lib/workarea/version.rb
CHANGED
@@ -0,0 +1,34 @@
|
|
1
|
+
require 'test_helper'
|
2
|
+
|
3
|
+
module Workarea
|
4
|
+
class MongoidSimpleTagsTest < TestCase
|
5
|
+
class Model
|
6
|
+
include ApplicationDocument
|
7
|
+
include Mongoid::Document::Taggable
|
8
|
+
end
|
9
|
+
|
10
|
+
setup :setup_model
|
11
|
+
|
12
|
+
def setup_model
|
13
|
+
@model = Model.create!(tags: %w(foo bar baz foo))
|
14
|
+
end
|
15
|
+
|
16
|
+
def test_tag_list_is_unique
|
17
|
+
assert_equal 'foo, bar, baz', @model.tag_list
|
18
|
+
|
19
|
+
@model.tag_list = 'foo, bar, baz, baz, bat'
|
20
|
+
|
21
|
+
assert_equal('foo, bar, baz, bat', @model.tag_list)
|
22
|
+
end
|
23
|
+
|
24
|
+
def test_tags_are_unique
|
25
|
+
assert_equal %w(foo bar baz), @model.tags
|
26
|
+
|
27
|
+
@model.tags = %w(foo bar bar bar baz bat)
|
28
|
+
|
29
|
+
assert_equal(%w(foo bar baz bat), @model.tags)
|
30
|
+
assert(@model.update!(tags: %w(foo bar bar bar baz bat)))
|
31
|
+
assert(%w(foo bar baz bat), @model.reload.tags)
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -34,6 +34,13 @@ module Workarea
|
|
34
34
|
two = product.images.create!(image: product_image_file, position: 0)
|
35
35
|
assert_equal([two, one], product.reload.images)
|
36
36
|
end
|
37
|
+
|
38
|
+
def test_populate_fields
|
39
|
+
product = create_product
|
40
|
+
image = product.images.create!(image: product_image_file, position: 0)
|
41
|
+
|
42
|
+
assert_equal(1.0, image.image_inverse_aspect_ratio)
|
43
|
+
end
|
37
44
|
end
|
38
45
|
end
|
39
46
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: workarea-core
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.4.
|
4
|
+
version: 3.4.17
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Crouse
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-10-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -1140,6 +1140,7 @@ files:
|
|
1140
1140
|
- app/assets/images/workarea/core/product_placeholder.jpg
|
1141
1141
|
- app/assets/javascripts/workarea/core/config.js
|
1142
1142
|
- app/assets/javascripts/workarea/core/modules/cookie.js
|
1143
|
+
- app/assets/javascripts/workarea/core/modules/copy_to_clipboard.js
|
1143
1144
|
- app/assets/javascripts/workarea/core/modules/date.js
|
1144
1145
|
- app/assets/javascripts/workarea/core/modules/deletion_forms.js
|
1145
1146
|
- app/assets/javascripts/workarea/core/modules/duplicate_id.js
|
@@ -1976,6 +1977,7 @@ files:
|
|
1976
1977
|
- test/lib/workarea/ext/freedom_patches/country_test.rb
|
1977
1978
|
- test/lib/workarea/ext/freedom_patches/dragonfly_callable_url_host_test.rb
|
1978
1979
|
- test/lib/workarea/ext/freedom_patches/global_id_test.rb
|
1980
|
+
- test/lib/workarea/ext/freedom_patches/mongoid_simple_tags_test.rb
|
1979
1981
|
- test/lib/workarea/ext/mongoid/audit_log_entry_test.rb
|
1980
1982
|
- test/lib/workarea/ext/mongoid/each_by_test.rb
|
1981
1983
|
- test/lib/workarea/ext/mongoid/except_test.rb
|