Added skeleton view and templates for GradingSurveyGroup.
authorLennard de Rijk <ljvderijk@gmail.com>
Thu, 09 Jul 2009 11:52:35 +0200
changeset 2580 cd3b42f52b21
parent 2579 0d4ffe73a019
child 2581 1614713cd973
Added skeleton view and templates for GradingSurveyGroup.
app/soc/templates/soc/grading_survey_group/list/heading.html
app/soc/templates/soc/grading_survey_group/list/row.html
app/soc/templates/soc/grading_survey_group/public.html
app/soc/views/models/grading_survey_group.py
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/grading_survey_group/list/heading.html	Thu Jul 09 11:52:35 2009 +0200
@@ -0,0 +1,5 @@
+<tr align="left">
+  <th class="first" align="right">Name</th>
+  <th>Last update started</th>
+  <th>Last update completed</th>
+</tr>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/grading_survey_group/list/row.html	Thu Jul 09 11:52:35 2009 +0200
@@ -0,0 +1,9 @@
+<tr class="off" onmouseover="this.className='on'; do_redirect=true" onmouseout="this.className='off'" 
+onclick="if (do_redirect) document.location.href='{{ list.redirect }}'" name="name">
+  <td align="right"><div class="name"><a class="noul" onclick="do_redirect=false"
+         href="{{ list.redirect }}">{{ list.item.name }}</a>
+     </div>
+  </td>
+  <td><div class="date">{{ list.item.last_update_started|date:"jS F Y H:i" }}</a></div></td>
+  <td><div class="date">{{ list.item.last_update_complete|date:"jS F Y H:i" }}</a></div></td>
+</tr>
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/grading_survey_group/public.html	Thu Jul 09 11:52:35 2009 +0200
@@ -0,0 +1,25 @@
+{% extends "soc/base.html" %}
+{% comment %}
+Licensed under the Apache License, Version 2.0 (the "License");
+you may not use this file except in compliance with the License.
+You may obtain a copy of the License at
+
+  http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing, software
+distributed under the License is distributed on an "AS IS" BASIS,
+WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+See the License for the specific language governing permissions and
+limitations under the License.
+{% endcomment %}
+{% load forms_helpers %}
+
+{% block body %}
+<p>
+ <table>
+  {% readonly_field_as_table_row entity.fields.title.label entity.title %}
+  {% readonly_field_as_table_row entity.fields.last_update_started.label entity.last_update_started %}
+  {% readonly_field_as_table_row entity.fields.last_update_complete.label entity.last_update_complete %}
+ </table>
+</p>
+{% endblock %}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/views/models/grading_survey_group.py	Thu Jul 09 11:52:35 2009 +0200
@@ -0,0 +1,73 @@
+#!/usr/bin/python2.5
+#
+# Copyright 2009 the Melange authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+#   http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+"""Views for GradingSurveyGroup.
+"""
+
+__authors__ = [
+    '"Lennard de Rijk" <ljvderijk@gmail.com>',
+  ]
+
+
+from soc.logic import dicts
+from soc.views.helper import access
+from soc.views.models import base
+
+import soc.logic.models.grading_survey_group
+
+
+class View(base.View):
+  """View methods for the GradingSurveyGroup model.
+  """
+
+  def __init__(self, params=None):
+    """Defines the fields and methods required for the base View class
+    to provide the user with list, public, create, edit and delete views.
+
+    Params:
+      params: a dict with params for this View
+    """
+
+    rights = access.Checker(params)
+    rights['create'] = ['checkIsDeveloper']
+    rights['edit'] = ['checkIsDeveloper']
+    rights['delete'] = ['checkIsDeveloper']
+    rights['show'] = ['checkIsDeveloper']
+    rights['list'] = ['checkIsDeveloper']
+
+    new_params = {}
+    new_params['logic'] = soc.logic.models.grading_survey_group.logic
+    new_params['rights'] = rights
+    new_params['name'] = "Grading Survey Group"
+
+    new_params['no_admin'] = True
+    new_params['no_create_raw'] = True
+    new_params['no_create_with_key_fields'] = True
+
+    patterns = []
+
+    params = dicts.merge(params, new_params)
+
+    super(View, self).__init__(params=params)
+
+
+view = View()
+
+create = decorators.view(view.create)
+delete = decorators.view(view.delete)
+edit = decorators.view(view.edit)
+list = decorators.view(view.list)
+public = decorators.view(view.public)