views: convert /notes to table builder.

This commit is contained in:
evazion
2019-11-17 22:36:17 -06:00
parent 5afac29693
commit 1ce9eff0f5

View File

@@ -2,36 +2,26 @@
<div id="a-index"> <div id="a-index">
<h1>Notes</h1> <h1>Notes</h1>
<table width="100%" class="striped autofit"> <%= table_for @notes, class: "striped autofit" do |t| %>
<thead> <% t.column "Post" do |note| %>
<tr> <%= link_to note.post_id, note.post %>
<th>Post</th> <% end %>
<th>Note</th> <% t.column "Note" do |note| %>
<th>Created by</th>
<th>Created at</th>
<th>Body</th>
</tr>
</thead>
<tbody>
<% @notes.each do |note| %>
<tr>
<td><%= link_to note.post_id, post_path(note.post_id) %></td>
<td>
<%= link_to "#{note.id}.#{note.version}", post_path(note.post_id, anchor: "note-#{note.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 "»", note_versions_path(search: { note_id: note.id }) %>
</td> <% end %>
<td><%= link_to_user note.creator %></td> <% t.column "Body", class: "col-expand" do |note| %>
<td><%= compact_time(note.created_at) %></td> <%= note.body %>
<td class="col-expand">
<%= h(note.body) %>
<% unless note.is_active? %> <% unless note.is_active? %>
<span class="inactive">(deleted)</span> <span class="inactive">(deleted)</span>
<% end %> <% end %>
</td>
</tr>
<% end %> <% end %>
</tbody> <% t.column "Created" do |note| %>
</table> <%= link_to_user note.creator %>
<%= link_to "»", notes_path(search: { creator_name: note.creator.name }) %>
<div><%= time_ago_in_words_tagged(note.created_at) %></div>
<% end %>
<% end %>
<%= numbered_paginator(@notes) %> <%= numbered_paginator(@notes) %>
</div> </div>