cortex-plugins-core 2.1.1 → 3.0.0
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/.editorconfig +9 -0
- data/.github/PULL_REQUEST_TEMPLATE.md +47 -0
- data/.gitignore +82 -0
- data/.npmignore +33 -0
- data/.rspec +3 -0
- data/CODE_OF_CONDUCT.md +74 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +189 -0
- data/app/assets/config/cortex_plugins_core_manifest.js +2 -0
- data/app/assets/images/cortex-plugins-core/.keep +0 -0
- data/app/assets/stylesheets/cortex-plugins-core/application.scss +1 -2
- data/app/cells/plugins/core/cell.rb +2 -4
- data/app/cells/plugins/core/content_item_cell.rb +1 -1
- data/app/graphql/interfaces/.keep +0 -0
- data/app/graphql/types/.keep +0 -0
- data/app/models/asset_field_type.rb +1 -1
- data/app/models/author_field_type.rb +1 -1
- data/app/models/boolean_field_type.rb +1 -1
- data/app/models/content_item_field_type.rb +1 -1
- data/app/models/date_time_field_type.rb +1 -1
- data/app/models/float_field_type.rb +1 -1
- data/app/models/integer_field_type.rb +1 -1
- data/app/models/tag_field_type.rb +1 -1
- data/app/models/text_field_type.rb +1 -1
- data/app/models/tree_field_type.rb +1 -1
- data/app/models/user_field_type.rb +1 -1
- data/app/transactions/get_field_tree_list_transaction.rb +1 -1
- 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/bin/rails +13 -0
- data/cortex-plugins-core.gemspec +38 -0
- data/lib/cortex/plugins/core/engine.rb +4 -2
- data/lib/cortex/plugins/core/version.rb +1 -1
- data/lib/tasks/cortex/core/media.rake +10 -10
- data/node_package/.babelrc +26 -0
- data/node_package/src/actions/helloWorld2ActionCreators.jsx +8 -0
- data/node_package/src/components/asset_field_type.jsx +34 -0
- data/node_package/src/components/date_time_type.jsx +35 -0
- data/node_package/src/components/index.jsx +12 -0
- data/node_package/src/components/tag_field_type.jsx +41 -0
- data/node_package/src/components/text_field_type.jsx +82 -0
- data/node_package/src/constants/helloWorld2Constants.jsx +3 -0
- data/node_package/src/containers/HelloWorld2Container.jsx +13 -0
- data/node_package/src/index.jsx +15 -0
- data/node_package/src/reducers/helloWorld2Reducer.jsx +15 -0
- data/node_package/src/startup/HelloWorld2App.jsx +18 -0
- data/node_package/src/startup/registration.jsx +8 -0
- data/node_package/src/store/helloWorld2Store.jsx +8 -0
- data/package.json +43 -0
- data/yarn.lock +5229 -0
- metadata +33 -6
- data/app/assets/stylesheets/cortex-plugins-core/variables/_typography.scss +0 -114
- data/lib/tasks/cortex/core/db.rake +0 -30
|
File without changes
|
|
@@ -1,6 +1,5 @@
|
|
|
1
|
-
// TODO:
|
|
1
|
+
// TODO: This file should be removed once we abstract Cortex styles to a cortex-style-base lib
|
|
2
2
|
@import 'variables/colors';
|
|
3
|
-
@import 'variables/typography';
|
|
4
3
|
|
|
5
4
|
@import 'components/tags-input';
|
|
6
5
|
@import 'components/thumbnail-placeholder';
|
|
@@ -1,9 +1,7 @@
|
|
|
1
1
|
module Plugins
|
|
2
2
|
module Core
|
|
3
|
-
class Cell < FieldCell
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
view_paths << "#{Cortex::Plugins::Core::Engine.root}/app/cells"
|
|
3
|
+
class Cell < Cortex::FieldCell
|
|
4
|
+
self.view_paths = ["#{Cortex::Plugins::Core::Engine.root}/app/cells"]
|
|
7
5
|
|
|
8
6
|
def required?
|
|
9
7
|
field.validations["presence"]
|
|
File without changes
|
|
File without changes
|
data/bin/rails
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
#!/usr/bin/env ruby
|
|
2
|
+
# This command will automatically be run when you run "rails" with Rails gems
|
|
3
|
+
# installed from the root of your application.
|
|
4
|
+
|
|
5
|
+
ENGINE_ROOT = File.expand_path('../..', __FILE__)
|
|
6
|
+
ENGINE_PATH = File.expand_path('../../lib/cortex/plugins/core/engine', __FILE__)
|
|
7
|
+
|
|
8
|
+
# Set up gems listed in the Gemfile.
|
|
9
|
+
ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../Gemfile', __FILE__)
|
|
10
|
+
require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
|
|
11
|
+
|
|
12
|
+
require 'rails/all'
|
|
13
|
+
require 'rails/engine/commands'
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
$:.push File.expand_path("lib", __dir__)
|
|
2
|
+
|
|
3
|
+
# Maintain your gem's version:
|
|
4
|
+
require "cortex/plugins/core/version"
|
|
5
|
+
|
|
6
|
+
# Describe your gem and declare its dependencies:
|
|
7
|
+
Gem::Specification.new do |s|
|
|
8
|
+
s.name = "cortex-plugins-core"
|
|
9
|
+
s.version = Cortex::Plugins::Core::VERSION
|
|
10
|
+
s.authors = ['CareerBuilder Employer Site & Content Products']
|
|
11
|
+
s.email = 'toastercup@gmail.com'
|
|
12
|
+
|
|
13
|
+
s.summary = %q{The combined set of Core FieldTypes for the Cortex CMS platform}
|
|
14
|
+
s.homepage = "https://github.com/cortex-cms/cortex-plugins-core"
|
|
15
|
+
s.license = "Apache-2.0"
|
|
16
|
+
|
|
17
|
+
s.files = `git ls-files -z`.split("\x0").reject do |f|
|
|
18
|
+
f.match(%r{^(test|spec|features)/})
|
|
19
|
+
end
|
|
20
|
+
s.test_files = Dir["spec/**/*"]
|
|
21
|
+
s.require_paths = ["lib"]
|
|
22
|
+
|
|
23
|
+
s.add_dependency "rails", ">= 5"
|
|
24
|
+
s.add_dependency "cells", "~> 4.1"
|
|
25
|
+
s.add_dependency "cells-rails", "~> 0.0"
|
|
26
|
+
s.add_dependency "cells-haml", "~> 0.0"
|
|
27
|
+
s.add_dependency "jsonb_accessor", "~> 1.0"
|
|
28
|
+
|
|
29
|
+
# AssetFieldType
|
|
30
|
+
s.add_dependency "shrine", "~> 2.7"
|
|
31
|
+
s.add_dependency "aws-sdk-s3", "~> 1.5"
|
|
32
|
+
s.add_dependency "mimemagic", "~> 0.3"
|
|
33
|
+
s.add_dependency "image_processing", "~> 0.4"
|
|
34
|
+
s.add_dependency "mini_magick", "~> 4.8"
|
|
35
|
+
s.add_dependency "fastimage", "~> 2.1"
|
|
36
|
+
s.add_dependency "image_optim", "~> 0.25"
|
|
37
|
+
s.add_dependency "image_optim_pack", "~> 0.5"
|
|
38
|
+
end
|
|
@@ -5,8 +5,10 @@ module Cortex
|
|
|
5
5
|
module Plugins
|
|
6
6
|
module Core
|
|
7
7
|
class Engine < ::Rails::Engine
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
isolate_namespace Cortex::Plugins::Core
|
|
9
|
+
|
|
10
|
+
initializer "cortex-plugins-core.precompile_manifest" do |app|
|
|
11
|
+
app.config.assets.precompile += %w(cortex_plugins_core_manifest)
|
|
10
12
|
end
|
|
11
13
|
end
|
|
12
14
|
end
|
|
@@ -5,17 +5,17 @@ namespace :cortex do
|
|
|
5
5
|
namespace :media do
|
|
6
6
|
desc 'Seed Cortex Media ContentType and Fields'
|
|
7
7
|
task seed: :environment do
|
|
8
|
-
example_tenant = Tenant.find_by_name('Example')
|
|
8
|
+
example_tenant = Cortex::Tenant.find_by_name('Example')
|
|
9
9
|
|
|
10
10
|
puts "Creating Media ContentType..."
|
|
11
|
-
media = ContentType.new({
|
|
11
|
+
media = Cortex::ContentType.new({
|
|
12
12
|
name: "Media",
|
|
13
13
|
name_id: "media",
|
|
14
14
|
description: "Media for Cortex",
|
|
15
15
|
icon: "collections",
|
|
16
16
|
tenant: example_tenant,
|
|
17
|
-
creator: User.first,
|
|
18
|
-
contract: Contract.first # TODO: This is obviously bad. This whole file is bad.
|
|
17
|
+
creator: Cortex::User.first,
|
|
18
|
+
contract: Cortex::Contract.first # TODO: This is obviously bad. This whole file is bad.
|
|
19
19
|
})
|
|
20
20
|
media.save!
|
|
21
21
|
|
|
@@ -162,13 +162,13 @@ namespace :cortex do
|
|
|
162
162
|
]
|
|
163
163
|
}
|
|
164
164
|
|
|
165
|
-
media_wizard_decorator = Decorator.new(name: "Wizard", data: wizard_hash, tenant: example_tenant)
|
|
165
|
+
media_wizard_decorator = Cortex::Decorator.new(name: "Wizard", data: wizard_hash, tenant: example_tenant)
|
|
166
166
|
media_wizard_decorator.save!
|
|
167
167
|
|
|
168
|
-
ContentableDecorator.create!({
|
|
168
|
+
Cortex::ContentableDecorator.create!({
|
|
169
169
|
decorator_id: media_wizard_decorator.id,
|
|
170
170
|
contentable_id: media.id,
|
|
171
|
-
contentable_type: 'ContentType',
|
|
171
|
+
contentable_type: 'Cortex::ContentType',
|
|
172
172
|
tenant: example_tenant
|
|
173
173
|
})
|
|
174
174
|
|
|
@@ -246,13 +246,13 @@ namespace :cortex do
|
|
|
246
246
|
]
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
-
media_index_decorator = Decorator.new(name: "Index", data: index_hash, tenant: example_tenant)
|
|
249
|
+
media_index_decorator = Cortex::Decorator.new(name: "Index", data: index_hash, tenant: example_tenant)
|
|
250
250
|
media_index_decorator.save!
|
|
251
251
|
|
|
252
|
-
ContentableDecorator.create!({
|
|
252
|
+
Cortex::ContentableDecorator.create!({
|
|
253
253
|
decorator_id: media_index_decorator.id,
|
|
254
254
|
contentable_id: media.id,
|
|
255
|
-
contentable_type: 'ContentType',
|
|
255
|
+
contentable_type: 'Cortex::ContentType',
|
|
256
256
|
tenant: example_tenant
|
|
257
257
|
})
|
|
258
258
|
end
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
{
|
|
2
|
+
"presets": [
|
|
3
|
+
[
|
|
4
|
+
"env",
|
|
5
|
+
{
|
|
6
|
+
"modules": false,
|
|
7
|
+
"targets": {
|
|
8
|
+
"browsers": "> 1%",
|
|
9
|
+
"uglify": true
|
|
10
|
+
},
|
|
11
|
+
"useBuiltIns": true
|
|
12
|
+
}
|
|
13
|
+
],
|
|
14
|
+
"react"
|
|
15
|
+
],
|
|
16
|
+
"plugins": [
|
|
17
|
+
"syntax-dynamic-import",
|
|
18
|
+
"transform-object-rest-spread",
|
|
19
|
+
[
|
|
20
|
+
"transform-class-properties",
|
|
21
|
+
{
|
|
22
|
+
"spec": true
|
|
23
|
+
}
|
|
24
|
+
]
|
|
25
|
+
]
|
|
26
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
|
|
3
|
+
const ToolTip = ({id, tooltip}) => (<p>{ tooltip }</p>)
|
|
4
|
+
|
|
5
|
+
const allowedExtensions = ({allowed_extensions}) => allowed_extensions === undefined ? '' : allowed_extensions.join(', ')
|
|
6
|
+
const allowedExtensionsForFor = ({allowed_extensions}) => allowed_extensions === undefined ? '' : '.' + allowed_extensions.join(',.')
|
|
7
|
+
const maxFileSize = ({max_size}) => max_size
|
|
8
|
+
|
|
9
|
+
class AssetFieldType extends React.PureComponent {
|
|
10
|
+
render() {
|
|
11
|
+
const { field_item, id, metadata, required=false, name, validations } = this.props
|
|
12
|
+
console.log('AssetFieldType', this.props)
|
|
13
|
+
return (
|
|
14
|
+
<div>
|
|
15
|
+
<strong>Allowed extensions: </strong>
|
|
16
|
+
{ allowedExtensions(validations) }
|
|
17
|
+
<br/>
|
|
18
|
+
<strong>Allowed filesize: </strong>
|
|
19
|
+
{ maxFileSize(validations) }
|
|
20
|
+
<br />
|
|
21
|
+
<input type='hidden' value={id} />
|
|
22
|
+
{ field_item.tooltip && ToolTip(field_item) }
|
|
23
|
+
<label>{ name } </label>
|
|
24
|
+
<input
|
|
25
|
+
type='file'
|
|
26
|
+
accept={ allowedExtensionsForFor(validations) }
|
|
27
|
+
name={name} />
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
)
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export default AssetFieldType
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
const ToolTip = ({id, tooltip}) => (
|
|
3
|
+
<div>
|
|
4
|
+
<div className='icon material-icons tooltip-icon' id={id}>help</div>
|
|
5
|
+
<div className='mdl-tooltip mdl-tooltip--large' data-mdl-for={id}>
|
|
6
|
+
{tooltip}
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
class DateTimeType extends React.PureComponent {
|
|
12
|
+
render() {
|
|
13
|
+
const {
|
|
14
|
+
field_item,
|
|
15
|
+
id,
|
|
16
|
+
value = '',
|
|
17
|
+
metadata,
|
|
18
|
+
required = false,
|
|
19
|
+
name,
|
|
20
|
+
validations
|
|
21
|
+
} = this.props
|
|
22
|
+
console.log('DateTimeType', this.props)
|
|
23
|
+
return (
|
|
24
|
+
<div className='mdl-textfield mdl-js-textfield mdl-textfield--floating-label'>
|
|
25
|
+
<input type='hidden' value={id}/>
|
|
26
|
+
<label className='mdl-textfield__label'>{name}</label>
|
|
27
|
+
{field_item.tooltip && ToolTip(field_item)}
|
|
28
|
+
<input defaultValue={value} required={required} className='datepicker mdl-textfield__input'/>
|
|
29
|
+
</div>
|
|
30
|
+
|
|
31
|
+
)
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default DateTimeType
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
import TextFieldType from './text_field_type'
|
|
3
|
+
import DateTimeType from './date_time_type'
|
|
4
|
+
import AssetFieldType from './asset_field_type'
|
|
5
|
+
import TagFieldType from './tag_field_type'
|
|
6
|
+
|
|
7
|
+
export {
|
|
8
|
+
TextFieldType,
|
|
9
|
+
DateTimeType,
|
|
10
|
+
AssetFieldType,
|
|
11
|
+
TagFieldType
|
|
12
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react'
|
|
2
|
+
const ToolTip = ({id, tooltip}) => (
|
|
3
|
+
<div>
|
|
4
|
+
<div className='icon material-icons tooltip-icon' id={id}>help</div>
|
|
5
|
+
<div className='mdl-tooltip mdl-tooltip--large' data-mdl-for={id}>
|
|
6
|
+
{tooltip}
|
|
7
|
+
</div>
|
|
8
|
+
</div>
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
class TagFieldType extends React.PureComponent {
|
|
12
|
+
render() {
|
|
13
|
+
const {
|
|
14
|
+
field_item,
|
|
15
|
+
id,
|
|
16
|
+
metadata,
|
|
17
|
+
value,
|
|
18
|
+
required = false,
|
|
19
|
+
name,
|
|
20
|
+
validations
|
|
21
|
+
} = this.props
|
|
22
|
+
console.log('TagFieldType', this.props)
|
|
23
|
+
return (
|
|
24
|
+
<div>
|
|
25
|
+
<input type='hidden' value={id}/>
|
|
26
|
+
<label htmlFor={name}>{name}</label>
|
|
27
|
+
{ field_item.tooltip && ToolTip(field_item) }
|
|
28
|
+
<br/>
|
|
29
|
+
<span className='cortex-bootstrap'>
|
|
30
|
+
<input
|
|
31
|
+
className='mdl-textfield__input'
|
|
32
|
+
value={ value }
|
|
33
|
+
data-role='tagsinput'
|
|
34
|
+
required={ required } />
|
|
35
|
+
</span>
|
|
36
|
+
</div>
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export default TagFieldType
|