|
| 1 | +<% content_for :debug_info do %> |
| 2 | + <!-- |
| 3 | + BOOK_ID: <%= @book.id %> |
| 4 | + QUERY_DOC_PAIR_ID: <%= query_doc_pair.id %> |
| 5 | + JUDGEMENT_ID: <%= judgement.id %> |
| 6 | + JUDGEMENT USER ID: <%= judgement&.user_id %> |
| 7 | + CURRENT USER ID: <%= @current_user.id %> |
| 8 | + --> |
| 9 | +<% end %> |
1 | 10 |
|
2 | 11 | <script> |
3 | 12 | function rate(rating, key_name) { |
|
12 | 21 | keyboard_shortcuts_suffixes.forEach(suffix => { |
13 | 22 | const spanElement = document.getElementById("span-for-" + suffix); |
14 | 23 | const buttonElement = document.getElementById("button-for-" + suffix); |
15 | | - |
| 24 | + |
16 | 25 | if (spanElement) { |
17 | 26 | spanElement.style.color = "gray"; |
18 | 27 | spanElement.style.fontWeight = "normal"; |
19 | 28 | } |
20 | | - |
| 29 | + |
21 | 30 | if (buttonElement) { |
22 | 31 | buttonElement.classList.remove("btn-preselected"); |
23 | 32 | } |
|
30 | 39 | if (suffix !== except_suffix) { |
31 | 40 | const spanElement = document.getElementById("span-for-" + suffix); |
32 | 41 | const buttonElement = document.getElementById("button-for-" + suffix); |
33 | | - |
| 42 | + |
34 | 43 | if (spanElement) { |
35 | 44 | spanElement.style.color = "gray"; |
36 | 45 | spanElement.style.fontWeight = "normal"; |
37 | 46 | } |
38 | | - |
| 47 | + |
39 | 48 | if (buttonElement) { |
40 | 49 | buttonElement.classList.remove("btn-preselected"); |
41 | 50 | } |
|
47 | 56 | resetStyles(); |
48 | 57 | const spanElement = document.getElementById("span-for-" + suffix); |
49 | 58 | const buttonElement = document.getElementById("button-for-" + suffix); |
50 | | - |
| 59 | + |
51 | 60 | if (spanElement) { |
52 | 61 | spanElement.style.color = "black"; |
53 | 62 | spanElement.style.fontWeight = "bold"; |
54 | 63 | } |
55 | | - |
| 64 | + |
56 | 65 | if (buttonElement) { |
57 | 66 | buttonElement.classList.add("btn-preselected"); |
58 | 67 | } |
|
91 | 100 | } |
92 | 101 |
|
93 | 102 | const keyCode = e.which || e.keyCode; |
94 | | - |
| 103 | + |
95 | 104 | if (keyCode == 97 || keyCode == 65) { |
96 | 105 | keyPressed("a"); |
97 | 106 | } else if (keyCode == 115 || keyCode == 83) { |
|
120 | 129 | if (isExplanationModalOpen() || isTypingInTextField()) { |
121 | 130 | return; |
122 | 131 | } |
123 | | - |
| 132 | + |
124 | 133 | const keyCode = e.which || e.keyCode; |
125 | | - |
| 134 | + |
126 | 135 | if (keyCode == 97 || keyCode == 65) { |
127 | 136 | keyDown("a"); |
128 | 137 | } else if (keyCode == 115 || keyCode == 83) { |
|
211 | 220 | </div> |
212 | 221 |
|
213 | 222 |
|
214 | | - <div class="float-end"> |
| 223 | + <div class="float-end"> |
215 | 224 | <%= link_to 'I will Judge Later', book_query_doc_pair_judge_later_path(@book, query_doc_pair), class: 'btn btn-info m-1', role: 'button' %> |
216 | 225 | <br/> |
217 | 226 | <button type="button" class="btn btn-warning m-1" data-bs-toggle="modal" data-bs-target="#explanationModal"> |
|
222 | 231 | <p class="card-text"> |
223 | 232 | <%= render 'query_doc_pairs/document_fields', document_fields: @document_fields %> |
224 | 233 | </p> |
225 | | - |
| 234 | + |
226 | 235 | <div class="mt-3"> |
227 | 236 | <label for="judgement_explanation" class="form-label">Explanation (optional)</label> |
228 | 237 | <%= form.text_area :explanation, class: 'form-control', rows: 2, placeholder: 'Why did you choose this rating?' %> |
229 | 238 | </div> |
230 | | - |
| 239 | + |
231 | 240 | <% if @book.show_rank? %> |
232 | 241 | <p class="card-text"> |
233 | 242 | <b>Document Rank: </b><%= judgement.query_doc_pair.position %> |
|
275 | 284 | </tr> |
276 | 285 | </table> |
277 | 286 | <% end %> |
278 | | - |
| 287 | + |
279 | 288 |
|
280 | 289 | </div> |
281 | 290 | <% if image_url %> |
|
0 commit comments