Skip to content

Commit 3d7e569

Browse files
committed
Merge branch 'develop'
2 parents c0fb18e + e60b7ef commit 3d7e569

File tree

8 files changed

+25
-21
lines changed

8 files changed

+25
-21
lines changed

app/cells/plugins/core/cell.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@ module Plugins
22
module Core
33
class Cell < FieldCell
44
view_paths << "#{Cortex::Plugins::Core::Engine.root}/app/cells"
5+
6+
def required?
7+
field_item.field.validations["presence"]
8+
end
59
end
610
end
711
end

app/cells/plugins/core/date_time_cell.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ def render_label
1616
end
1717

1818
def render_datepicker
19-
@options[:form].text_field 'data[timestamp]', value: value, placeholder: @options[:placeholder], class: 'datepicker mdl-textfield__input'
19+
@options[:form].text_field 'data[timestamp]', value: value, placeholder: @options[:placeholder], class: 'datepicker mdl-textfield__input', required: required?
2020
end
2121
end
2222
end

app/cells/plugins/core/float_cell.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,21 +4,21 @@ class FloatCell < Plugins::Core::Cell
44
def input
55
render
66
end
7-
7+
88
private
9-
9+
1010
def max
11-
field.validations[:max]
11+
field.validations[:max]
1212
end
1313

1414
def min
15-
field.validations[:min]
15+
field.validations[:min]
1616
end
1717

1818
def step
1919
field.validations[:step] || 0.01
2020
end
21-
21+
2222
def input_display
2323
@options[:input_options]&.[](:display)
2424
end
@@ -30,7 +30,7 @@ def input_classes
3030
def input_styles
3131
input_display&.[](:styles)
3232
end
33-
33+
3434
def value
3535
data&.[]('float') || @options[:default_value]
3636
end
@@ -40,7 +40,7 @@ def render_label
4040
end
4141

4242
def render_input
43-
@options[:form].number_field 'data[float]', value: value, placeholder: @options[:placeholder], step: step, max: max, min: min , class: 'mdl-textfield__input'
43+
@options[:form].number_field 'data[float]', value: value, placeholder: @options[:placeholder], step: step, max: max, min: min , class: 'mdl-textfield__input', required: required?
4444
end
4545
end
4646
end

app/cells/plugins/core/integer_cell.rb

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@ class IntegerCell < Plugins::Core::Cell
44
def input
55
render
66
end
7-
7+
88
private
9-
9+
1010
def max
11-
field.validations[:max]
11+
field.validations[:max]
1212
end
1313

1414
def min
15-
field.validations[:min]
15+
field.validations[:min]
1616
end
17-
17+
1818
def input_display
1919
@options[:input_options]&.[](:display)
2020
end
@@ -26,7 +26,7 @@ def input_classes
2626
def input_styles
2727
input_display&.[](:styles)
2828
end
29-
29+
3030
def value
3131
data&.[]('integer') || @options[:default_value]
3232
end
@@ -36,7 +36,7 @@ def render_label
3636
end
3737

3838
def render_input
39-
@options[:form].number_field 'data[integer]', value: value, placeholder: @options[:placeholder] , max: max, min: min, class: 'mdl-textfield__input'
39+
@options[:form].number_field 'data[integer]', value: value, placeholder: @options[:placeholder] , max: max, min: min, class: 'mdl-textfield__input', required: required?
4040
end
4141
end
4242
end

app/cells/plugins/core/tag_cell.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ def value
1212
end
1313

1414
def render_tag_field
15-
@options[:form].text_field 'data[tag_list]', value: value, placeholder: @options[:placeholder], 'data-role'=>'tagsinput'
15+
@options[:form].text_field 'data[tag_list]', value: value, placeholder: @options[:placeholder], 'data-role'=>'tagsinput', required: required?
1616
end
1717
end
1818
end

app/cells/plugins/core/text_cell.rb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -42,15 +42,15 @@ def render_label
4242
end
4343

4444
def render_input
45-
@options[:form].text_field 'data[text]', value: value, placeholder: @options[:placeholder], class: 'mdl-textfield__input'
45+
@options[:form].text_field 'data[text]', value: value, placeholder: @options[:placeholder], class: 'mdl-textfield__input', required: required?
4646
end
4747

4848
def render_wysiwyg
49-
@options[:form].text_area 'data[text]', value: value, class: "#{input_classes} wysiwyg_ckeditor", style: input_styles
49+
@options[:form].text_area 'data[text]', value: value, class: "#{input_classes} wysiwyg_ckeditor", style: input_styles, required: required?
5050
end
5151

5252
def render_multiline_input
53-
@options[:form].text_area 'data[text]', value: value , placeholder: @options[:placeholder], rows: input_display&.[](:rows) , class: 'mdl-textfield__input'
53+
@options[:form].text_area 'data[text]', value: value , placeholder: @options[:placeholder], rows: input_display&.[](:rows) , class: 'mdl-textfield__input', required: required?
5454
end
5555
end
5656
end

app/cells/plugins/core/user_cell.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ def value
1414
end
1515

1616
def render_select
17-
@options[:form].select 'data[user_id]', user_data_for_select, {selected: value}
17+
@options[:form].select 'data[user_id]', user_data_for_select, {selected: value}, required: required?
1818
end
1919

2020
def user_data_for_select

lib/cortex/plugins/core/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
module Cortex
22
module Plugins
33
module Core
4-
VERSION = '0.10.2'
4+
VERSION = '0.10.3'
55
end
66
end
77
end

0 commit comments

Comments
 (0)