Fix posting public comments as private in student proposals review.html template.
[Melange.git] / app / soc / templates / soc / student_proposal / review.html
blob241ceef2dfbd4070a88deb44096b6f4ff8bda5cd
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_twoline_table_row entity.fields.abstract.label entity.abstract %}
55 {% readonly_safe_field_as_twoline_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="Public">Public Comment</option>
76 <option value="Private">Private Comment</option>
77 {% if is_org_admin %}
78 <option value="Admin">Admin Comment</option>
79 {% endif %}
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 %}
127 <td>
128 <input style="font-weight: bold" type="button" value="Mark as Ineligible"
129 onclick="if (confirm('Are you sure? This can not be undone!')) { location.href='?ineligible=1'; }"/>
130 </td>
131 {% endif %}
132 </tr>
133 </table>
134 </form>
136 <hr />
137 <b>Public Reviews</b>
138 {% for review in public_reviews %}
139 {% as_student_proposal_review review student %}
140 {% endfor %}
141 <hr />
142 <b>Private Reviews</b>
143 {% for review in private_reviews %}
144 {% as_student_proposal_review review student %}
145 {% endfor %}
146 <hr />
148 {% comment %}
149 TODO(pawel.solyga): Put this javascript into separate file
150 {% endcomment %}
151 <script type="text/javascript">
152 function commentType() {
153 var commentTypeSelector = document.getElementById("commenttypeselector");
154 var type = commentTypeSelector[commentTypeSelector.options.selectedIndex].value;
156 var commentPublic = document.getElementById("commentpublic");
157 var commentPrivate = document.getElementById("commentprivate");
158 var commentAdmin = document.getElementById("commentadmin");
160 var publicCheckbox = document.getElementById("id_public");
161 var cssString = "studentproposalcomment-";
162 var cssRemoveString = "studentproposalcomment-";
164 switch (type) {
165 case "Public":
166 commentPublic.style.display = "";
167 commentPrivate.style.display = "none";
168 commentAdmin.style.display = "none";
169 publicCheckbox.checked = true;
170 cssString += "public";
171 cssRemoveString += "private";
172 break;
173 case "Private":
174 commentPublic.style.display = "";
175 commentPrivate.style.display = "";
176 commentAdmin.style.display = "none";
177 publicCheckbox.checked = false;
178 cssString += "private";
179 cssRemoveString += "public";
180 break;
181 case "Admin":
182 commentPublic.style.display = "";
183 commentPrivate.style.display = "";
184 commentAdmin.style.display = "";
185 publicCheckbox.checked = false;
186 cssString += "private";
187 cssRemoveString += "public";
188 break;
189 default:
190 alert("Unknown value");
191 alert(type);
192 break;
194 $($('#commenttypeselector').parents('.box').get(0)).removeClass(cssRemoveString).addClass(cssString);
197 // Set the comment type selector to be displayed
198 var commentTypeSelector = document.getElementById("commenttypeselector");
199 commentTypeSelector.parentNode.parentNode.style.display = "";
200 commentTypeSelector.options.selectedIndex = 0;
201 var publicCheckbox = document.getElementById("id_public");
202 publicCheckbox.parentNode.parentNode.style.display = "none";
204 // Set the comment view to default to what ever is selected
205 commentType();
206 </script>
208 {% endblock %}