Fixes an issue where the organization home page would throw a 505 when no projects...
[Melange.git] / app / soc / templates / soc / student_proposal / review.html
blob41444edb2ca8ef05d4b8e0a53b5519517584b34a
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 <b>Summary of Reviews</b>:
64 {% for key, value in review_summary.items %}
65 <li>{{ value.name }} ({{ value.total_comments }} posts, {{ value.total_score }} points)</li>
66 {% endfor %}
68 <hr />
69 <form method="POST">
70 <b>Score and Review</b>
72 <div class="box">
73 <table id="commentcommon">
74 <!-- By default this is not displayed, so that all options work on non-javascript browsers -->
75 <tr style="display: none;">
76 <td class="formfieldlabel">
77 Comment Type:
78 </td>
79 <td class="formfieldvalue" colspan=3>
80 <select id="commenttypeselector" onchange="commentType();">
81 <option value="Private">Private Comment</option>
82 {% if is_org_admin %}
83 <option value="Admin">Admin Comment</option>
84 {% endif %}
85 <option value="Public">Comment Visible to Student</option>
86 </select>
87 </td>
88 </tr>
89 <tbody id="commentpublic">
90 {% block comment_public_form_table %}
91 {% as_table comment_public %}
92 {% endblock %}
93 </tbody>
94 <tbody id="commentprivate">
95 {% block comment_private_form_table %}
96 {% as_table comment_private %}
97 {% endblock %}
98 </tbody>
99 <tbody id="commentadmin">
100 {% block comment_admin_form_table %}
101 {% as_table comment_admin %}
102 {% endblock %}
103 </tbody>
104 </table>
105 </div>
106 <table>
107 <tr>
108 <td colspan="4">&nbsp;</td>
109 </tr>
110 <tr>
111 <td>
112 <input style="font-weight: bold" type="submit" value="Submit"/></span>
113 </td>
114 </tr>
115 <tr>
116 <td><b>Other Options:</b></td>
117 </tr>
118 <tr>
119 {% if add_me_as_mentor %}
120 <td>
121 <input style="font-weight: bold" type="button" value="I am willing to mentor this student"
122 onclick="location.href='?mentor=1'"/>
123 </td>
124 {% else %}
125 {% if remove_me_as_mentor %}
126 <td>
127 <input style="font-weight: bold" type="button" value="I am no longer willing to mentor this student"
128 onclick="location.href='?mentor=0'"/>
129 </td>
130 {% endif %}
131 {% endif %}
132 {% if is_org_admin or is_mentor %}
133 {% ifequal entity.status "invalid" %}
134 <td>
135 <input style="font-weight: bold" type="button" value="Mark as Eligible"
136 onclick="if (confirm('Are you sure you want to mark this proposal as eligible?')) { location.href='?ineligible=0'; }"/>
137 </td>
138 {% else %}
139 <td>
140 <input style="font-weight: bold" type="button" value="Mark as Ineligible"
141 onclick="if (confirm('Are you sure you want to mark this proposal as ineligible?')) { location.href='?ineligible=1'; }"/>
142 </td>
143 {% endifequal %}
144 {% endif %}
145 </tr>
146 </table>
147 </form>
149 <hr />
150 <b>Public Reviews</b>
151 {% for review in public_reviews %}
152 {% as_student_proposal_review review student %}
153 {% endfor %}
154 <hr />
155 <b>Private Reviews</b>
156 {% for review in private_reviews %}
157 {% as_student_proposal_review review student %}
158 {% endfor %}
159 <hr />
161 {% comment %}
162 TODO(pawel.solyga): Put this javascript into separate file
163 {% endcomment %}
164 <script type="text/javascript">
165 function commentType() {
166 var commentTypeSelector = document.getElementById("commenttypeselector");
167 var type = commentTypeSelector[commentTypeSelector.options.selectedIndex].value;
169 var commentPublic = document.getElementById("commentpublic");
170 var commentPrivate = document.getElementById("commentprivate");
171 var commentAdmin = document.getElementById("commentadmin");
173 var publicCheckbox = document.getElementById("id_public");
174 var cssString = "studentproposalcomment-";
175 var cssRemoveString = "studentproposalcomment-";
177 switch (type) {
178 case "Public":
179 commentPublic.style.display = "";
180 commentPrivate.style.display = "none";
181 commentAdmin.style.display = "none";
182 publicCheckbox.checked = true;
183 cssString += "public";
184 cssRemoveString += "private";
185 break;
186 case "Private":
187 commentPublic.style.display = "";
188 commentPrivate.style.display = "";
189 commentAdmin.style.display = "none";
190 publicCheckbox.checked = false;
191 cssString += "private";
192 cssRemoveString += "public";
193 break;
194 case "Admin":
195 commentPublic.style.display = "";
196 commentPrivate.style.display = "";
197 commentAdmin.style.display = "";
198 publicCheckbox.checked = false;
199 cssString += "private";
200 cssRemoveString += "public";
201 break;
202 default:
203 alert("Unknown value");
204 alert(type);
205 break;
207 $($('#commenttypeselector').parents('.box').get(0)).removeClass(cssRemoveString).addClass(cssString);
210 // Set the comment type selector to be displayed
211 var commentTypeSelector = document.getElementById("commenttypeselector");
212 commentTypeSelector.parentNode.parentNode.style.display = "";
213 commentTypeSelector.options.selectedIndex = 0;
214 var publicCheckbox = document.getElementById("id_public");
215 publicCheckbox.parentNode.parentNode.style.display = "none";
217 // Set the comment view to default to what ever is selected
218 commentType();
219 </script>
221 {% endblock %}