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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b9cad32949d5f74ed9f5d18ea8a1a285ac6649fb
4
- data.tar.gz: 0e9879396d1c71d2baac1acc05d7036bf708a16c
2
+ SHA256:
3
+ metadata.gz: 33a928f130ae10c7a38e5db4d3ebd004b9d4d531928130c22ce656cdefba3972
4
+ data.tar.gz: 04e35aef6230e8d46cd1efe5f8d64e1b9f0ebe90b69f03b07b53d275489a634c
5
5
  SHA512:
6
- metadata.gz: 58273a515e07535c78da207c508ea27f7b0cfa49f94d8024efe0d4935cab10969f3567ca446c79e1b4b6588ea46bb5552dffb25cfa7af36fd6d8b91df64cb56c
7
- data.tar.gz: 7cbd046a907235222e48f1ceb943e49efd6b967aadb97cd57d36cec1909e6eea431fb2fe69c4b71183b0f3eb662e83ed21f28a31da0858e45c9c0c143b980151
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
@@ -0,0 +1,3 @@
1
+ plugins:
2
+ postcss-import: {}
3
+ postcss-cssnext: {}
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)
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.25)
10
+ image_optim (~> 0.26)
11
11
  image_optim_pack (~> 0.5)
12
- image_processing (~> 0.4)
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.7)
17
+ shrine (~> 2.11)
18
18
 
19
19
  GEM
20
20
  remote: https://rubygems.org/
21
21
  specs:
22
- actioncable (5.1.4)
23
- actionpack (= 5.1.4)
22
+ actioncable (5.2.0)
23
+ actionpack (= 5.2.0)
24
24
  nio4r (~> 2.0)
25
- websocket-driver (~> 0.6.1)
26
- actionmailer (5.1.4)
27
- actionpack (= 5.1.4)
28
- actionview (= 5.1.4)
29
- activejob (= 5.1.4)
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.1.4)
33
- actionview (= 5.1.4)
34
- activesupport (= 5.1.4)
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.1.4)
40
- activesupport (= 5.1.4)
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.1.4)
46
- activesupport (= 5.1.4)
45
+ activejob (5.2.0)
46
+ activesupport (= 5.2.0)
47
47
  globalid (>= 0.3.6)
48
- activemodel (5.1.4)
49
- activesupport (= 5.1.4)
50
- activerecord (5.1.4)
51
- activemodel (= 5.1.4)
52
- activesupport (= 5.1.4)
53
- arel (~> 8.0)
54
- activesupport (5.1.4)
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 (~> 0.7)
60
+ i18n (>= 0.7, < 2)
57
61
  minitest (~> 5.1)
58
62
  tzinfo (~> 1.1)
59
- arel (8.0.0)
60
- aws-partitions (1.58.0)
61
- aws-sdk-core (3.14.0)
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.4.0)
71
+ aws-sdk-kms (1.7.0)
66
72
  aws-sdk-core (~> 3)
67
73
  aws-sigv4 (~> 1.0)
68
- aws-sdk-s3 (1.8.0)
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.2)
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.8)
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.3)
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.2.1)
91
- erubi (1.7.0)
92
- exifr (1.3.3)
93
- fastimage (2.1.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.9.3)
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.0.20180124)
115
+ image_optim_pack (0.5.1)
109
116
  fspath (>= 2.1, < 4)
110
117
  image_optim (~> 0.19)
111
- image_processing (0.4.5)
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.3.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.1.1)
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.2.0)
131
- nokogiri (1.8.2)
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.4)
136
- rack-test (0.8.2)
146
+ rack (2.0.5)
147
+ rack-test (1.1.0)
137
148
  rack (>= 1.0, < 3)
138
- rails (5.1.4)
139
- actioncable (= 5.1.4)
140
- actionmailer (= 5.1.4)
141
- actionpack (= 5.1.4)
142
- actionview (= 5.1.4)
143
- activejob (= 5.1.4)
144
- activemodel (= 5.1.4)
145
- activerecord (= 5.1.4)
146
- activesupport (= 5.1.4)
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.1.4)
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.3)
154
- loofah (~> 2.0)
155
- railties (5.1.4)
156
- actionpack (= 5.1.4)
157
- activesupport (= 5.1.4)
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.0)
162
- shrine (2.9.0)
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.1)
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.6.5)
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.1
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 ? Right({ content_item: input[:content_item], field: field }) : Left(:not_found)
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
- Right(tree_list)
16
+ Success(tree_list)
17
17
  end
18
18
  end
@@ -2,6 +2,6 @@ class NewTagFieldItemTransaction < Cortex::ApplicationTransaction
2
2
  step :process
3
3
 
4
4
  def process(field_item)
5
- Right(field_item)
5
+ Success(field_item)
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@ class NewUserFieldItemTransaction < Cortex::ApplicationTransaction
2
2
  step :process
3
3
 
4
4
  def process(field_item)
5
- Right(field_item)
5
+ Success(field_item)
6
6
  end
7
7
  end
@@ -2,6 +2,6 @@ class UpdateTagFieldItemTransaction < Cortex::ApplicationTransaction
2
2
  step :process
3
3
 
4
4
  def process(field_item)
5
- Right(field_item)
5
+ Success(field_item)
6
6
  end
7
7
  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'
@@ -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.7"
31
- s.add_dependency "aws-sdk-s3", "~> 1.5"
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", "~> 0.4"
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.25"
36
+ s.add_dependency "image_optim", "~> 0.26"
37
37
  s.add_dependency "image_optim_pack", "~> 0.5"
38
38
  end
@@ -1,7 +1,7 @@
1
1
  module Cortex
2
2
  module Plugins
3
3
  module Core
4
- VERSION = '3.0.0'
4
+ VERSION = '3.1.0'
5
5
  end
6
6
  end
7
7
  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.18.1",
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": "^3.0.2",
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",