Timeline WIP
This commit is contained in:
parent
a3f30a9e1f
commit
223eca0259
|
@ -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",
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -7,8 +7,8 @@
|
|||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
{% compress css %}
|
||||
{% block stylesheets %}
|
||||
<link rel="stylesheet" href="{% static "bower/Bootflat/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/css/bootstrap.min.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/toastr/toastr.css" %}" type="text/css" />
|
||||
<link rel="stylesheet" href="{% static "less/app.less" %}" type="text/less" />
|
||||
|
|
|
@ -40,4 +40,22 @@
|
|||
<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>
|
||||
</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 %}
|
||||
|
|
Reference in New Issue