fmartingr
/
shelfzilla
Archived
1
0
Fork 0

- Changed site background for a static PNG instead of using the vegas plugin

- Added some volume admin tweaks to easy manage them
- Fixed FILER settings
This commit is contained in:
Felipe Martin 2014-04-23 17:16:00 +02:00
parent 08afeeca02
commit dff0e5fa2c
14 changed files with 176 additions and 41 deletions

View File

@ -30,7 +30,11 @@ admin.site.register(Series, SeriesAdmin)
class VolumeAdmin(reversion.VersionAdmin):
pass
list_display_links = ('number', )
list_display = ('series', 'number', )
search_fields = ('number', 'series__name', )
list_filter = ('series', )
list_editable = ('series', )
admin.site.register(Volume, VolumeAdmin)

View File

@ -20,6 +20,13 @@ class Publisher(Model):
def __unicode__(self):
return u'{}'.format(self.name)
def get_series_volumes(self, series):
try:
series = self.series.get(pk=series.pk)
return series.volumes.filter(publisher=self)
except Series.DoesNotExist:
return []
@property
def series(self):
result = []
@ -61,6 +68,14 @@ class Series(Model):
def __unicode__(self):
return u'{}'.format(self.name)
@property
def volumes_by_publisher(self):
return self.volumes.order_by('publisher__name', 'number')
@property
def last_volume_cover(self):
return self.volumes.filter(cover__isnull=False).last().cover
@property
def publishers(self):
if not self._publishers:

View File

@ -52,8 +52,12 @@ class SeriesDetailView(SeriesView):
else:
item = get_object_or_404(Series, pk=sid)
for pub in item.publishers:
pub.series_volumes = pub.get_series_volumes(item)
context = {
'item': item
'item': item,
# 'publisher_volumes': publisher_volumes
}
ctx = RequestContext(request, self.get_context(context))

View File

@ -170,20 +170,29 @@ THUMBNAIL_PROCESSORS = (
COVER_FOLDER_PK = 1
COVER_FOLDER_OWNER_PK = 1
STORAGES = {
FILER_STORAGES = {
'public': {
'main': {
'ENGINE': 'django.core.files.storage.FileSystemStorage',
'OPTIONS': {},
'UPLOAD_TO': 'shelfzilla.utils.generate_randomized',
'UPLOAD_TO_PREFIX': 'public',
'OPTIONS': {
'location': os.path.abspath(
os.path.join(MEDIA_ROOT, 'filer/public/')),
'base_url': '/files/',
},
'UPLOAD_TO': 'shelfzilla.utils.filer_generate_randomized',
'UPLOAD_TO_PREFIX': '',
},
'thumbnails': {
'ENGINE': 'django.core.files.storage.FileSystemStorage',
'OPTIONS': {},
'THUMBNAIL_OPTIONS': {
'base_dir': 'public_thumbnails',
'OPTIONS': {
'location': os.path.abspath(
os.path.join(MEDIA_ROOT, 'filer/public/')),
'base_url': '/files/',
},
'THUMBNAIL_OPTIONS': {
'base_dir': 'thumbnails',
},
'UPLOAD_TO_PREFIX': '',
},
},
'private': {
@ -191,17 +200,17 @@ STORAGES = {
'ENGINE': 'filer.storage.PrivateFileSystemStorage',
'OPTIONS': {
'location': os.path.abspath(
os.path.join(MEDIA_ROOT, '../smedia/private')),
os.path.join(MEDIA_ROOT, 'filer/private')),
'base_url': '/smedia/private/',
},
'UPLOAD_TO': 'shelfzilla.utils.generate_randomized',
'UPLOAD_TO': 'shelfzilla.utils.filer_generate_randomized',
'UPLOAD_TO_PREFIX': '',
},
'thumbnails': {
'ENGINE': 'filer.storage.PrivateFileSystemStorage',
'OPTIONS': {
'location': os.path.abspath(
os.path.join(MEDIA_ROOT, '../smedia/private_thumbnails')),
os.path.join(MEDIA_ROOT, 'filer/private_thumbnails')),
'base_url': '/smedia/private_thumbnails/',
},
'THUMBNAIL_OPTIONS': {},

Binary file not shown.

After

Width:  |  Height:  |  Size: 349 KiB

View File

@ -33,10 +33,10 @@ $ ->
window.imageLoad(document)
# Background
$.vegas
src: '/static/backgrounds/shelves.jpg'
fade: 1200
#complete: -> NProgress.done()
#$.vegas
# src: '/static/backgrounds/shelves.jpg'
# fade: 1200
# #complete: -> NProgress.done()
# PJAX
if $.support.pjax
@ -44,6 +44,13 @@ $ ->
elem = $(@)
pjax = elem.data('pjax')
push = true
nav_element = elem.closest('[data-pjax-nav]')
console.log nav_element
nav_element.siblings('.active').removeClass('active')
nav_element.addClass('active')
if elem.is('[pjax-nopush]')
push = false
if not pjax

View File

@ -1,5 +1,8 @@
body {
background-color: rgb(241, 242, 246) !important;
background-image: url('/static/backgrounds/triangify.png');
background-position: center top;
background-attachment: fixed;
}
/* Login panel */

View File

@ -14,7 +14,7 @@
<div class="container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#navbar-collapse">
<span class="sr-only">Toggle navigation</span>
<span class="sr-only">{% trans "Toggle navigation" %}</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
@ -25,10 +25,10 @@
<!-- Collect the nav links, forms, and other content for toggling -->
<div class="collapse navbar-collapse" id="navbar-collapse">
<ul class="nav navbar-nav">
<li {% if navigation.section == "series" %}class="active"{% endif %}>
<li data-pjax-nav {% if navigation.section == "series" %}class="active"{% endif %}>
<a data-pjax href="{% url "series.list" %}">{% trans "Series" %}</a>
</li>
<li {% if navigation.section == "publishers" %}class="active"{% endif %}>
<li data-pjax-nav {% if navigation.section == "publishers" %}class="active"{% endif %}>
<a data-pjax href="{% url 'publishers.list' %}">{% trans "Publishers" %}</a>
</li>
</ul>

View File

@ -7,3 +7,21 @@
<h1>ShelfZilla</h1>
</div>
{% endblock %}
{% block extra_css %}
<style type="text/css">
body { background-image: none !important; }
</style>
{% endblock %}
{% block extra_js %}
<script type="text/javascript">
$(function() {
$.vegas({
src: '/static/backgrounds/shelves.jpg',
fade: 1200
})
});
</script>
{% endblock %}

View File

@ -50,6 +50,23 @@
<td>{{ series.finished|yesno|capfirst }}</td>
</tr>
{% endfor %}
<tr>
<td colspan="4"><strong>{% trans "Original series" %}</strong></td>
</tr>
{% for series in item.original_series.all %}
<tr>
<td>
{% if series.slug %}
<a href="{% url 'series.detail' series.pk series.slug %}" data-pjax>{{ series.name }}</a>
{% else %}
<a href="{% url 'series.detail' series.pk %}" data-pjax>{{ series.name }}</a>
{% endif %}
</td>
<td>{{ series.volumes.count }}</td>
<td>{{ series.finished|yesno|capfirst }}</td>
</tr>
{% endfor %}
</tbody>
</table>
</div>

View File

@ -13,38 +13,81 @@
<h1 class="panel-title panel-title-alt text-center">{{ item.name }}</h1>
</div>
-->
{% if item.cover %}
{% if item.last_volume_cover %}
<div class="panel-body text-center">
<img src="{{ item.cover.url }}" class="max-width-80" />
<img src="{{ item.last_volume_cover.url }}" class="max-width-80" />
</div>
{% endif %}
<ul class="list-group">
<li class="list-group-item">
<strong>{% trans "Volumes" %}</strong>: {{ item.volumes.count }}
</li>
<li class="list-group-item">
<strong>{% trans "Finished" %}</strong>: {{ item.finished|yesno|capfirst }}
<strong>{% trans "Status" %}</strong>
{% if item.finished %}
<span class="badge badge-success">{% trans "Finished" %}
{% else %}
<span class="badge badge-warning">{% trans "Open" %}
{% endif %}
</li>
</ul>
</div>
{% if item.publishers %}
{% if item.art.count %}
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title text-center">{% trans "Publishers" %}</h2>
<h2 class="panel-title text-center">{% trans "Art" %}</h2>
</div>
<ul class="list-group">
{% for publisher in item.publishers %}
{% for person in item.art.all %}
<li class="list-group-item">
{% if publisher.slug %}
<a href="{% url 'publishers.detail' publisher.pk publisher.slug %}" data-pjax>{{ publisher.name }}</a>
{% else %}
<a href="{% url 'publishers.detail' publisher.pk %}" data-pajax>{{ publisher.name }}</a>
{% endif %}
{{ person.name }}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
{% if item.story.count %}
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title text-center">{% trans "Story" %}</h2>
</div>
<ul class="list-group">
{% for person in item.story.all %}
<li class="list-group-item">
{{ person.name }}
</li>
{% endfor %}
</ul>
</div>
{% endif %}
<div class="panel panel-default">
<div class="panel-heading">
<h2 class="panel-title text-center">{% trans "Publishers" %}</h2>
</div>
<ul class="list-group">
{% if item.original_publisher %}
<li class="list-group-item">
{% trans "Original publisher" %}:
{% if publisher.slug %}
<a href="{% url 'publishers.detail' item.original_publisher.pk item.original_publisher.slug %}" data-pjax>{{ item.original_publisher.name }}</a>
{% else %}
<a href="{% url 'publishers.detail' item.original_publisher.pk %}" data-pajax>{{ item.original_publisher.name }}</a>
{% endif %}
</li>
{% endif %}
{% if item.publishers %}
{% for publisher in item.publishers %}
<li class="list-group-item">
<span class="badge badge-default">{{ publisher.series_volumes.count }}</span>
{% if publisher.slug %}
<a href="{% url 'publishers.detail' publisher.pk publisher.slug %}" data-pjax>{{ publisher.name }}</a>
{% else %}
<a href="{% url 'publishers.detail' publisher.pk %}" data-pajax>{{ publisher.name }}</a>
{% endif %}
</li>
{% endfor %}
{% endif %}
</ul>
</div>
</div>
<div class="col-md-9">
<div class="panel panel-primary">
@ -58,7 +101,7 @@
</div>
{% endif %}
<div class="row">
{% for volume in item.volumes.all %}
{% for volume in item.volumes_by_publisher.all %}
<div class="col-sm-2" data-pjax-container="v{{ volume.pk }}">
{% include "manga/series/includes/volume.html" with volume=volume user=user %}
</div>

View File

@ -23,13 +23,13 @@
<img src="{{ item.avatar }}" class="max-width-100" />
</div>
<div class="list-group">
<a href="{% url 'profile' %}" data-pjax class="list-group-item active">
<a data-pjax-nav href="{% url 'profile' %}" data-pjax class="list-group-item active">
{% trans "Summary" %}</a>
<a href="{% url 'profile' 'collection' %}" data-pjax="profile" class="list-group-item">
<a data-pjax-nav href="{% url 'profile' 'collection' %}" data-pjax="profile" class="list-group-item">
{% trans "Collection" %}</a>
<a href="{% url 'profile' 'wishlist' %}" data-pjax="profile" class="list-group-item">
<a data-pjax-nav href="{% url 'profile' 'wishlist' %}" data-pjax="profile" class="list-group-item">
{% trans "Wishlist" %}</a>
<a href="{% url 'profile' 'achievements' %}" data-pjax="profile" class="list-group-item">
<a data-pjax-nav href="{% url 'profile' 'achievements' %}" data-pjax="profile" class="list-group-item">
{% trans "Achievements" %}</a>
</div>
</div>

View File

@ -27,6 +27,22 @@ if settings.DEBUG:
'django.views.static.serve',
{'document_root': settings.MEDIA_ROOT}
),
(
r'^files/(?P<path>.*)$',
'django.views.static.serve',
{
'document_root': settings.FILER_STORAGES['public']['main']['OPTIONS']['location']
}
),
(
r'^files/thumbnails/(?P<path>.*)$',
'django.views.static.serve',
{
'document_root': settings.FILER_STORAGES['public']['thumbnails']['OPTIONS']['location']
}
),
)
if 'rosetta' in settings.INSTALLED_APPS:

View File

@ -3,11 +3,10 @@ import os
def filer_generate_randomized(instance, filename):
import uuid
print(instance)
uuid_str = str(uuid.uuid4())
uuid_str = u'{}'.format(uuid.uuid4())
random_path = u"%s/%s/%s" % (uuid_str[0:2], uuid_str[2:4], uuid_str)
name, extension = os.path.splitext(filename)
filename = u'{}{}'.format(
str(uuid.uuid4()), extension
uuid.uuid4(), extension
)
return os.path.join(random_path, filename)