-
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
15 changed files
with
234 additions
and
162 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
%label.mdl-checkbox.mdl-js-checkbox.mdl-js-ripple-effect{ for: @options[:node]["id"] } | ||
= context[:form].check_box "data[values][#{@options[:node]['id']}]", { checked: value, class: 'mdl-checkbox__input', id: @options[:node]["id"] }, 1, nil | ||
= context[:form].label :data, display_lineage, class: 'mdl-checkbox__label' | ||
= @options[:form].check_box "data[values][#{@options[:node]['id']}]", { checked: value, class: 'mdl-checkbox__input', id: @options[:node]["id"] }, 1, nil | ||
= @options[:form].label :data, display_lineage, class: 'mdl-checkbox__label' | ||
|
||
- if @options[:node]["children"].any? | ||
- @options[:node]["children"].each do |child| | ||
= cell(Plugins::Core::CheckboxCell, nil, node: child, child: child_identifier, data: @options[:data]).(:checkbox) | ||
= cell(Plugins::Core::CheckboxCell, nil, form: @options[:form], node: child, child: child_identifier, data: @options[: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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
= render_label | ||
%br | ||
%button.content_item_button.text-center.popup--open | ||
.button_content | ||
%i{ class: "material-icons icon" } | ||
cloud_upload | ||
%br | ||
%span.content_item_button-text | ||
Click to add a | ||
= field.name | ||
from the media library | ||
%small | ||
Recommended size: 1452px x 530px with a live area of 930px x 530px |
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,15 @@ | ||
module Plugins | ||
module Core | ||
class ContentItemCell < Plugins::Core::Cell | ||
def popup | ||
render | ||
end | ||
|
||
private | ||
|
||
def render_label | ||
"Add #{field.name}" | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.mdl-textfield.mdl-js-textfield.mdl-textfield--floating-label | ||
= render_field_id | ||
= render_label | ||
= render_input | ||
|
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,47 @@ | ||
module Plugins | ||
module Core | ||
class FloatCell < Plugins::Core::Cell | ||
def input | ||
render | ||
end | ||
|
||
private | ||
|
||
def max | ||
field.validations[:max] | ||
end | ||
|
||
def min | ||
field.validations[:min] | ||
end | ||
|
||
def step | ||
field.validations[:step] || 0.01 | ||
end | ||
|
||
def input_display | ||
@options[:input_options]&.[](:display) | ||
end | ||
|
||
def input_classes | ||
input_display&.[](:classes) | ||
end | ||
|
||
def input_styles | ||
input_display&.[](:styles) | ||
end | ||
|
||
def value | ||
data&.[]('float') || @options[:default_value] | ||
end | ||
|
||
def render_label | ||
@options[:form].label 'data[float]', field.name, class: 'mdl-textfield__label' | ||
end | ||
|
||
def render_input | ||
@options[:form].number_field 'data[float]', value: value, placeholder: @options[:placeholder], step: step, max: max, min: min , class: 'mdl-textfield__input' | ||
end | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
.mdl-textfield.mdl-js-textfield | ||
= render_field_id | ||
= render_label | ||
= render_input | ||
|
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,43 @@ | ||
module Plugins | ||
module Core | ||
class IntegerCell < Plugins::Core::Cell | ||
def input | ||
render | ||
end | ||
|
||
private | ||
|
||
def max | ||
field.validations[:max] | ||
end | ||
|
||
def min | ||
field.validations[:min] | ||
end | ||
|
||
def input_display | ||
@options[:input_options]&.[](:display) | ||
end | ||
|
||
def input_classes | ||
input_display&.[](:classes) | ||
end | ||
|
||
def input_styles | ||
input_display&.[](:styles) | ||
end | ||
|
||
def value | ||
data&.[]('integer') || @options[:default_value] | ||
end | ||
|
||
def render_label | ||
@options[:form].label 'data[integer]', field.name, class: 'mdl-textfield__label' | ||
end | ||
|
||
def render_input | ||
@options[:form].number_field 'data[integer]', value: value, placeholder: @options[:placeholder] , max: max, min: min, class: 'mdl-textfield__input' | ||
end | ||
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,6 +1,9 @@ | ||
%h4 | ||
= render_label | ||
|
||
%p | ||
Please select 1-2 Categories. | ||
|
||
- @options[:metadata]["data"]["tree_array"].each do |node| | ||
= render_field_id | ||
= cell(Plugins::Core::CheckboxCell, nil, node: node, data: data).(:checkbox) | ||
= cell(Plugins::Core::CheckboxCell, nil, form: @options[:form], node: node, data: data).(:checkbox) |
This file was deleted.
Oops, something went wrong.
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,11 @@ | ||
class ContentItemFieldType < FieldType | ||
def mapping | ||
{ name: mapping_field_name, type: :string, analyzer: :snowball } | ||
end | ||
|
||
private | ||
|
||
def mapping_field_name | ||
"#{field_name.parameterize('_')}_content_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,40 @@ | ||
class FloatFieldType < FieldType | ||
attr_accessor :float | ||
|
||
validates :float, presence: true, if: Proc.new { |float| validate_key(:presence) } | ||
validates_numericality_of :float, unless: "float.nil?" | ||
validate :less_than, if: Proc.new { |float| validate_key(:max) } | ||
validate :greater_than, if: Proc.new { |float| validate_key(:min) } | ||
|
||
def data=(data_hash) | ||
@float = data_hash.deep_symbolize_keys[:float] | ||
end | ||
|
||
def field_item_as_indexed_json_for_field_type(field_item, options = {}) | ||
json = {} | ||
json[mapping_field_name] = field_item.data['float'] | ||
json | ||
end | ||
|
||
def mapping | ||
{name: mapping_field_name, type: :float} | ||
end | ||
|
||
private | ||
|
||
def mapping_field_name | ||
"#{field_name.parameterize('_')}_float" | ||
end | ||
|
||
def validate_key(key) | ||
@validations.key? key | ||
end | ||
|
||
def less_than | ||
errors.add(:float, "must be less_than #{@validations[:max]}") if :float <= @validations[:max] | ||
end | ||
|
||
def greater_than | ||
errors.add(:float, "must be greater_than #{@validations[:min]}") if :float >= @validations[:min] | ||
end | ||
end |
Oops, something went wrong.