From: Radek Czajka Date: Tue, 19 Nov 2013 13:12:55 +0000 (+0100) Subject: Merge branch 'minimal-double-reader' into rwd X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/68dbe44bdbc497a82064c6a47eeaecbb34463f64?ds=sidebyside;hp=-c Merge branch 'minimal-double-reader' into rwd --- 68dbe44bdbc497a82064c6a47eeaecbb34463f64 diff --combined apps/catalogue/models/book.py index c865d1d87,9025e3e5b..3cab67632 --- a/apps/catalogue/models/book.py +++ b/apps/catalogue/models/book.py @@@ -3,7 -3,7 +3,7 @@@ # Copyright © Fundacja Nowoczesna Polska. See NOTICE for more information. # import re -from django.conf import settings as settings +from django.conf import settings from django.core.cache import get_cache from django.db import models from django.db.models import permalink @@@ -14,7 -14,7 +14,7 @@@ import jsonfiel from catalogue import constants from catalogue.fields import EbookField from catalogue.models import Tag, Fragment, BookMedia -from catalogue.utils import create_zip, split_tags, book_upload_path +from catalogue.utils import create_zip, split_tags, book_upload_path, related_tag_name from catalogue import app_settings from catalogue import tasks from newtagging import managers @@@ -36,7 -36,7 +36,7 @@@ class Book(models.Model) created_at = models.DateTimeField(_('creation date'), auto_now_add=True, db_index=True) changed_at = models.DateTimeField(_('creation date'), auto_now=True, db_index=True) parent_number = models.IntegerField(_('parent number'), default=0) - extra_info = jsonfield.JSONField(_('extra information'), default='{}') + extra_info = jsonfield.JSONField(_('extra information'), default={}) gazeta_link = models.CharField(blank=True, max_length=240) wiki_link = models.CharField(blank=True, max_length=240) # files generated during publication @@@ -391,6 -391,10 +391,10 @@@ for child in self.children.all(): child.parent_cover_changed() + def other_versions(self): + """Find other versions (i.e. in other languages) of the book.""" + return type(self).objects.filter(common_slug=self.common_slug).exclude(pk=self.pk) + def related_info(self): """Keeps info about related objects (tags, media) in cache field.""" if self._related_info is not None: @@@ -402,15 -406,8 +406,15 @@@ 'author', 'kind', 'genre', 'epoch')) tags = split_tags(tags) for category in tags: - rel['tags'][category] = [ - (t.name, t.slug) for t in tags[category]] + cat = [] + for tag in tags[category]: + tag_info = {'slug': tag.slug} + for lc, ln in settings.LANGUAGES: + tag_name = getattr(tag, "name_%s" % lc) + if tag_name: + tag_info["name_%s" % lc] = tag_name + cat.append(tag_info) + rel['tags'][category] = cat for media_format in BookMedia.formats: rel['media'][media_format] = self.has_media(media_format) @@@ -494,8 -491,8 +498,8 @@@ def pretty_title(self, html_links=False): book = self rel_info = book.related_info() - names = [(name, Tag.create_url('author', slug)) - for name, slug in rel_info['tags']['author']] + names = [(related_tag_name(tag), Tag.create_url('author', tag['slug'])) + for tag in rel_info['tags'].get('author', ())] if 'parents' in rel_info: books = [(name, Book.create_url(slug)) for name, slug in rel_info['parents']] diff --combined wolnelektury/settings/static.py index 3d6ee4337,c38db38d1..798f5af80 --- a/wolnelektury/settings/static.py +++ b/wolnelektury/settings/static.py @@@ -14,25 -14,36 +14,25 @@@ MEDIA_URL = '/media/ STATIC_URL = '/static/' # CSS and JavaScript file groups + + PIPELINE_CSS = { - 'all': { + 'main': { # styles both for mobile and for big screen 'source_filenames': [ 'css/jquery.countdown.css', - 'css/base.css', - 'css/cite.css', - 'css/header.css', - 'css/main_page.css', - 'css/dialogs.css', - 'css/picture_box.css', - 'css/book_box.css', - 'css/catalogue.css', 'sponsors/css/sponsors.css', - 'css/auth.css', - 'funding/funding.scss', - 'polls/polls.scss', - 'css/form.scss', - 'css/social/shelf_tags.css', + + 'uni_form/uni-form.css', + 'uni_form/default.uni-form.css', + 'css/ui-lightness/jquery-ui-1.8.16.custom.css', + + 'scss/main.scss', ], - 'output_filename': 'css/compressed/all.css', - }, - 'ie': { - 'source_filenames': [ - 'css/ie.css', - ], - 'output_filename': 'css/compressed/ie.css', + 'output_filename': 'css/compressed/main.css', }, 'book': { 'source_filenames': [ @@@ -40,13 -51,6 +40,13 @@@ ], 'output_filename': 'css/compressed/book.css', }, + 'book_text': { + 'source_filenames': [ + 'scss/book_text.scss', + 'css/new.book.css', + ], + 'output_filename': 'css/compressed/book_text.css', + }, 'player': { 'source_filenames': [ 'jplayer/jplayer.blue.monday.css', @@@ -81,8 -85,6 +81,8 @@@ PIPELINE_JS = 'player/openplayer.js', 'js/search.js', 'funding/funding.js', + + 'uni_form/uni-form.js', ), 'output_filename': 'js/base.min.js', }, @@@ -99,17 -101,12 +99,18 @@@ 'js/jquery.eventdelegation.js', 'js/jquery.scrollto.js', 'js/jquery.highlightfade.js', + 'js/book_text/other.js', 'js/book.js', 'player/openplayer.js', ], 'output_filename': 'js/book.min.js', }, + 'book_text': { + 'source_filenames': [ + 'js/book_text/*.js', + ], + 'output_filename': 'js/book_text.js', + }, 'book_ie': { 'source_filenames': ('js/ierange-m2.js',), 'output_filename': 'js/book_ie.min.js', @@@ -122,12 -119,7 +123,12 @@@ PIPELINE_CSS_COMPRESSOR = Non PIPELINE_JS_COMPRESSOR = None PIPELINE_COMPILERS = ( - 'pyscss_compiler.PySCSSCompiler', + 'pipeline.compilers.sass.SASSCompiler', + # We could probably use PySCSS instead, + # but they have some serious problems, like: + # https://github.com/Kronuz/pyScss/issues/166 (empty list syntax) + # https://github.com/Kronuz/pyScss/issues/258 (bad @media order) + #'pyscss_compiler.PySCSSCompiler', ) -PIPELINE_PYSCSS_BINARY = '/usr/bin/env pyscss' -PIPELINE_PYSCSS_ARGUMENTS = '' +#PIPELINE_PYSCSS_BINARY = '/usr/bin/env pyscss' +#PIPELINE_PYSCSS_ARGUMENTS = ''