Skip to content

Commit

Permalink
Extracts draft form fields into a partial
Browse files Browse the repository at this point in the history
  • Loading branch information
lyc4n committed Oct 16, 2017
1 parent 4f608d5 commit 36afce1
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 10 deletions.
5 changes: 5 additions & 0 deletions app/views/drafts/_form_fields.html.slim
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
= f.text_field :title, class: 'form-control', autofocus: true, required: true, placeholder: 'Draft title'
br
= f.text_area :content, id: 'markdown-editor'
br
= f.text_field :tag_list, class: 'form-control', placeholder: 'Tags separated by comma', value: f.object.tag_list.to_s
6 changes: 1 addition & 5 deletions app/views/drafts/edit.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ h3 Edit Draft
hr

= form_for @draft, method: :put do |f|
= f.text_field :title, class: 'form-control', autofocus: true, required: true, placeholder: 'Draft title'
br
= f.text_area :content, id: 'markdown-editor'
br
= f.text_field :tag_list, class: 'form-control', placeholder: 'Tags separated by comma', value: f.object.tag_list.to_s
= render "form_fields", {f: f}
br
.text-center
.btn-group
Expand Down
6 changes: 1 addition & 5 deletions app/views/drafts/new.html.slim
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,7 @@ h3 New Draft
hr

= form_for @draft do |f|
= f.text_field :title, class: 'form-control', autofocus: true, required: true, placeholder: 'Draft title'
br
= f.text_area :content, id: 'markdown-editor'
br
= f.text_field :tag_list, class: 'form-control', placeholder: 'Tags separated by comma', value: f.object.tag_list.to_s
= render "form_fields", {f: f}
br
.text-center
.btn-group
Expand Down

0 comments on commit 36afce1

Please sign in to comment.