|
1 | 1 | <% if session[:user_token] %> |
2 | 2 | <%= link_to 'Logout', session_path(1), data: { turbo_method: :delete } %> |
| 3 | + |
3 | 4 | <h1>Pending Puzzles</h1> |
4 | | - <table> |
5 | | - <thead> |
6 | | - <tr> |
7 | | - <th>Question</th> |
8 | | - <th>Answer</th> |
9 | | - <th>Explanation</th> |
10 | | - <th>Link</th> |
11 | | - <th>Actions</th> |
12 | | - </tr> |
13 | | - </thead> |
14 | | - <tbody> |
15 | | - <% @pending_puzzles.each do |puzzle| %> |
16 | | - <tr> |
17 | | - <td><%= puzzle.question %></td> |
18 | | - <td><%= puzzle.answer %></td> |
19 | | - <td><%= puzzle.explanation %></td> |
20 | | - <td> |
21 | | - <% if puzzle.link.present? %> |
22 | | - <%= link_to 'View', puzzle.link, target: '_blank' %> |
23 | | - |
24 | | - <% end %> |
25 | | - </td> |
26 | | - <td> |
27 | | - <%= button_to 'Approve', puzzle_state_path(puzzle, state: :approved), method: :patch, form_class: 'inline-form', class: 'approve-btn' %> |
28 | | - <%= button_to 'Reject', puzzle_state_path(puzzle, state: :rejected), method: :patch, form_class: 'inline-form', class: 'reject-btn' %> |
29 | | - </td> |
30 | | - </tr> |
31 | | - <% end %> |
32 | | - </tbody> |
33 | | - </table> |
| 5 | + <%= render partial: 'puzzles_table', locals: { puzzles: @pending_puzzles, actions: :pending } %> |
34 | 6 |
|
35 | 7 | <h1>Approved Puzzles</h1> |
36 | | - <table> |
37 | | - <thead> |
38 | | - <tr> |
39 | | - <th>Question</th> |
40 | | - <th>Answer</th> |
41 | | - <th>Explanation</th> |
42 | | - <th>Link</th> |
43 | | - <th>Actions</th> |
44 | | - </tr> |
45 | | - </thead> |
46 | | - <tbody> |
47 | | - <% @approved_puzzles.each do |puzzle| %> |
48 | | - <tr> |
49 | | - <td><%= puzzle.question %></td> |
50 | | - <td><%= puzzle.answer %></td> |
51 | | - <td><%= puzzle.explanation %></td> |
52 | | - <td> |
53 | | - <% if puzzle.link.present? %> |
54 | | - <%= link_to 'View', puzzle.link, target: '_blank' %> |
55 | | - |
56 | | - <% end %> |
57 | | - </td> |
58 | | - <td> |
59 | | - <%= button_to 'Reject', puzzle_state_path(puzzle, state: :rejected), method: :patch, form_class: 'inline-form', class: 'reject-btn' %> |
60 | | - <%= button_to 'Pending', puzzle_state_path(puzzle, state: :pending), method: :patch, form_class: 'inline-form', class: 'pending-btn' %> |
61 | | - </td> |
62 | | - </tr> |
63 | | - <% end %> |
64 | | - </tbody> |
65 | | - </table> |
| 8 | + <%= render partial: 'puzzles_table', locals: { puzzles: @approved_puzzles, actions: :approved } %> |
66 | 9 |
|
67 | 10 | <h1>Rejected Puzzles</h1> |
68 | | - <table> |
69 | | - <thead> |
70 | | - <tr> |
71 | | - <th>Question</th> |
72 | | - <th>Answer</th> |
73 | | - <th>Explanation</th> |
74 | | - <th>Link</th> |
75 | | - <th>Actions</th> |
76 | | - </tr> |
77 | | - </thead> |
78 | | - <tbody> |
79 | | - <% @rejected_puzzles.each do |puzzle| %> |
80 | | - <tr> |
81 | | - <td><%= puzzle.question %></td> |
82 | | - <td><%= puzzle.answer %></td> |
83 | | - <td><%= puzzle.explanation %></td> |
84 | | - <td> |
85 | | - <% if puzzle.link.present? %> |
86 | | - <%= link_to 'View', puzzle.link, target: '_blank' %> |
87 | | - |
88 | | - <% end %> |
89 | | - </td> |
90 | | - <td> |
91 | | - <%= button_to 'Approve', puzzle_state_path(puzzle, state: :approved), method: :patch, form_class: 'inline-form', class: 'approve-btn' %> |
92 | | - <%= button_to 'Pending', puzzle_state_path(puzzle, state: :pending), method: :patch, form_class: 'inline-form', class: 'pending-btn' %> |
93 | | - </td> |
94 | | - </tr> |
95 | | - <% end %> |
96 | | - </tbody> |
97 | | - </table> |
| 11 | + <%= render partial: 'puzzles_table', locals: { puzzles: @rejected_puzzles, actions: :rejected } %> |
98 | 12 | <% else %> |
99 | 13 | <%= link_to 'Login with Google', '/auth/google_oauth2' %> |
100 | 14 | <% end %> |
|
0 commit comments