[virtualcommons-svn] commit/vcweb: alllee: adding simple mobile view proof of concept
Status: Beta
Brought to you by:
alllee
From: Bitbucket <com...@bi...> - 2011-06-25 01:27:06
|
1 new changeset in vcweb: http://bitbucket.org/virtualcommons/vcweb/changeset/0a84bd347d6c/ changeset: 0a84bd347d6c user: alllee date: 2011-06-25 03:27:00 summary: adding simple mobile view proof of concept affected #: 3 files (567 bytes) --- a/vcweb/core/templates/mobile/base.html Thu Jun 23 18:15:42 2011 -0700 +++ b/vcweb/core/templates/mobile/base.html Fri Jun 24 18:27:00 2011 -0700 @@ -3,7 +3,7 @@ <head> {% block head %} <title>{% block title %}Virtual Commons Web Environment{% endblock %}</title> - <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b.1/jquery.mobile-1.0b.1.min.css" /> + <link rel="stylesheet" href="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.css" /><script type='text/javascript' src='https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js'></script><script type="text/javascript" src="http://code.jquery.com/mobile/1.0b1/jquery.mobile-1.0b1.min.js"></script><link href="{{STATIC_URL}}css/mobile.css" rel="stylesheet" type="text/css" media="screen" /> --- a/vcweb/lighterprints/urls.py Thu Jun 23 18:15:42 2011 -0700 +++ b/vcweb/lighterprints/urls.py Fri Jun 24 18:27:00 2011 -0700 @@ -1,9 +1,9 @@ from django.conf.urls.defaults import url, patterns -from vcweb.lighterprints.views import ActivityDetailView, ActivityListView, DoActivityView +from vcweb.lighterprints.views import (ActivityDetailView, ActivityListView, DoActivityView, MobileView) urlpatterns = patterns('vcweb.lighterprints.views', - url(r'^$', 'index', name='index'), + url(r'^mobile$', MobileView.as_view(), name='mobile'), url(r'^(?P<experiment_id>\d+)/configure$', 'configure', name='configure'), url(r'^activity/list/?$', ActivityListView.as_view()), url(r'^activity/(?P<activity_id>\d+)$', ActivityDetailView.as_view()), --- a/vcweb/lighterprints/views.py Thu Jun 23 18:15:42 2011 -0700 +++ b/vcweb/lighterprints/views.py Fri Jun 24 18:27:00 2011 -0700 @@ -10,7 +10,7 @@ logger = logging.getLogger(__name__) -class ActivityListView(JSONResponseMixin, BaseListView, MultipleObjectTemplateResponseMixin): +class ActivityListView(JSONResponseMixin, MultipleObjectTemplateResponseMixin, BaseListView): # FIXME: replace with dynamic set model = Activity @@ -30,7 +30,6 @@ if self.request.GET.get('format', 'html') == 'json': return JSONResponseMixin.render_to_response(self, context, context_key='activity_by_level') else: - logger.debug("returning MOTRM render_to_response with context %s", context['activity_by_level']) return MultipleObjectTemplateResponseMixin.render_to_response(self, context) class ActivityDetailView(JSONResponseMixin, BaseDetailView): @@ -38,3 +37,18 @@ class DoActivityView(FormView): pass + +class MobileView(ActivityListView): + + def get_context_data(self, **kwargs): + context = super(ActivityListView, self).get_context_data(**kwargs) + activity_by_level = collections.defaultdict(list) + jquery_grid_list = list("abcde") + for index, activity in enumerate(Activity.objects.all()): + activity_by_level[activity.level].append((activity, jquery_grid_list[index])) + context['activity_by_level'] = dict(activity_by_level) + logger.debug("activity by level %s", activity_by_level) + return context + + def get_template_names(self): + return ['lighterprints/mobile.html'] Repository URL: https://bitbucket.org/virtualcommons/vcweb/ -- This is a commit notification from bitbucket.org. You are receiving this because you have the service enabled, addressing the recipient of this email. |