Daniel Pope avatar Daniel Pope committed 04542d2

Fix: show the rating form correctly; clarify the language around the not working field

Comments (0)

Files changed (2)

pyweek/challenge/templates/challenge/entry.html

 <strong>Respondents</strong>: {{ rating.respondents|floatformat }}<br >
 {% endif %}
 
+{% if form %}
+
 <script>
 $(function () {
-    $('#ratings_detail').hide();
-    $('#id_nonworking_0').click(function () {
-        $('#ratings_detail').hide();
-    });
-    $('#id_nonworking_1').click(function () {
-        $('#ratings_detail').show();
-    });
+
+    function show_ratings_detail() {
+        var value = $('input:radio[name=nonworking]:checked').val();
+        if (value != "False") {
+            $('#ratings_detail').hide();
+        } else {
+            $('#ratings_detail').show();
+        }
+        if (value == "True") {
+            $('#notworking_help').show();
+        } else {
+            $('#notworking_help').hide();
+        }
+    }
+
+    show_ratings_detail();
+    $('input:radio[name=nonworking]').change(show_ratings_detail);
 });
 </script>
-
-{% if form %}
 <fieldset id="ratings">
 <legend>Entry Rating</legend>
 <p>When rating each game, please consider it on its own merits. Don't try
 <table cellspacing=0 cellpadding=0>
 
 <tr{% if form.nonworking.errors %} class="form-error"{% endif %}>
- <td class="form-label"><label for="id_nonworking">Entry Did Not Work:</label></td>
+ <td class="form-label"><label for="id_nonworking">Did the entry work?</label></td>
  <td id="ratings_nonworking">{{ form.nonworking }}
   {% if form.nonworking.errors %}
    <p class="form-error">{{ form.nonworking.errors|join:", " }}</p>
   {% endif %}
-  <p class="form-help" style="clear: left;">The entry did not work for you.
-  Please explain what happened, including how you ran the game and what
-  resulted from that (include a traceback if you got one).</p>
  </td>
 </tr>
 
 </table>
-<table cellspacing=0 cellpadding=0 id="ratings_detail">
-
+<p id="notworking_help" style="clear: left;">
+Please explain what happened, including how you ran the game and what
+resulted from that (include a traceback if you got one).</p>
+<table cellspacing=0 cellpadding=0 id="ratings_detail" style="margin-top: 1em">
  <tr{% if form.fun.errors %} class="form-error"{% endif %}>
   <td class="form-label"><label for="id_fun">Fun:</label></td>
   <td>{{ form.fun }}

pyweek/challenge/views/entry.py

     innovation = forms.IntegerField(widget=forms.Select( choices=models.RATING_CHOICES))
     production = forms.IntegerField(widget=forms.Select( choices=models.RATING_CHOICES))
     nonworking = forms.TypedChoiceField(coerce=lambda x: x =='True',
-        choices=((False, 'No'), (True, 'Yes')),
+        choices=((False, 'Playable'), (True, 'Failed to run/unplayable problems')),
         widget=forms.RadioSelect)
     #forms.BooleanField(required=False)
     disqualify = forms.BooleanField(required=False)
Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.