app/soc/templates/modules/ghop/task/public.html
changeset 2827 58e2a02e35b4
equal deleted inserted replaced
2826:211783aa20d5 2827:58e2a02e35b4
       
     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
       
     6 
       
     7   http://www.apache.org/licenses/LICENSE-2.0
       
     8 
       
     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 forms_helpers %}
       
    16 {% load ghop_comments_helpers %}
       
    17 
       
    18 {% block scripts %}
       
    19 {{ block.super }}
       
    20 
       
    21 <script type="text/javascript">
       
    22   $(document).ready(function(){
       
    23 	  if (!$('#id_work_submission').val()) {
       
    24 		  $('[for^=id_work_submission]').hide();
       
    25 		  $('#id_work_submission').hide();
       
    26 		}
       
    27     $('#id_action').change(function() {
       
    28       if ($(this).val() == 'needs_review') {
       
    29         $('[for^=id_work_submission]').show("normal");
       
    30         $('#id_work_submission').show("normal");
       
    31         $('td.formfielderror').show("normal");
       
    32       }
       
    33       else if ($(this).val() != 'needs_work'){
       
    34         $('[for^=id_work_submission]').hide("normal");
       
    35         $('#id_work_submission').hide("normal");
       
    36         $('td.formfielderror').hide("normal");
       
    37       }
       
    38     });
       
    39 
       
    40     if (!$('#id_extended_deadline').val()) {
       
    41 	    $('[for^=id_extended_deadline]').hide();
       
    42 	    $('#id_extended_deadline').hide();
       
    43     }
       
    44     $('#id_action').change(function() {
       
    45       if ($(this).val() == 'needs_work') {
       
    46         $('[for^=id_extended_deadline]').show("normal");
       
    47         $('#id_extended_deadline').show("normal");
       
    48         $('td.formfielderror').show("normal");
       
    49       }
       
    50       else if ($(this).val() != 'needs_review'){
       
    51         $('[for^=id_extended_deadline]').hide("normal");
       
    52         $('#id_extended_deadline').hide("normal");
       
    53         $('td.formfielderror').hide("normal");
       
    54       }
       
    55     });
       
    56 
       
    57     nosubscribe = '/soc/content/images/star-white.png'
       
    58     subscribe = '/soc/content/images/star-gold.png';
       
    59 
       
    60     $.get('/ghop/task_subscription/subscribe', 
       
    61             { key_name: '{{ entity_key_name }}',
       
    62               no_toggle: true },
       
    63             function(data){
       
    64              if (data == 'remove') { 
       
    65                 $("img#subscribe").attr('src', subscribe);
       
    66                 $("img#subscribe").attr('title', 'Unsubscribe from this task');
       
    67               } else {
       
    68                 $("img#subscribe").attr('src', nosubscribe);
       
    69                 $("img#subscribe").attr('title', 'Subscribe to this task');
       
    70               }
       
    71             }
       
    72     );
       
    73 
       
    74     $("img#subscribe").click(
       
    75       function () {
       
    76         if ($("img#subscribe").attr('src') == subscribe) {
       
    77           $("img#subscribe").attr('src', nosubscribe);
       
    78           $("img#subscribe").attr('title', 'Subscribe to this task');
       
    79         } else if ($("img#subscribe").attr('src') == nosubscribe) {
       
    80           $("img#subscribe").attr('src', subscribe);
       
    81           $("img#subscribe").attr('title', 
       
    82                                   'Unsubscribe from this task');
       
    83         }
       
    84         $.get('/ghop/task_subscription/subscribe', 
       
    85              { key_name: '{{ entity_key_name }}' },
       
    86               function(data){
       
    87                 if (data == 'add') { 
       
    88                   $("img#subscribe").attr('src', subscribe);
       
    89                   $("img#subscribe").attr('title', 
       
    90                                           'Unsubscribe from this task');
       
    91                 } else if (data == 'remove') {
       
    92                  $("img#subscribe").attr('src', nosubscribe);
       
    93                  $("img#subscribe").attr('title', 'Subscribe to this task');
       
    94                 }
       
    95               });
       
    96      }
       
    97     );
       
    98   });
       
    99 </script>
       
   100 {% endblock %}
       
   101 
       
   102 {% block header_title %}
       
   103 {% if account %}
       
   104 <img id="subscribe" src="/soc/content/images/star-white.png" />
       
   105 {% endif %}
       
   106 Title: {{ entity.title }}
       
   107 
       
   108 {% if edit_link %}
       
   109 (<a href='{{ edit_link }}'>Edit this task</a>)
       
   110 {% else %}{% if suggest_link %}
       
   111 (<a href='{{ suggest_link }}'>Edit this task</a>)
       
   112 {% endif %}{% endif %}
       
   113 
       
   114 {% endblock %}
       
   115 
       
   116 {% block body %}
       
   117 
       
   118 {% block task-show %}
       
   119 {% if header_msg %} 
       
   120 <p>
       
   121  <div id="pageheader">
       
   122   <table width="100%" cellpadding="0" cellspacing="0">
       
   123    <tr>
       
   124     <td style="font-weight: bold; text-align:center"> 
       
   125      {{ header_msg }}
       
   126     </td>
       
   127    </tr>
       
   128   </table>
       
   129  </div>
       
   130 </p>
       
   131 {% endif %}
       
   132 
       
   133 <div id="created">
       
   134  {% readonly_date_field_as_table_row "Last Modified on" entity.modified_on %}
       
   135  by {{ entity.modified_by.name }}
       
   136 </div>
       
   137 
       
   138 <p>
       
   139  <table>
       
   140   {% readonly_safe_field_as_table_row entity.fields.description.label entity.description %}
       
   141   {% readonly_field_as_table_row "Difficulty" difficulty_str %}
       
   142   {% readonly_field_as_table_row "Task Type Tags" task_type_str %}
       
   143   {% readonly_field_as_table_row entity.fields.time_to_complete.label time_to_complete %}
       
   144   {% readonly_field_as_table_row "Mentor(s)" mentors_str %}
       
   145   {% readonly_date_field_as_table_row entity.fields.deadline.label entity.deadline %}
       
   146  </table>
       
   147 </p>
       
   148 <hr />
       
   149 {% endblock task-show %}
       
   150 
       
   151 {% if comment_disabled %}
       
   152   <h4>Comments are disabled</h4>
       
   153 {% else %}
       
   154 {% block comment-form %}
       
   155 <p>
       
   156 {% if signin_comment_msg %}
       
   157   <h4>{{ signin_comment_msg|safe }}</h4>
       
   158 {% else %}
       
   159 <form method="POST">
       
   160  <table>
       
   161    {% block form_table %}
       
   162      {% as_table comment_form %}
       
   163    {% endblock %}
       
   164  </table>
       
   165  <table>
       
   166   <tr><td colspan="4">&nbsp;</td></tr>
       
   167   <tr>
       
   168    <td>
       
   169     <input style="font-weight: bold; float: right" type="submit"
       
   170     name="submit" value="Save Changes"/></span>
       
   171    </td>
       
   172   </tr>
       
   173  </table>
       
   174 </form>
       
   175 {% endif %}
       
   176 </p>
       
   177 <br /><br />
       
   178 <hr />
       
   179 {% endblock comment-form %}
       
   180 {% endif %}
       
   181 
       
   182 {% block list-work-submissions %}
       
   183 {% if work_submissions %}
       
   184 <h3> Work Submission:</h3>
       
   185 {% for work_submission in work_submissions %}
       
   186   {% as_ghop_task_ws work_submission %}
       
   187 {% endfor %}
       
   188 <br /><br />
       
   189 <hr />
       
   190 {% endif %}
       
   191 {% endblock list-work-submissions %}
       
   192 {% block list-comments %}
       
   193 {% if comments %}
       
   194 <h3> Comments and Actions:</h3>
       
   195 {% for comment in comments %}
       
   196   {% as_ghop_task_comment comment %}
       
   197 {% endfor %}
       
   198 {% endif %}
       
   199 {% endblock list-comments %}
       
   200 
       
   201 {% endblock %}
       
   202