-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
166 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
21 changes: 21 additions & 0 deletions
21
app/assets/stylesheets/cortex-plugins-core/components/tags-input.scss
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
.bootstrap-tagsinput { | ||
width: 100%; | ||
border-radius: 0 !important; | ||
border-top: none; | ||
border-right: none; | ||
border-left: none; | ||
border-bottom: 1px solid $color-grey-light; | ||
box-shadow: none; | ||
} | ||
.cortex-bootstrap .label { | ||
border-radius: 0.75em; | ||
font-weight: normal; | ||
} | ||
|
||
.cortex-bootstrap .label-info { | ||
background-color: $color-grey; | ||
} | ||
|
||
.bootstrap-tagsinput .tag { | ||
text-transform: uppercase; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,6 @@ | ||
= render_label | ||
= render_tooltip unless @options[:tooltip].nil? | ||
|
||
%p | ||
Please select 1-2 Categories. | ||
|
||
- @options[:metadata]["data"]["tree_array"].each do |node| | ||
= render_field_id | ||
= cell(Plugins::Core::CheckboxCell, nil, form: @options[:form], node: node, data: data).(:checkbox) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,6 +34,6 @@ def valid_user_id? | |
end | ||
|
||
def validate_presence? | ||
@validations.key? :presence | ||
validations.key? :presence | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module UpdateTags | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
end | ||
end |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
class GetFieldTreeListTransaction < ApplicationTransaction | ||
step :init | ||
step :process | ||
|
||
def init(input) | ||
field = Field.find_by_id(input[:args]['field_id']) | ||
|
||
field ? Right({ content_item: input[:content_item], field: field }) : Left(:not_found) | ||
end | ||
|
||
def process(input) | ||
tree_array = input[:field].metadata['allowed_values']['data']['tree_array'] | ||
tree_values = input[:content_item].field_items.find {|field_item| field_item.field_id == input[:field].id}.data['values'] | ||
|
||
tree_list = tree_values.map {|value| tree_array.find {|node| node['id'] == value.to_i}['node']['name']}.join(',') | ||
Right(tree_list) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class NewTagFieldItemTransaction < ApplicationTransaction | ||
step :process | ||
|
||
def process(field_item) | ||
Right(field_item) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class NewUserFieldItemTransaction < ApplicationTransaction | ||
step :process | ||
|
||
def process(field_item) | ||
Right(field_item) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
class UpdateTagFieldItemTransaction < ApplicationTransaction | ||
step :process | ||
|
||
def process(field_item) | ||
Right(field_item) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
module Imageable | ||
extend ActiveSupport::Concern | ||
|
||
included do | ||
def image?(io) | ||
MimeMagic.new(io.data['metadata']['mime_type']).mediatype == 'image' | ||
end | ||
|
||
def optimize_image!(image, image_optim) | ||
pathname = image_optim.optimize_image!(image) # TODO: move to ActiveJob | ||
pathname ? pathname.open : image | ||
end | ||
|
||
def image_optim_for(image_optim_config) | ||
ImageOptim.new(process_image_optim_config(image_optim_config)) | ||
end | ||
|
||
def process_image_optim_config(image_optim_config) | ||
processed_image_optim_config = image_optim_config.merge(pngout: false, svgo: false, verbose: true, skip_missing_workers: false) | ||
processed_image_optim_config.extend(Hashie::Extensions::DeepLocate) | ||
quality_range_hashes = processed_image_optim_config.deep_locate -> (key, value, object) { key == :quality_range } | ||
quality_range_hashes.each do |quality_range_hash| | ||
quality_range_hash[:quality] = quality_range_hash[:quality_range][:begin]..quality_range_hash[:quality_range][:end] | ||
quality_range_hash.delete(:quality_range) | ||
end | ||
|
||
processed_image_optim_config | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
module Cortex | ||
module Plugins | ||
module Core | ||
VERSION = '0.12.4' | ||
VERSION = '1.0.0' | ||
end | ||
end | ||
end |
Oops, something went wrong.