1+ < table >
2+ < thead >
3+ < tr >
4+ < th > Question</ th >
5+ < th > Answer</ th >
6+ < th > Explanation</ th >
7+ < th > Link</ th >
8+ < th > Actions</ th >
9+ </ tr >
10+ </ thead >
11+ < tbody >
12+ <% puzzles . each do |puzzle | %>
13+ < tr >
14+ < td > <%= puzzle . question %> </ td >
15+ < td > <%= puzzle . answer %> </ td >
16+ < td > <%= puzzle . explanation %> </ td >
17+ < td >
18+ <% if puzzle . link . present? %>
19+ <%= link_to 'View' , puzzle . link , target : '_blank' %>
20+
21+ <% end %>
22+ </ td >
23+ < td >
24+ <% if actions == :pending %>
25+ <%= button_to 'Approve' , puzzle_state_path ( puzzle , state : :approved ) , method : :patch , form_class : 'inline-form' , class : 'btn approve-btn' %>
26+ <%= button_to 'Reject' , puzzle_state_path ( puzzle , state : :rejected ) , method : :patch , form_class : 'inline-form' , class : 'btn reject-btn' %>
27+ <% elsif actions == :approved %>
28+ <%= button_to 'Reject' , puzzle_state_path ( puzzle , state : :rejected ) , method : :patch , form_class : 'inline-form' , class : 'btn reject-btn' %>
29+ <%= button_to 'Pending' , puzzle_state_path ( puzzle , state : :pending ) , method : :patch , form_class : 'inline-form' , class : 'btn pending-btn' %>
30+ <% elsif actions == :rejected %>
31+ <%= button_to 'Approve' , puzzle_state_path ( puzzle , state : :approved ) , method : :patch , form_class : 'inline-form' , class : 'btn approve-btn' %>
32+ <%= button_to 'Pending' , puzzle_state_path ( puzzle , state : :pending ) , method : :patch , form_class : 'inline-form' , class : 'btn pending-btn' %>
33+ <% end %>
34+ </ td >
35+ </ tr >
36+ <% end %>
37+ </ tbody >
38+ </ table >
0 commit comments