Added list of projects to the organization home page.
Only projects that have not failed will be shown here. The list will link to each project public page which will contain the necessary info about the project.
Addresses part of Issue 491.
Patch by: Madhusudan C.S
Reviewed by: Lennard de Rijk
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/app/soc/templates/soc/organization/home.html Tue Apr 07 21:40:23 2009 +0000
@@ -0,0 +1,23 @@
+{% extends "soc/presence/home.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 %}
+
+{% block body %}
+ {{ block.super }}
+ {% for list_number in list.lists %}
+ <p>
+ {% include list.nextList %}
+ </p>
+ {% endfor %}
+{% endblock %}
--- a/app/soc/views/models/organization.py Tue Apr 07 21:12:29 2009 +0000
+++ b/app/soc/views/models/organization.py Tue Apr 07 21:40:23 2009 +0000
@@ -54,6 +54,10 @@
"""View methods for the Organization model.
"""
+ DEF_ACCEPTED_PROJECTS_MSG_FMT = ugettext("These projects have"
+ " been accepted into %s. You can learn more about"
+ " each project by visiting the links below.")
+
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.
@@ -101,6 +105,7 @@
new_params['public_template'] = 'soc/organization/public.html'
new_params['list_row'] = 'soc/organization/list/row.html'
new_params['list_heading'] = 'soc/organization/list/heading.html'
+ new_params['home_template'] = 'soc/organization/home.html'
new_params['application_logic'] = org_app_logic
new_params['group_applicant_url'] = True
@@ -380,6 +385,38 @@
return self._list(request, params, contents, page_name)
+ def _public(self, request, entity, context):
+ """See base.View._public().
+ """
+
+ from soc.views.models import student_project as student_project_view
+
+ ap_params = student_project_view.view.getParams().copy() # accepted projects
+
+ # define the list redirect action to show the notification
+ ap_params['list_action'] = (redirects.getPublicRedirect, ap_params)
+ ap_params['list_description'] = self.DEF_ACCEPTED_PROJECTS_MSG_FMT %(
+ entity.name)
+ ap_params['list_heading'] = 'soc/student_project/list/heading.html'
+ ap_params['list_row'] = 'soc/student_project/list/row.html'
+
+ # only show projects that have not failed
+ filter = {'scope': entity,
+ 'status': ['accepted', 'mid_term_passed', 'passed']}
+
+ ap_list = lists.getListContent(request, ap_params, filter, idx=0,
+ need_content=True)
+
+ contents = []
+
+ if ap_list:
+ contents.append(ap_list)
+
+ # construct the list and put it into the context
+ context['list'] = soc.logic.lists.Lists(contents)
+
+ return super(View, self)._public(request=request, entity=entity, context=context)
+
def _getExtraMenuItems(self, role_description, params=None):
"""Used to create the specific Organization menu entries.
--- a/app/soc/views/models/program.py Tue Apr 07 21:12:29 2009 +0000
+++ b/app/soc/views/models/program.py Tue Apr 07 21:40:23 2009 +0000
@@ -213,7 +213,7 @@
# define the list redirect action to show the notification
del aa_params['list_key_order']
- aa_params['list_action'] = (redirects.getPublicRedirect, aa_params)
+ aa_params['list_action'] = (redirects.getHomeRedirect, aa_params)
aa_params['list_description'] = description
aa_list = lists.getListContent(request, aa_params, filter, idx=0,
--- a/app/soc/views/models/student_project.py Tue Apr 07 21:12:29 2009 +0000
+++ b/app/soc/views/models/student_project.py Tue Apr 07 21:40:23 2009 +0000
@@ -127,7 +127,6 @@
new_params['edit_template'] = 'soc/student_project/edit.html'
- # TODO(ljvderijk) list all projects for one org on their homepage
# TODO(ljvderijk) list all projects for one student
# TODO(ljvderijk) add manage item to org menu for admins