cortex-plugins-core 3.0.0 → 3.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.babelrc +18 -0
- data/.postcssrc.yml +3 -0
- data/Gemfile.lock +82 -68
- data/app/cells/plugins/core/asset_cell.rb +3 -1
- data/app/transactions/get_field_tree_list_transaction.rb +2 -2
- data/app/transactions/new_tag_field_item_transaction.rb +1 -1
- data/app/transactions/new_user_field_item_transaction.rb +1 -1
- data/app/transactions/update_tag_field_item_transaction.rb +1 -1
- data/app/widgets/plugins/core/media_widget_parser.rb +53 -0
- data/config/initializers/tag_parsers.rb +1 -0
- data/cortex-plugins-core.gemspec +4 -4
- data/lib/cortex/plugins/core/version.rb +1 -1
- data/package.json +3 -2
- data/yarn.lock +1568 -793
- metadata +15 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 33a928f130ae10c7a38e5db4d3ebd004b9d4d531928130c22ce656cdefba3972
|
4
|
+
data.tar.gz: 04e35aef6230e8d46cd1efe5f8d64e1b9f0ebe90b69f03b07b53d275489a634c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cfdeb92656284976349ecc4f67dcc57054695879d9b8d94a7c36407a415d4c70059694313f8566595dbd18c8519342de6719fc7ed04e9220e6d6a63bcad84664
|
7
|
+
data.tar.gz: d08981a24f6b84e9b3aa7421f216c67746348120faf089ed5f48ec6d0ee2b2e6b790259b76306b7345ee6a769e62c1f31491f5c673d95dff5991f7a3b1c9e7e3
|
data/.babelrc
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
{
|
2
|
+
"presets": [
|
3
|
+
["env", {
|
4
|
+
"modules": false,
|
5
|
+
"targets": {
|
6
|
+
"browsers": "> 1%",
|
7
|
+
"uglify": true
|
8
|
+
},
|
9
|
+
"useBuiltIns": true
|
10
|
+
}]
|
11
|
+
],
|
12
|
+
|
13
|
+
"plugins": [
|
14
|
+
"syntax-dynamic-import",
|
15
|
+
"transform-object-rest-spread",
|
16
|
+
["transform-class-properties", { "spec": true }]
|
17
|
+
]
|
18
|
+
}
|
data/.postcssrc.yml
ADDED
data/Gemfile.lock
CHANGED
@@ -2,74 +2,80 @@ PATH
|
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
4
|
cortex-plugins-core (3.0.0)
|
5
|
-
aws-sdk-s3 (~> 1.
|
5
|
+
aws-sdk-s3 (~> 1.17)
|
6
6
|
cells (~> 4.1)
|
7
7
|
cells-haml (~> 0.0)
|
8
8
|
cells-rails (~> 0.0)
|
9
9
|
fastimage (~> 2.1)
|
10
|
-
image_optim (~> 0.
|
10
|
+
image_optim (~> 0.26)
|
11
11
|
image_optim_pack (~> 0.5)
|
12
|
-
image_processing (~>
|
12
|
+
image_processing (~> 1.6)
|
13
13
|
jsonb_accessor (~> 1.0)
|
14
14
|
mimemagic (~> 0.3)
|
15
15
|
mini_magick (~> 4.8)
|
16
16
|
rails (>= 5)
|
17
|
-
shrine (~> 2.
|
17
|
+
shrine (~> 2.11)
|
18
18
|
|
19
19
|
GEM
|
20
20
|
remote: https://rubygems.org/
|
21
21
|
specs:
|
22
|
-
actioncable (5.
|
23
|
-
actionpack (= 5.
|
22
|
+
actioncable (5.2.0)
|
23
|
+
actionpack (= 5.2.0)
|
24
24
|
nio4r (~> 2.0)
|
25
|
-
websocket-driver (
|
26
|
-
actionmailer (5.
|
27
|
-
actionpack (= 5.
|
28
|
-
actionview (= 5.
|
29
|
-
activejob (= 5.
|
25
|
+
websocket-driver (>= 0.6.1)
|
26
|
+
actionmailer (5.2.0)
|
27
|
+
actionpack (= 5.2.0)
|
28
|
+
actionview (= 5.2.0)
|
29
|
+
activejob (= 5.2.0)
|
30
30
|
mail (~> 2.5, >= 2.5.4)
|
31
31
|
rails-dom-testing (~> 2.0)
|
32
|
-
actionpack (5.
|
33
|
-
actionview (= 5.
|
34
|
-
activesupport (= 5.
|
32
|
+
actionpack (5.2.0)
|
33
|
+
actionview (= 5.2.0)
|
34
|
+
activesupport (= 5.2.0)
|
35
35
|
rack (~> 2.0)
|
36
36
|
rack-test (>= 0.6.3)
|
37
37
|
rails-dom-testing (~> 2.0)
|
38
38
|
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
39
|
-
actionview (5.
|
40
|
-
activesupport (= 5.
|
39
|
+
actionview (5.2.0)
|
40
|
+
activesupport (= 5.2.0)
|
41
41
|
builder (~> 3.1)
|
42
42
|
erubi (~> 1.4)
|
43
43
|
rails-dom-testing (~> 2.0)
|
44
44
|
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
45
|
-
activejob (5.
|
46
|
-
activesupport (= 5.
|
45
|
+
activejob (5.2.0)
|
46
|
+
activesupport (= 5.2.0)
|
47
47
|
globalid (>= 0.3.6)
|
48
|
-
activemodel (5.
|
49
|
-
activesupport (= 5.
|
50
|
-
activerecord (5.
|
51
|
-
activemodel (= 5.
|
52
|
-
activesupport (= 5.
|
53
|
-
arel (
|
54
|
-
|
48
|
+
activemodel (5.2.0)
|
49
|
+
activesupport (= 5.2.0)
|
50
|
+
activerecord (5.2.0)
|
51
|
+
activemodel (= 5.2.0)
|
52
|
+
activesupport (= 5.2.0)
|
53
|
+
arel (>= 9.0)
|
54
|
+
activestorage (5.2.0)
|
55
|
+
actionpack (= 5.2.0)
|
56
|
+
activerecord (= 5.2.0)
|
57
|
+
marcel (~> 0.3.1)
|
58
|
+
activesupport (5.2.0)
|
55
59
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
56
|
-
i18n (
|
60
|
+
i18n (>= 0.7, < 2)
|
57
61
|
minitest (~> 5.1)
|
58
62
|
tzinfo (~> 1.1)
|
59
|
-
arel (
|
60
|
-
aws-
|
61
|
-
aws-
|
63
|
+
arel (9.0.0)
|
64
|
+
aws-eventstream (1.0.1)
|
65
|
+
aws-partitions (1.97.0)
|
66
|
+
aws-sdk-core (3.23.0)
|
67
|
+
aws-eventstream (~> 1.0)
|
62
68
|
aws-partitions (~> 1.0)
|
63
69
|
aws-sigv4 (~> 1.0)
|
64
70
|
jmespath (~> 1.0)
|
65
|
-
aws-sdk-kms (1.
|
71
|
+
aws-sdk-kms (1.7.0)
|
66
72
|
aws-sdk-core (~> 3)
|
67
73
|
aws-sigv4 (~> 1.0)
|
68
|
-
aws-sdk-s3 (1.
|
69
|
-
aws-sdk-core (~> 3)
|
74
|
+
aws-sdk-s3 (1.17.0)
|
75
|
+
aws-sdk-core (~> 3, >= 3.21.2)
|
70
76
|
aws-sdk-kms (~> 1)
|
71
77
|
aws-sigv4 (~> 1.0)
|
72
|
-
aws-sigv4 (1.0.
|
78
|
+
aws-sigv4 (1.0.3)
|
73
79
|
builder (3.2.3)
|
74
80
|
cells (4.1.7)
|
75
81
|
declarative-builder (< 0.2.0)
|
@@ -79,25 +85,26 @@ GEM
|
|
79
85
|
cells-haml (0.0.10)
|
80
86
|
cells (>= 4.0.1, <= 6.0.0)
|
81
87
|
haml (>= 4.1.0.beta.1)
|
82
|
-
cells-rails (0.0.
|
88
|
+
cells-rails (0.0.9)
|
83
89
|
actionpack (>= 3.0)
|
84
90
|
cells (>= 4.1.6, < 5.0.0)
|
85
91
|
concurrent-ruby (1.0.5)
|
86
|
-
crass (1.0.
|
92
|
+
crass (1.0.4)
|
87
93
|
declarative-builder (0.1.0)
|
88
94
|
declarative-option (< 0.2.0)
|
89
95
|
declarative-option (0.1.0)
|
90
|
-
down (4.
|
91
|
-
erubi (1.7.
|
92
|
-
exifr (1.3.
|
93
|
-
fastimage (2.1.
|
96
|
+
down (4.5.0)
|
97
|
+
erubi (1.7.1)
|
98
|
+
exifr (1.3.4)
|
99
|
+
fastimage (2.1.3)
|
100
|
+
ffi (1.9.25)
|
94
101
|
fspath (3.1.0)
|
95
102
|
globalid (0.4.1)
|
96
103
|
activesupport (>= 4.2.0)
|
97
104
|
haml (5.0.4)
|
98
105
|
temple (>= 0.8.0)
|
99
106
|
tilt
|
100
|
-
i18n (0.
|
107
|
+
i18n (1.0.1)
|
101
108
|
concurrent-ruby (~> 1.0)
|
102
109
|
image_optim (0.26.1)
|
103
110
|
exifr (~> 1.2, >= 1.2.2)
|
@@ -105,63 +112,70 @@ GEM
|
|
105
112
|
image_size (~> 1.5)
|
106
113
|
in_threads (~> 1.3)
|
107
114
|
progress (~> 3.0, >= 3.0.1)
|
108
|
-
image_optim_pack (0.5.
|
115
|
+
image_optim_pack (0.5.1)
|
109
116
|
fspath (>= 2.1, < 4)
|
110
117
|
image_optim (~> 0.19)
|
111
|
-
image_processing (
|
118
|
+
image_processing (1.6.0)
|
119
|
+
mini_magick (~> 4.0)
|
120
|
+
ruby-vips (>= 2.0.11, < 3)
|
112
121
|
image_size (1.5.0)
|
113
122
|
in_threads (1.5.0)
|
114
|
-
jmespath (1.
|
123
|
+
jmespath (1.4.0)
|
115
124
|
jsonb_accessor (1.0.0)
|
116
125
|
activerecord (>= 5.0)
|
117
126
|
activesupport (>= 5.0)
|
118
127
|
pg (>= 0.18.1)
|
119
|
-
loofah (2.
|
128
|
+
loofah (2.2.2)
|
120
129
|
crass (~> 1.0.2)
|
121
130
|
nokogiri (>= 1.5.9)
|
122
131
|
mail (2.7.0)
|
123
132
|
mini_mime (>= 0.1.1)
|
133
|
+
marcel (0.3.2)
|
134
|
+
mimemagic (~> 0.3.2)
|
124
135
|
method_source (0.9.0)
|
125
136
|
mimemagic (0.3.2)
|
126
137
|
mini_magick (4.8.0)
|
127
138
|
mini_mime (1.0.0)
|
128
139
|
mini_portile2 (2.3.0)
|
129
140
|
minitest (5.11.3)
|
130
|
-
nio4r (2.
|
131
|
-
nokogiri (1.8.
|
141
|
+
nio4r (2.3.1)
|
142
|
+
nokogiri (1.8.4)
|
132
143
|
mini_portile2 (~> 2.3.0)
|
133
144
|
pg (1.0.0)
|
134
145
|
progress (3.4.0)
|
135
|
-
rack (2.0.
|
136
|
-
rack-test (
|
146
|
+
rack (2.0.5)
|
147
|
+
rack-test (1.1.0)
|
137
148
|
rack (>= 1.0, < 3)
|
138
|
-
rails (5.
|
139
|
-
actioncable (= 5.
|
140
|
-
actionmailer (= 5.
|
141
|
-
actionpack (= 5.
|
142
|
-
actionview (= 5.
|
143
|
-
activejob (= 5.
|
144
|
-
activemodel (= 5.
|
145
|
-
activerecord (= 5.
|
146
|
-
|
149
|
+
rails (5.2.0)
|
150
|
+
actioncable (= 5.2.0)
|
151
|
+
actionmailer (= 5.2.0)
|
152
|
+
actionpack (= 5.2.0)
|
153
|
+
actionview (= 5.2.0)
|
154
|
+
activejob (= 5.2.0)
|
155
|
+
activemodel (= 5.2.0)
|
156
|
+
activerecord (= 5.2.0)
|
157
|
+
activestorage (= 5.2.0)
|
158
|
+
activesupport (= 5.2.0)
|
147
159
|
bundler (>= 1.3.0)
|
148
|
-
railties (= 5.
|
160
|
+
railties (= 5.2.0)
|
149
161
|
sprockets-rails (>= 2.0.0)
|
150
162
|
rails-dom-testing (2.0.3)
|
151
163
|
activesupport (>= 4.2.0)
|
152
164
|
nokogiri (>= 1.6)
|
153
|
-
rails-html-sanitizer (1.0.
|
154
|
-
loofah (~> 2.
|
155
|
-
railties (5.
|
156
|
-
actionpack (= 5.
|
157
|
-
activesupport (= 5.
|
165
|
+
rails-html-sanitizer (1.0.4)
|
166
|
+
loofah (~> 2.2, >= 2.2.2)
|
167
|
+
railties (5.2.0)
|
168
|
+
actionpack (= 5.2.0)
|
169
|
+
activesupport (= 5.2.0)
|
158
170
|
method_source
|
159
171
|
rake (>= 0.8.7)
|
160
172
|
thor (>= 0.18.1, < 2.0)
|
161
|
-
rake (12.3.
|
162
|
-
|
173
|
+
rake (12.3.1)
|
174
|
+
ruby-vips (2.0.12)
|
175
|
+
ffi (~> 1.9)
|
176
|
+
shrine (2.11.0)
|
163
177
|
down (~> 4.1)
|
164
|
-
sprockets (3.7.
|
178
|
+
sprockets (3.7.2)
|
165
179
|
concurrent-ruby (~> 1.0)
|
166
180
|
rack (> 1, < 3)
|
167
181
|
sprockets-rails (3.2.1)
|
@@ -175,7 +189,7 @@ GEM
|
|
175
189
|
tzinfo (1.2.5)
|
176
190
|
thread_safe (~> 0.1)
|
177
191
|
uber (0.1.0)
|
178
|
-
websocket-driver (0.
|
192
|
+
websocket-driver (0.7.0)
|
179
193
|
websocket-extensions (>= 0.1.0)
|
180
194
|
websocket-extensions (0.1.3)
|
181
195
|
|
@@ -186,4 +200,4 @@ DEPENDENCIES
|
|
186
200
|
cortex-plugins-core!
|
187
201
|
|
188
202
|
BUNDLED WITH
|
189
|
-
1.16.
|
203
|
+
1.16.3
|
@@ -1,9 +1,11 @@
|
|
1
|
+
require 'helpers/utility_helper'
|
2
|
+
|
1
3
|
module Plugins
|
2
4
|
module Core
|
3
5
|
class AssetCell < Plugins::Core::Cell
|
4
6
|
include ActionView::Helpers::NumberHelper
|
7
|
+
include Cortex::Cells::AssociationHelper
|
5
8
|
include UtilityHelper
|
6
|
-
include Cells::AssociationHelper
|
7
9
|
|
8
10
|
def input
|
9
11
|
render
|
@@ -5,7 +5,7 @@ class GetFieldTreeListTransaction < Cortex::ApplicationTransaction
|
|
5
5
|
def init(input)
|
6
6
|
field = Field.find_by_id(input[:args]['field_id'])
|
7
7
|
|
8
|
-
field ?
|
8
|
+
field ? Success({ content_item: input[:content_item], field: field }) : Failure(:not_found)
|
9
9
|
end
|
10
10
|
|
11
11
|
def process(input)
|
@@ -13,6 +13,6 @@ class GetFieldTreeListTransaction < Cortex::ApplicationTransaction
|
|
13
13
|
tree_values = input[:content_item].field_items.find {|field_item| field_item.field_id == input[:field].id}.data['values']
|
14
14
|
|
15
15
|
tree_list = tree_values.map {|value| tree_array.find {|node| node['id'] == value.to_i}['node']['name']}.join(',')
|
16
|
-
|
16
|
+
Success(tree_list)
|
17
17
|
end
|
18
18
|
end
|
@@ -0,0 +1,53 @@
|
|
1
|
+
# TODO: Refactor namespacing
|
2
|
+
|
3
|
+
module Plugins
|
4
|
+
module Core
|
5
|
+
module MediaWidgetParser
|
6
|
+
def self.parse(body)
|
7
|
+
body_document = document_for body
|
8
|
+
|
9
|
+
widget_nodes_for(body_document).each do |widget_node|
|
10
|
+
widget_node.inner_html = render_widget_inner widget_node
|
11
|
+
end
|
12
|
+
|
13
|
+
body_document.to_html
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.document_for(html)
|
17
|
+
Nokogiri::HTML::DocumentFragment.parse html
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.widget_nodes_for(document)
|
21
|
+
document.css 'media'
|
22
|
+
end
|
23
|
+
|
24
|
+
def self.render_widget_inner(widget)
|
25
|
+
Nokogiri::HTML::Builder.new do |doc|
|
26
|
+
element, tag_type = content_item_element(widget['id'])
|
27
|
+
element.merge!({ width: widget['width'], height: widget['height'], alt: widget['alt'], style: widget['style'], class: widget['class'] })
|
28
|
+
|
29
|
+
doc.send(tag_type, element)
|
30
|
+
end.doc.root
|
31
|
+
end
|
32
|
+
|
33
|
+
def self.content_item_element(id)
|
34
|
+
asset_field_item = ContentItem.find(id).field_items.find { |field_item| field_item.field.field_type_instance.is_a?(AssetFieldType) }
|
35
|
+
url = asset_field_item.data['asset']['versions']['original']['url']
|
36
|
+
|
37
|
+
if image? asset_field_item.data['asset']['versions']['original']['mime_type']
|
38
|
+
element = { src: url }
|
39
|
+
tag_type = 'img'
|
40
|
+
else
|
41
|
+
element = { href: url }
|
42
|
+
tag_type = 'a'
|
43
|
+
end
|
44
|
+
|
45
|
+
[element, tag_type]
|
46
|
+
end
|
47
|
+
|
48
|
+
def self.image?(mime_type)
|
49
|
+
MimeMagic.new(mime_type).mediatype == 'image'
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
@@ -0,0 +1 @@
|
|
1
|
+
Cortex.tag_parsers << 'Plugins::Core::MediaWidgetParser'
|
data/cortex-plugins-core.gemspec
CHANGED
@@ -27,12 +27,12 @@ Gem::Specification.new do |s|
|
|
27
27
|
s.add_dependency "jsonb_accessor", "~> 1.0"
|
28
28
|
|
29
29
|
# AssetFieldType
|
30
|
-
s.add_dependency "shrine", "~> 2.
|
31
|
-
s.add_dependency "aws-sdk-s3", "~> 1.
|
30
|
+
s.add_dependency "shrine", "~> 2.11"
|
31
|
+
s.add_dependency "aws-sdk-s3", "~> 1.17"
|
32
32
|
s.add_dependency "mimemagic", "~> 0.3"
|
33
|
-
s.add_dependency "image_processing", "~>
|
33
|
+
s.add_dependency "image_processing", "~> 1.6"
|
34
34
|
s.add_dependency "mini_magick", "~> 4.8"
|
35
35
|
s.add_dependency "fastimage", "~> 2.1"
|
36
|
-
s.add_dependency "image_optim", "~> 0.
|
36
|
+
s.add_dependency "image_optim", "~> 0.26"
|
37
37
|
s.add_dependency "image_optim_pack", "~> 0.5"
|
38
38
|
end
|
data/package.json
CHANGED
@@ -14,7 +14,7 @@
|
|
14
14
|
"redux": "^3.7.2",
|
15
15
|
"redux-logger": "^3.0.6",
|
16
16
|
"underscore": "~> 1.8.3",
|
17
|
-
"moment": "~> 2.
|
17
|
+
"moment": "~> 2.19.3",
|
18
18
|
"bootstrap-sass": "~> 3.3.7",
|
19
19
|
"jquery-ui-timepicker-addon": "~> 1.6.3",
|
20
20
|
"clipboard": "~> 1.7.1",
|
@@ -22,8 +22,9 @@
|
|
22
22
|
"axios": "^0.16.2"
|
23
23
|
},
|
24
24
|
"devDependencies": {
|
25
|
-
"@rails/webpacker": "
|
25
|
+
"@rails/webpacker": "3.0.2",
|
26
26
|
"babel-preset-react": "^6.24.1",
|
27
|
+
"babel-cli": "^6.26.0",
|
27
28
|
"coffeescript": "1.12.7",
|
28
29
|
"prop-types": "^15.6.0",
|
29
30
|
"react": "^16.0.0",
|