|
1 | 1 | <% if session[:user_token] %> |
2 | 2 | <%= link_to 'Logout', session_path(1), data: { turbo_method: :delete } %> |
3 | | - <h1>Puzzles</h1> |
| 3 | + <h1>Pending Puzzles</h1> |
4 | 4 | <table> |
5 | 5 | <thead> |
6 | 6 | <tr> |
7 | 7 | <th>Question</th> |
8 | 8 | <th>Answer</th> |
9 | 9 | <th>Explanation</th> |
10 | 10 | <th>Link</th> |
| 11 | + <th>Actions</th> |
11 | 12 | </tr> |
12 | 13 | </thead> |
13 | 14 | <tbody> |
14 | | - <% @puzzles.each do |puzzle| %> |
| 15 | + <% @pending_puzzles.each do |puzzle| %> |
15 | 16 | <tr> |
16 | 17 | <td><%= puzzle.question %></td> |
17 | 18 | <td><%= puzzle.answer %></td> |
18 | 19 | <td><%= puzzle.explanation %></td> |
19 | | - <td><%= link_to 'View', puzzle.link, target: '_blank' if puzzle.link.present? %></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', approve_puzzle_path(puzzle), method: :patch, form_class: 'inline-form', class: 'approve-btn' %> |
| 28 | + <%= button_to 'Reject', reject_puzzle_path(puzzle), method: :patch, form_class: 'inline-form', class: 'reject-btn' %> |
| 29 | + </td> |
20 | 30 | </tr> |
21 | 31 | <% end %> |
22 | 32 | </tbody> |
23 | 33 | </table> |
| 34 | + |
| 35 | + <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', reject_puzzle_path(puzzle), method: :patch, form_class: 'inline-form', class: 'reject-btn' %> |
| 60 | + <%= button_to 'Pending', pending_puzzle_path(puzzle), method: :patch, form_class: 'inline-form', class: 'pending-btn' %> |
| 61 | + </td> |
| 62 | + </tr> |
| 63 | + <% end %> |
| 64 | + </tbody> |
| 65 | + </table> |
| 66 | + |
| 67 | + <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', approve_puzzle_path(puzzle), method: :patch, form_class: 'inline-form', class: 'approve-btn' %> |
| 92 | + <%= button_to 'Pending', pending_puzzle_path(puzzle), method: :patch, form_class: 'inline-form', class: 'pending-btn' %> |
| 93 | + </td> |
| 94 | + </tr> |
| 95 | + <% end %> |
| 96 | + </tbody> |
| 97 | + </table> |
| 98 | + |
24 | 99 | <% else %> |
25 | 100 | <%= link_to 'Login with Google', '/auth/google_oauth2' %> |
26 | 101 | <% end %> |
|
0 commit comments