Skip to content

Commit b6f31f9

Browse files
author
Alex Tharp
authored
Merge pull request #10 from cortex-cms/multiline-text-cell
Multiline Text
2 parents f7c8d9b + 9672cf6 commit b6f31f9

File tree

4 files changed

+18
-8
lines changed

4 files changed

+18
-8
lines changed

app/cells/plugins/core/text/input.haml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
= render_field_id
33
= render_label
44
= render_input
5+
Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1-
= render_label
2-
= render_field_id
3-
= render_multiline_input
1+
.mdl-textfield.mdl-js-textfield
2+
= render_label
3+
= render_field_id
4+
= render_multiline_input

app/cells/plugins/core/text_cell.rb

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,18 @@ def multiline_input
1515

1616
private
1717

18+
def input_display
19+
@options[:input_options]&.[](:display)
20+
end
21+
1822
def input_classes
19-
@options[:input_options]&.[](:display)&.[](:classes)
23+
input_display&.[](:classes)
2024
end
2125

2226
def input_styles
23-
@options[:input_options]&.[](:display)&.[](:styles)
27+
input_display&.[](:styles)
2428
end
25-
29+
2630
def value
2731
data&.[]('text') || @options[:default_value]
2832
end
@@ -46,7 +50,7 @@ def render_wysiwyg
4650
end
4751

4852
def render_multiline_input
49-
@options[:form].text_area_tag 'data[text]', value: value # , cols: @options[:cols], rows: @options[:rows]
53+
@options[:form].text_area 'data[text]', value: value , placeholder: @options[:placeholder], rows: input_display&.[](:rows) , class: 'mdl-textfield__input'
5054
end
5155
end
5256
end

lib/tasks/cortex/core/media.rake

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,11 @@ namespace :cortex do
5454
"id": media.fields[1].id
5555
},
5656
{
57-
"id": media.fields[2].id
57+
"id": media.fields[2].id,
58+
"render_method": "multiline_input",
59+
"display": {
60+
"rows": 3
61+
}
5862
},
5963
{
6064
"id": media.fields[3].id

0 commit comments

Comments
 (0)