* Move search form to index page instead of a separate page. * Merge creator + timestamp into one column. * Add category column. * Fix N+1 query issue.
60 lines
2.3 KiB
Plaintext
60 lines
2.3 KiB
Plaintext
<div id="c-user-feedbacks">
|
|
<div id="a-index">
|
|
<h1>User Feedback</h1>
|
|
|
|
<%= search_form_for(user_feedbacks_path) do |f| %>
|
|
<%= f.input :user_name, input_html: { value: params.dig(:search, :user_name), "data-autocomplete": "user" } %>
|
|
<%= f.input :creator_name, input_html: { value: params.dig(:search, :creator_name), "data-autocomplete": "user" } %>
|
|
<%= f.input :body_matches, label: "Message", input_html: { value: params.dig(:search, :body_matches) } %>
|
|
<%= f.input :category, collection: %w[positive negative neutral], include_blank: true, selected: params.dig(:search, :category) %>
|
|
<%= f.submit "Search" %>
|
|
<% end %>
|
|
|
|
<table class="striped autofit">
|
|
<thead>
|
|
<tr>
|
|
<th>User</th>
|
|
<th>Message</th>
|
|
<th>Category</th>
|
|
<th>Creator</th>
|
|
<th></th>
|
|
</tr>
|
|
</thead>
|
|
<tbody>
|
|
<% @user_feedbacks.each do |feedback| %>
|
|
<tr class="feedback-category-<%= feedback.category %>">
|
|
<td>
|
|
<%= link_to_user feedback.user %>
|
|
<%= link_to "»", user_feedbacks_path(search: { user_name: feedback.user.name }) %>
|
|
</td>
|
|
<td class="col-expand">
|
|
<div class="prose">
|
|
<%= format_text(feedback.body) %>
|
|
</div>
|
|
<%= render "application/update_notice", record: feedback, interval: 0.minutes %>
|
|
</td>
|
|
<td>
|
|
<%= link_to feedback.category.capitalize, user_feedbacks_path(search: { category: feedback.category }) %>
|
|
</td>
|
|
<td>
|
|
<%= link_to_user feedback.creator %>
|
|
<%= link_to "»", user_feedbacks_path(search: { creator_name: feedback.creator.name }) %>
|
|
<div><%= time_ago_in_words_tagged(feedback.created_at) %></div>
|
|
</td>
|
|
<td>
|
|
<% if feedback.editable_by?(CurrentUser.user) %>
|
|
<%= link_to "edit", edit_user_feedback_path(feedback) %>
|
|
| <%= link_to "delete", user_feedback_path(feedback), :method => :delete, :data => {:confirm => "Are you sure you want to delete this user feedback?"} %>
|
|
<% end %>
|
|
</td>
|
|
</tr>
|
|
<% end %>
|
|
</tbody>
|
|
</table>
|
|
|
|
<%= numbered_paginator(@user_feedbacks) %>
|
|
</div>
|
|
</div>
|
|
|
|
<%= render "secondary_links" %>
|