fmartingr
/
shelfzilla
Archived
1
0
Fork 0

Timeline WIP

This commit is contained in:
Felipe Martín 2014-09-08 18:49:32 +02:00
parent a3f30a9e1f
commit 223eca0259
4 changed files with 30 additions and 9 deletions

View File

@ -14,7 +14,7 @@
"tests" "tests"
], ],
"dependencies": { "dependencies": {
"Bootflat": "~2.0.1", "bootflatv2": "~2.0.4",
"jquery": "~2.1.0", "jquery": "~2.1.0",
"vegas": "~1.3.4", "vegas": "~1.3.4",
"jquery-pjax": "~1.8.1", "jquery-pjax": "~1.8.1",

View File

@ -9,6 +9,7 @@ from django.contrib.auth import login
from .forms import LoginForm from .forms import LoginForm
from .models import User from .models import User
from shelfzilla.apps.manga.models import UserReadVolume
class LoginView(View): class LoginView(View):
@ -67,27 +68,29 @@ class UserProfileView(View):
template_section = 'users/profile/{}.html' template_section = 'users/profile/{}.html'
def get(self, request, username, section='summary'): def get(self, request, username, section='summary'):
user = get_object_or_404(User, username=username)
data = { data = {
'item': get_object_or_404(User, username=username), 'item': user,
'section': section 'section': section
} }
if section != 'summary': if section != 'summary':
template = self.template_section.format(section) template = self.template_section.format(section)
else: else:
template = self.tempalte 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) ctx = RequestContext(request, data)
return render_to_response(template, context_instance=ctx) return render_to_response(template, context_instance=ctx)
def get_summary(self, request, context): def get_summary(self, request, context, user):
context['SUMMARY'] = 'Y' context['timeline'] = UserReadVolume.objects.filter(user=user).\
order_by('-date')
return context 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) method = getattr(self, 'get_{}'.format(section), None)
if method: if method:
context = method(request, context) context = method(request, context, user)
return context return context

View File

@ -7,8 +7,8 @@
<meta name="viewport" content="width=device-width, initial-scale=1"> <meta name="viewport" content="width=device-width, initial-scale=1">
{% compress css %} {% compress css %}
{% block stylesheets %} {% block stylesheets %}
<link rel="stylesheet" href="{% static "bower/Bootflat/css/bootstrap.min.css" %}" type="text/css" /> <link rel="stylesheet" href="{% static "bower/bootflatv2/css/bootstrap.min.css" %}" type="text/css" />
<link rel="stylesheet" href="{% static "bower/Bootflat/bootflat/css/bootflat.css" %}" type="text/css" /> <link rel="stylesheet" href="{% static "bower/bootflatv2/bootflat/css/bootflat.css" %}" type="text/css" />
<link rel="stylesheet" href="{% static "bower/nprogress/nprogress.css" %}" type="text/css" /> <link rel="stylesheet" href="{% static "bower/nprogress/nprogress.css" %}" type="text/css" />
<link rel="stylesheet" href="{% static "bower/toastr/toastr.css" %}" type="text/css" /> <link rel="stylesheet" href="{% static "bower/toastr/toastr.css" %}" type="text/css" />
<link rel="stylesheet" href="{% static "less/app.less" %}" type="text/less" /> <link rel="stylesheet" href="{% static "less/app.less" %}" type="text/less" />

View File

@ -40,4 +40,22 @@
<div class="well"> <div class="well">
<p>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.</p> <p>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.</p>
</div> </div>
<div class="timeline">
<dl>
{% for event in timeline %}
<dt>{{ event.date }}</dt>
<dd class="pos-right clearfix">
<div class="circ"></div>
<div class="time">Apr 14</div>
<div class="events">
<div class="events-body">
<h4 class="events-heading">Marked as read</h4>
{% include "manga/series/includes/volume.html" with volume=event.volume user=user show_publisher=True type='slim' %}
</div>
</div>
</dd>
</dl>
{% endfor %}
</div>
{% endblock %} {% endblock %}