|
4 | 4 | <% categories = Category.unscoped.where(community: @community).order(sequence: :asc, id: :asc) %> |
5 | 5 | <% current_cat = current_category %> |
6 | 6 |
|
7 | | -<div class="button-list is-gutterless"> |
8 | | - <%= link_to 'Pending', query_url(show_decided: 0), |
9 | | - class: "button is-muted is-outlined #{params[:show_decided] != '1' ? 'is-active' : ''}" %> |
10 | | - <%= link_to 'Decided', query_url(show_decided: 1), |
11 | | - class: "button is-muted is-outlined #{params[:show_decided] == '1' ? 'is-active' : ''}" %> |
| 7 | +<div class="suggested-edits-list-header"> |
| 8 | + <div class="button-list is-gutterless"> |
| 9 | + <%= link_to 'Pending', query_url(show_decided: 0), |
| 10 | + class: "button is-muted is-outlined #{'is-active' unless @show_decided}" %> |
| 11 | + <%= link_to 'Decided', query_url(show_decided: 1), |
| 12 | + class: "button is-muted is-outlined #{'is-active' if @show_decided}" %> |
| 13 | + </div> |
| 14 | + |
| 15 | + <%= render 'shared/sorting', default_order: @default_sort_order, |
| 16 | + default_type: @default_sort_type, |
| 17 | + types: %w[age decided] %> |
12 | 18 | </div> |
13 | 19 |
|
14 | | -<% if params[:show_decided] != '1' && !current_user&.privilege?('edit_posts') %> |
| 20 | +<% unless @show_decided || current_user&.privilege?('edit_posts') %> |
15 | 21 | <div class="notice is-info has-color-teal-800"> |
16 | 22 | <i class="fas fa-info-circle"></i> You can't approve or reject suggested edits (except on your own posts) |
17 | 23 | because you haven't yet earned the <%= link_to 'Edit Posts', ability_path('edit_posts') %> ability. |
18 | 24 | </div> |
19 | 25 | <% end %> |
20 | 26 |
|
21 | | -<% if params[:show_decided] != '1' %> |
22 | | - <h3>All categories</h3> |
| 27 | +<details class="has-margin-top-2"> |
| 28 | + <summary> |
| 29 | + Categories |
| 30 | + </summary> |
23 | 31 | <table> |
24 | 32 | <tr> |
25 | 33 | <th>category</th> |
26 | 34 | <th>pending edits</th> |
27 | 35 | </tr> |
28 | | - <% categories.each do |cat| %> |
| 36 | + <% categories.each do |cat| %> |
29 | 37 | <% next if (cat.min_view_trust_level || -1) > (current_user&.trust_level || 0) %> |
30 | | - <% sug_edits = SuggestedEdit.where(post: Post.undeleted.in(cat), active: true).count %> |
31 | | - <tr> |
32 | | - <td> |
33 | | - <% if cat == current_cat %> |
34 | | - <%= cat.name %> |
35 | | - <% else %> |
36 | | - <%= link_to suggested_edits_queue_url(cat) do %> |
37 | | - <%= cat.name %> |
38 | | - <% end %> |
39 | | - <% end %> |
40 | | - </td> |
41 | | - <td> |
42 | | - <% if cat == current_cat %> |
43 | | - <%= sug_edits %> |
44 | | - <% else %> |
45 | | - <%= link_to suggested_edits_queue_url(cat) do %> |
46 | | - <%= sug_edits %> |
47 | | - <% end %> |
48 | | - <% end %> |
49 | | - </td> |
50 | | - </tr> |
| 38 | + <% sug_edits = SuggestedEdit.where(post: Post.undeleted.in(cat), active: !@show_decided).count %> |
| 39 | + <% queue_url = suggested_edits_queue_url(cat, params.permit(:sort, :order, :show_decided)) %> |
| 40 | + <tr> |
| 41 | + <td> |
| 42 | + <% if cat == current_cat %> |
| 43 | + <%= cat.name %> |
| 44 | + <% else %> |
| 45 | + <%= link_to cat.name, queue_url %> |
| 46 | + <% end %> |
| 47 | + </td> |
| 48 | + <td> |
| 49 | + <% if cat == current_cat %> |
| 50 | + <%= sug_edits %> |
| 51 | + <% else %> |
| 52 | +<%= link_to sug_edits, queue_url %> |
| 53 | + <% end %> |
| 54 | + </td> |
| 55 | + </tr> |
51 | 56 | <% end %> |
52 | 57 | </table> |
53 | | -<% end %> |
54 | | - |
| 58 | +</details> |
55 | 59 |
|
56 | 60 | <% if @edits.any? %> |
57 | 61 | <div class="widget"> |
|
67 | 71 | ><%= edit.active ? 'Pending' : (edit.approved? ? 'Approved' : 'Rejected' ) %></strong> suggested edit |
68 | 72 | by <%= user_link edit.user %>, |
69 | 73 | <span title="<%= edit.created_at.iso8601 %>"><%= time_ago_in_words(edit.created_at) %> ago</span> |
70 | | - <% unless edit.active %> |
71 | | - <br/>Decided by <%= user_link edit.decided_by %>, |
72 | | - <span title="<%= edit.decided_at.iso8601 %>"><%= time_ago_in_words(edit.decided_at) %> ago</span> |
73 | | - <% end %> |
| 74 | + <% unless edit.active %> |
| 75 | + <br/> |
| 76 | + Decided by <%= user_link edit.decided_by %>, |
| 77 | + <span title="<%= edit.decided_at.iso8601 %>"><%= time_ago_in_words(edit.decided_at) %> ago</span> |
| 78 | + <% end %> |
74 | 79 | </div> |
75 | 80 | </div> |
76 | 81 | <% end %> |
77 | 82 | </div> |
78 | 83 | <% else %> |
79 | | -<p>There are no suggested edits in this category.</p> |
| 84 | + <p>There are no suggested edits in this category.</p> |
80 | 85 | <% end %> |
0 commit comments