From 1ce9eff0f5bde8cabd698fc4c2f2a89e07ccf074 Mon Sep 17 00:00:00 2001 From: evazion Date: Sun, 17 Nov 2019 22:36:17 -0600 Subject: [PATCH] views: convert /notes to table builder. --- app/views/notes/index.html.erb | 48 ++++++++++++++-------------------- 1 file changed, 19 insertions(+), 29 deletions(-) diff --git a/app/views/notes/index.html.erb b/app/views/notes/index.html.erb index 26f8ec891..1a389e457 100644 --- a/app/views/notes/index.html.erb +++ b/app/views/notes/index.html.erb @@ -2,36 +2,26 @@

Notes

- - - - - - - - - - - - <% @notes.each do |note| %> - - - - - - - + <%= table_for @notes, class: "striped autofit" do |t| %> + <% t.column "Post" do |note| %> + <%= link_to note.post_id, note.post %> + <% end %> + <% t.column "Note" do |note| %> + <%= link_to "#{note.id}.#{note.version}", post_path(note.post_id, anchor: "note-#{note.id}") %> + <%= link_to "»", note_versions_path(search: { note_id: note.id }) %> + <% end %> + <% t.column "Body", class: "col-expand" do |note| %> + <%= note.body %> + <% unless note.is_active? %> + (deleted) <% end %> - -
PostNoteCreated byCreated atBody
<%= link_to note.post_id, post_path(note.post_id) %> - <%= link_to "#{note.id}.#{note.version}", post_path(note.post_id, anchor: "note-#{note.id}") %> - <%= link_to "»", note_versions_path(search: {note_id: note.id}) %> - <%= link_to_user note.creator %><%= compact_time(note.created_at) %> - <%= h(note.body) %> - <% unless note.is_active? %> - (deleted) - <% end %> -
+ <% end %> + <% t.column "Created" do |note| %> + <%= link_to_user note.creator %> + <%= link_to "»", notes_path(search: { creator_name: note.creator.name }) %> +
<%= time_ago_in_words_tagged(note.created_at) %>
+ <% end %> + <% end %> <%= numbered_paginator(@notes) %>