Skip to content

Commit 2726603

Browse files
committed
feat: render author cell with current_user
1 parent 3a87988 commit 2726603

File tree

2 files changed

+16
-1
lines changed

2 files changed

+16
-1
lines changed
Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,4 @@
1-
1+
.mdl-textfield.mdl-js-textfield.authorfield
2+
= render_field_id
3+
= render_label
4+
= render_input

app/cells/plugins/core/author_cell.rb

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,18 @@ def input
1010
def current_user
1111
"#{@options[:current_user].firstname} #{@options[:current_user].lastname}"
1212
end
13+
14+
def value
15+
data&.[]('author_name') || current_user
16+
end
17+
18+
def render_label
19+
@options[:form].label 'data[text]', field.name, class: 'mdl-textfield__label'
20+
end
21+
22+
def render_input
23+
@options[:form].text_field 'data[text]', value: value, placeholder: @options[:placeholder], class: 'mdl-textfield__input', required: required?
24+
end
1325
end
1426
end
1527
end

0 commit comments

Comments
 (0)