From 42d9db526d3aef2e08848d6bc587feaf3700db42 Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 7 Jul 2018 16:23:04 -0400 Subject: Added tags Blogs and streams can now be tagged. Records now show the appropriate tags for an entry. Updates work oddly, because their records show the stream's tags, since updates do not have tags themselves. refs #2 --- app/views/admin/blogs/_form.html.haml | 4 ++++ app/views/admin/streams/_form.html.haml | 4 ++++ app/views/records/_record.html.haml | 7 +++++++ app/views/records/index.html.haml | 8 +------- 4 files changed, 16 insertions(+), 7 deletions(-) create mode 100644 app/views/records/_record.html.haml (limited to 'app/views') diff --git a/app/views/admin/blogs/_form.html.haml b/app/views/admin/blogs/_form.html.haml index 12f7a82..36925af 100644 --- a/app/views/admin/blogs/_form.html.haml +++ b/app/views/admin/blogs/_form.html.haml @@ -21,6 +21,10 @@ = link_to "View post", blog_url(f.object.slug_was), target: "entry-preview" - else = link_to "Preview post", admin_blog_url(f.object), target: "entry-preview" + .details-module + .tags-field + = f.label :tag_list, "Tags" + = f.text_field :tag_list, type: :tags, value: f.object.tag_list.join(",") .details-module .published-field = f.check_box :published diff --git a/app/views/admin/streams/_form.html.haml b/app/views/admin/streams/_form.html.haml index ce457cb..e04a3fb 100644 --- a/app/views/admin/streams/_form.html.haml +++ b/app/views/admin/streams/_form.html.haml @@ -15,6 +15,10 @@ %ul - f.object.errors.full_messages.each do |error| %li= error + .details-module + .tags-field + = f.label :tag_list, "Tags" + = f.text_field :tag_list, type: :tags, value: f.object.tag_list.join(",") .details-module = f.fields_for :records, Record.new do |builder| .should-create-record-field diff --git a/app/views/records/_record.html.haml b/app/views/records/_record.html.haml new file mode 100644 index 0000000..80a365c --- /dev/null +++ b/app/views/records/_record.html.haml @@ -0,0 +1,7 @@ +%li + %span.description= link_to record.description, record.recordable.path + %ul.tags + %li.record-date= record.created_at.strftime("%m.%d.%y") + %li.entry-type{ class: "entry-type-#{record.recordable_type.downcase}" }= record.recordable_type + - record.recordable.taggable.tag_list.each do |tag| + %li.entry-tag= tag diff --git a/app/views/records/index.html.haml b/app/views/records/index.html.haml index 200321e..4ceed2c 100644 --- a/app/views/records/index.html.haml +++ b/app/views/records/index.html.haml @@ -1,7 +1 @@ -%ul#records - - @records.each do |record| - %li - %span.description= link_to record.description, record.recordable.path - %ul.tags - %li.record-date= record.created_at.strftime("%m.%d.%y") - %li.entry-type{ class: "entry-type-#{record.recordable_type.downcase}" }= record.recordable_type +%ul#records= render @records -- cgit 1.4.1