From 223eca02590d4639258c7a4663f8cba61ddf93ee Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Felipe=20Marti=CC=81n?= Date: Mon, 8 Sep 2014 18:49:32 +0200 Subject: [PATCH] Timeline WIP --- bower.json | 2 +- shelfzilla/apps/users/views.py | 15 +++++++++------ .../themes/bootflat/templates/_layout.html | 4 ++-- .../templates/users/profile/summary.html | 18 ++++++++++++++++++ 4 files changed, 30 insertions(+), 9 deletions(-) diff --git a/bower.json b/bower.json index ef32f93..4684cb6 100644 --- a/bower.json +++ b/bower.json @@ -14,7 +14,7 @@ "tests" ], "dependencies": { - "Bootflat": "~2.0.1", + "bootflatv2": "~2.0.4", "jquery": "~2.1.0", "vegas": "~1.3.4", "jquery-pjax": "~1.8.1", diff --git a/shelfzilla/apps/users/views.py b/shelfzilla/apps/users/views.py index 1edcf35..6f02b12 100644 --- a/shelfzilla/apps/users/views.py +++ b/shelfzilla/apps/users/views.py @@ -9,6 +9,7 @@ from django.contrib.auth import login from .forms import LoginForm from .models import User +from shelfzilla.apps.manga.models import UserReadVolume class LoginView(View): @@ -67,27 +68,29 @@ class UserProfileView(View): template_section = 'users/profile/{}.html' def get(self, request, username, section='summary'): + user = get_object_or_404(User, username=username) data = { - 'item': get_object_or_404(User, username=username), + 'item': user, 'section': section } if section != 'summary': template = self.template_section.format(section) else: template = self.tempalte - data = self.get_context_from_section(request, section, data) + data = self.get_context_from_section(request, section, data, user) ctx = RequestContext(request, data) return render_to_response(template, context_instance=ctx) - def get_summary(self, request, context): - context['SUMMARY'] = 'Y' + def get_summary(self, request, context, user): + context['timeline'] = UserReadVolume.objects.filter(user=user).\ + order_by('-date') return context - def get_context_from_section(self, request, section, context): + def get_context_from_section(self, request, section, context, user): method = getattr(self, 'get_{}'.format(section), None) if method: - context = method(request, context) + context = method(request, context, user) return context diff --git a/shelfzilla/themes/bootflat/templates/_layout.html b/shelfzilla/themes/bootflat/templates/_layout.html index a0bf65f..29485a1 100644 --- a/shelfzilla/themes/bootflat/templates/_layout.html +++ b/shelfzilla/themes/bootflat/templates/_layout.html @@ -7,8 +7,8 @@ {% compress css %} {% block stylesheets %} - - + + diff --git a/shelfzilla/themes/bootflat/templates/users/profile/summary.html b/shelfzilla/themes/bootflat/templates/users/profile/summary.html index 0b2b2dd..9f7aa4b 100644 --- a/shelfzilla/themes/bootflat/templates/users/profile/summary.html +++ b/shelfzilla/themes/bootflat/templates/users/profile/summary.html @@ -40,4 +40,22 @@

Interesting. No, wait, the other thing: tedious. What are you hacking off? Is it my torso?! 'It is!' My precious torso! Yes, if you make it look like an electrical fire. When you do things right, people won't be sure you've done anything at all. Take me to your leader! Ven ve voke up, ve had zese wodies.

+ +
+
+ {% for event in timeline %} +
{{ event.date }}
+
+
+
Apr 14
+
+
+

Marked as read

+ {% include "manga/series/includes/volume.html" with volume=event.volume user=user show_publisher=True type='slim' %} +
+
+
+
+ {% endfor %} +
{% endblock %}