|
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> |
23 | | - <table> |
24 | | - <tr> |
25 | | - <th>category</th> |
26 | | - <th>pending edits</th> |
27 | | - </tr> |
28 | | - <% categories.each do |cat| %> |
29 | | - <% 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 %> |
| 27 | +<% unless @show_decided %> |
| 28 | + <details class="has-margin-top-2"> |
| 29 | + <summary> |
| 30 | + Categories |
| 31 | + </summary> |
| 32 | + <table> |
| 33 | + <tr> |
| 34 | + <th>category</th> |
| 35 | + <th>pending edits</th> |
| 36 | + </tr> |
| 37 | + <% categories.each do |cat| %> |
| 38 | + <% next if (cat.min_view_trust_level || -1) > (current_user&.trust_level || 0) %> |
| 39 | + <% sug_edits = SuggestedEdit.where(post: Post.undeleted.in(cat), active: true).count %> |
| 40 | + <tr> |
| 41 | + <td> |
| 42 | + <% if cat == current_cat %> |
| 43 | + <%= cat.name %> |
| 44 | + <% else %> |
| 45 | + <%= link_to suggested_edits_queue_url(cat) do %> |
| 46 | + <%= cat.name %> |
| 47 | + <% end %> |
| 48 | + <% end %> |
| 49 | + </td> |
| 50 | + <td> |
| 51 | + <% if cat == current_cat %> |
| 52 | + <%= sug_edits %> |
| 53 | + <% else %> |
| 54 | + <%= link_to suggested_edits_queue_url(cat) do %> |
| 55 | + <%= sug_edits %> |
| 56 | + <% end %> |
| 57 | + <% end %> |
| 58 | + </td> |
| 59 | + </tr> |
48 | 60 | <% end %> |
49 | | - </td> |
50 | | - </tr> |
51 | | - <% end %> |
52 | | - </table> |
| 61 | + </table> |
| 62 | + </details> |
53 | 63 | <% end %> |
54 | 64 |
|
55 | | - |
56 | 65 | <% if @edits.any? %> |
57 | 66 | <div class="widget"> |
58 | 67 | <% @edits.each do |edit| %> |
|
67 | 76 | ><%= edit.active ? 'Pending' : (edit.approved? ? 'Approved' : 'Rejected' ) %></strong> suggested edit |
68 | 77 | by <%= user_link edit.user %>, |
69 | 78 | <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 %> |
| 79 | + <% unless edit.active %> |
| 80 | + <br/> |
| 81 | + Decided by <%= user_link edit.decided_by %>, |
| 82 | + <span title="<%= edit.decided_at.iso8601 %>"><%= time_ago_in_words(edit.decided_at) %> ago</span> |
| 83 | + <% end %> |
74 | 84 | </div> |
75 | 85 | </div> |
76 | 86 | <% end %> |
77 | 87 | </div> |
78 | 88 | <% else %> |
79 | | -<p>There are no suggested edits in this category.</p> |
| 89 | + <p>There are no suggested edits in this category.</p> |
80 | 90 | <% end %> |
0 commit comments