Make "Private Comment" first in the selection box on Student Proposal review page.
[Melange.git] / app / soc / templates / soc / student_proposal / review.html
blobc95370e51caf130b2683855c86a1cb5f438c713c
1 {% extends "soc/base.html" %}
2 {% comment %}
3 Licensed under the Apache License, Version 2.0 (the "License");
4 you may not use this file except in compliance with the License.
5 You may obtain a copy of the License at
7 http://www.apache.org/licenses/LICENSE-2.0
9 Unless required by applicable law or agreed to in writing, software
10 distributed under the License is distributed on an "AS IS" BASIS,
11 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 See the License for the specific language governing permissions and
13 limitations under the License.
14 {% endcomment %}
15 {% load comments_helpers %}
16 {% load forms_helpers %}
18 {% block header_title %}
19 {{ page_name }} (Score: {{ entity.score }})
20 {% endblock %}
22 {% block body %}
23 <table>
24 {% if is_subscribed_public %}
25 <td>
26 <input style="font-weight: bold" type="button" value="Unsubscribe from public updates"
27 onclick="location.href='?public_subscription=off'"/>
28 </td>
29 {% else %}
30 <td>
31 <input style="font-weight: bold" type="button" value="Subscribe to public updates"
32 onclick="location.href='?public_subscription=on'"/>
33 </td>
34 {% endif %}
35 {% if is_subscribed_private %}
36 <td>
37 <input style="font-weight: bold" type="button" value="Unsubscribe from private updates"
38 onclick="location.href='?private_subscription=off'"/>
39 </td>
40 {% else %}
41 <td>
42 <input style="font-weight: bold" type="button" value="Subscribe to private updates"
43 onclick="location.href='?private_subscription=on'"/>
44 </td>
45 {% endif %}
46 </table>
48 <p>
49 <table>
50 {% readonly_field_as_table_row entity.fields.title.label entity.title %}
51 {% readonly_field_as_table_row "Student" student_name %}
52 {% readonly_field_as_table_row "Mentor" mentor_name %}
53 {% readonly_field_as_table_row "Possible Mentors" possible_mentors %}
54 {% readonly_field_as_table_row entity.fields.abstract.label entity.abstract %}
55 {% readonly_safe_field_as_table_row entity.fields.content.label entity.content %}
56 {% readonly_url_field_as_table_row entity.fields.additional_info.label entity.additional_info %}
57 {% readonly_field_as_table_row "Created on" entity.created_on %}
58 {% readonly_field_as_table_row "Last Modified on" entity.last_modified_on %}
59 </table>
60 </p>
62 <hr />
63 <form method="POST">
64 <b>Score and Review</b>
66 <div class="box">
67 <table id="commentcommon">
68 <!-- By default this is not displayed, so that all options work on non-javascript browsers -->
69 <tr style="display: none;">
70 <td class="formfieldlabel">
71 Comment Type:
72 </td>
73 <td class="formfieldvalue" colspan=3>
74 <select id="commenttypeselector" onchange="commentType();">
75 <option value="Private">Private Comment</option>
76 {% if is_org_admin %}
77 <option value="Admin">Admin Comment</option>
78 {% endif %}
79 <option value="Public">Comment Visible to Student</option>
80 </select>
81 </td>
82 </tr>
83 <tbody id="commentpublic">
84 {% block comment_public_form_table %}
85 {% as_table comment_public %}
86 {% endblock %}
87 </tbody>
88 <tbody id="commentprivate">
89 {% block comment_private_form_table %}
90 {% as_table comment_private %}
91 {% endblock %}
92 </tbody>
93 <tbody id="commentadmin">
94 {% block comment_admin_form_table %}
95 {% as_table comment_admin %}
96 {% endblock %}
97 </tbody>
98 </table>
99 </div>
100 <table>
101 <tr>
102 <td colspan="4">&nbsp;</td>
103 </tr>
104 <tr>
105 <td>
106 <input style="font-weight: bold" type="submit" value="Submit"/></span>
107 </td>
108 </tr>
109 <tr>
110 <td><b>Other Options:</b></td>
111 </tr>
112 <tr>
113 {% if add_me_as_mentor %}
114 <td>
115 <input style="font-weight: bold" type="button" value="I am willing to mentor this student"
116 onclick="location.href='?mentor=1'"/>
117 </td>
118 {% else %}
119 {% if remove_me_as_mentor %}
120 <td>
121 <input style="font-weight: bold" type="button" value="I am no longer willing to mentor this student"
122 onclick="location.href='?mentor=0'"/>
123 </td>
124 {% endif %}
125 {% endif %}
126 {% if is_org_admin or is_mentor %}
127 {% ifequal entity.status "invalid" %}
128 <td>
129 <input style="font-weight: bold" type="button" value="Mark as Eligible"
130 onclick="if (confirm('Are you sure you want to mark this proposal as eligible?')) { location.href='?ineligible=0'; }"/>
131 </td>
132 {% else %}
133 <td>
134 <input style="font-weight: bold" type="button" value="Mark as Ineligible"
135 onclick="if (confirm('Are you sure you want to mark this proposal as ineligible?')) { location.href='?ineligible=1'; }"/>
136 </td>
137 {% endifequal %}
138 {% endif %}
139 </tr>
140 </table>
141 </form>
143 <hr />
144 <b>Public Reviews</b>
145 {% for review in public_reviews %}
146 {% as_student_proposal_review review student %}
147 {% endfor %}
148 <hr />
149 <b>Private Reviews</b>
150 {% for review in private_reviews %}
151 {% as_student_proposal_review review student %}
152 {% endfor %}
153 <hr />
155 {% comment %}
156 TODO(pawel.solyga): Put this javascript into separate file
157 {% endcomment %}
158 <script type="text/javascript">
159 function commentType() {
160 var commentTypeSelector = document.getElementById("commenttypeselector");
161 var type = commentTypeSelector[commentTypeSelector.options.selectedIndex].value;
163 var commentPublic = document.getElementById("commentpublic");
164 var commentPrivate = document.getElementById("commentprivate");
165 var commentAdmin = document.getElementById("commentadmin");
167 var publicCheckbox = document.getElementById("id_public");
168 var cssString = "studentproposalcomment-";
169 var cssRemoveString = "studentproposalcomment-";
171 switch (type) {
172 case "Public":
173 commentPublic.style.display = "";
174 commentPrivate.style.display = "none";
175 commentAdmin.style.display = "none";
176 publicCheckbox.checked = true;
177 cssString += "public";
178 cssRemoveString += "private";
179 break;
180 case "Private":
181 commentPublic.style.display = "";
182 commentPrivate.style.display = "";
183 commentAdmin.style.display = "none";
184 publicCheckbox.checked = false;
185 cssString += "private";
186 cssRemoveString += "public";
187 break;
188 case "Admin":
189 commentPublic.style.display = "";
190 commentPrivate.style.display = "";
191 commentAdmin.style.display = "";
192 publicCheckbox.checked = false;
193 cssString += "private";
194 cssRemoveString += "public";
195 break;
196 default:
197 alert("Unknown value");
198 alert(type);
199 break;
201 $($('#commenttypeselector').parents('.box').get(0)).removeClass(cssRemoveString).addClass(cssString);
204 // Set the comment type selector to be displayed
205 var commentTypeSelector = document.getElementById("commenttypeselector");
206 commentTypeSelector.parentNode.parentNode.style.display = "";
207 commentTypeSelector.options.selectedIndex = 0;
208 var publicCheckbox = document.getElementById("id_public");
209 publicCheckbox.parentNode.parentNode.style.display = "none";
211 // Set the comment view to default to what ever is selected
212 commentType();
213 </script>
215 {% endblock %}