From: Radek Czajka Date: Fri, 16 Dec 2011 11:06:48 +0000 (+0100) Subject: starting with the new look X-Git-Url: https://git.mdrn.pl/wolnelektury.git/commitdiff_plain/9e41863c3cff14cbbc65b783ee57120fb59fa22c?ds=inline starting with the new look --- diff --git a/apps/catalogue/models.py b/apps/catalogue/models.py index 12b394d00..a5b0ebf0c 100644 --- a/apps/catalogue/models.py +++ b/apps/catalogue/models.py @@ -503,6 +503,23 @@ class Book(models.Model): cache.set(cache_key, short_html, CACHE_FOREVER) return mark_safe(short_html) + def mini_box(self): + if self.id: + cache_key = "Book.mini_boxs/%d" % (self.id, ) + short_html = cache.get(cache_key) + else: + short_html = None + + if short_html is None: + authors = self.tags.filter(category='author') + + short_html = unicode(render_to_string('catalogue/book_mini_box.html', + {'book': self, 'authors': authors, 'STATIC_URL': settings.STATIC_URL})) + + if self.id: + cache.set(cache_key, short_html, CACHE_FOREVER) + return mark_safe(short_html) + @property def root_ancestor(self): """ returns the oldest ancestor """ diff --git a/apps/catalogue/urls.py b/apps/catalogue/urls.py index ada2681ea..452335aca 100644 --- a/apps/catalogue/urls.py +++ b/apps/catalogue/urls.py @@ -8,7 +8,7 @@ from catalogue.models import Book urlpatterns = patterns('catalogue.views', - url(r'^$', 'main_page', name='main_page'), + url(r'^$', 'catalogue', name='catalogue'), url(r'^polki/(?P[a-zA-Z0-9-]+)/formaty/$', 'shelf_book_formats', name='shelf_book_formats'), url(r'^polki/(?P[a-zA-Z0-9-]+)/(?P%s)/usun$' % Book.URLID_RE, 'remove_from_shelf', name='remove_from_shelf'), url(r'^polki/$', 'user_shelves', name='user_shelves'), diff --git a/apps/catalogue/views.py b/apps/catalogue/views.py index 235a17dd5..3a0e04ad7 100644 --- a/apps/catalogue/views.py +++ b/apps/catalogue/views.py @@ -55,11 +55,7 @@ class JSONResponse(HttpResponse): super(JSONResponse, self).__init__(data, mimetype="application/json", **kwargs) -def main_page(request): - if request.user.is_authenticated(): - shelves = models.Tag.objects.filter(category='set', user=request.user) - new_set_form = forms.NewSetForm() - +def catalogue(request): tags = models.Tag.objects.exclude(category__in=('set', 'book')) for tag in tags: tag.count = tag.get_count() @@ -67,7 +63,7 @@ def main_page(request): fragment_tags = categories.get('theme', []) form = forms.SearchForm() - return render_to_response('catalogue/main_page.html', locals(), + return render_to_response('catalogue/catalogue.html', locals(), context_instance=RequestContext(request)) diff --git a/wolnelektury/settings.py b/wolnelektury/settings.py index 5b5d4fe0b..ed63a1dbb 100644 --- a/wolnelektury/settings.py +++ b/wolnelektury/settings.py @@ -160,7 +160,13 @@ CACHE_MIDDLEWARE_ANONYMOUS_ONLY=True # CSS and JavaScript file groups COMPRESS_CSS = { 'all': { - 'source_filenames': ('css/master.css', 'css/jquery.autocomplete.css', 'css/jquery.countdown.css', 'css/master.plain.css', 'css/sponsors.css', 'css/facelist_2-0.css',), + #'source_filenames': ('css/master.css', 'css/jquery.autocomplete.css', 'css/jquery.countdown.css', 'css/master.plain.css', 'css/sponsors.css', 'css/facelist_2-0.css',), + 'source_filenames': [ + 'css/base.css', + 'css/header.css', + 'css/main_page.css', + 'css/book_box.css', + ], 'output_filename': 'css/all.min?.css', }, 'book': { @@ -175,26 +181,30 @@ COMPRESS_CSS = { COMPRESS_JS = { 'jquery': { - 'source_filenames': ('js/jquery.js',), + #'source_filenames': ('js/jquery.js',), + 'source_filenames': [], 'output_filename': 'js/jquery.min.js', }, 'all': { - 'source_filenames': ('js/jquery.autocomplete.js', 'js/jquery.form.js', - 'js/jquery.countdown.js', 'js/jquery.countdown-pl.js', - 'js/jquery.countdown-de.js', 'js/jquery.countdown-uk.js', - 'js/jquery.countdown-es.js', 'js/jquery.countdown-lt.js', - 'js/jquery.countdown-ru.js', 'js/jquery.countdown-fr.js', - 'js/jquery.cycle.min.js', - 'js/jquery.jqmodal.js', 'js/jquery.labelify.js', 'js/catalogue.js', - ), + #~ 'source_filenames': ('js/jquery.autocomplete.js', 'js/jquery.form.js', + #~ 'js/jquery.countdown.js', 'js/jquery.countdown-pl.js', + #~ 'js/jquery.countdown-de.js', 'js/jquery.countdown-uk.js', + #~ 'js/jquery.countdown-es.js', 'js/jquery.countdown-lt.js', + #~ 'js/jquery.countdown-ru.js', 'js/jquery.countdown-fr.js', + #~ 'js/jquery.cycle.min.js', + #~ 'js/jquery.jqmodal.js', 'js/jquery.labelify.js', 'js/catalogue.js', + #~ ), + 'source_filenames': [], 'output_filename': 'js/all?.min.js', }, 'book': { - 'source_filenames': ('js/jquery.eventdelegation.js', 'js/jquery.scrollto.js', 'js/jquery.highlightfade.js', 'js/book.js',), + #~ 'source_filenames': ('js/jquery.eventdelegation.js', 'js/jquery.scrollto.js', 'js/jquery.highlightfade.js', 'js/book.js',), + 'source_filenames': [], 'output_filename': 'js/book?.min.js', }, 'book_ie': { - 'source_filenames': ('js/ierange-m2.js',), + #~ 'source_filenames': ('js/ierange-m2.js',), + 'source_filenames': [], 'output_filename': 'js/book_ie?.min.js', } diff --git a/wolnelektury/static/css/base.css b/wolnelektury/static/css/base.css new file mode 100755 index 000000000..067d9fd0d --- /dev/null +++ b/wolnelektury/static/css/base.css @@ -0,0 +1,55 @@ +html { + margin: 0; + padding: 0; +} + +body { + margin: 0; + background: #f7f7f7; + font-size: .9em; + line-height: 1.4em; +} + + +a { + color: #02adb7; + text-decoration: none; +} + +h2 { + margin: 0; + font-size: 1em; + font-weight: normal; +} + + +.grid-line { + height: 2.6em; + padding-top: 1.4em; + padding-bottom: 0; +} + +.mono, .mono-small { + font-family: "Lucida Sans Typewriter", courier; + font-size: .9em; +} + + +.clearboth { + clear: both; +} + +#header-content, div#main-content, div#half-header-content { + width: 75em; + margin: auto; +} + + + + +#footer { + font-size: .75em; + color: #777; + border-top: 1px solid #ddd; + margin-top: 2.5em; +} diff --git a/wolnelektury/static/css/book_box.css b/wolnelektury/static/css/book_box.css new file mode 100755 index 000000000..a959d849c --- /dev/null +++ b/wolnelektury/static/css/book_box.css @@ -0,0 +1,30 @@ +.book-mini-box { + display: inline-block; + margin: 0; + width: 12.5em; + vertical-align: top; +} + +.book-mini-box a { + display: block; + color: black; + border: 1px solid #ddd; + height: 20em; + padding: .75em; + margin: .1em; + background: #fff; + -moz-box-shadow: 2px 2px 2px #ddd; + -webkit-box-shadow: 2px 2px 2px #ddd; + box-shadow: 2px 2px 2px #ddd; + overflow: hidden; +} + +.book-mini-box img { + width: 10.8em; + height: 14.4em; + margin-bottom: .3em; +} + +.book-mini-box .author { + color: #777; +} \ No newline at end of file diff --git a/wolnelektury/static/css/header.css b/wolnelektury/static/css/header.css new file mode 100755 index 000000000..abea73cc7 --- /dev/null +++ b/wolnelektury/static/css/header.css @@ -0,0 +1,175 @@ +/* Logo font */ +@font-face { + /* IE version */ + font-family: WL-Logo; + src: url(/static/fonts/WL.eot); +} +@font-face { + font-family: WL-Logo; + src: url(/static/fonts/WL.ttf) format("truetype"); +} + + +#header { + color: #969696; + background: #191919; +} + +#half-header { + background: url('/static/img/bg-header.png'); + background-position: center; + background-size: 100%; +} + +#half-header-content { + background: #191919; +} + + +#user-info { + float: right; + margin: 0; +} + +#logo { + position: absolute; + top: 4em; +} + +#logo a { + font-family: WL-Logo; + font-size: 1.9em; + color:#f7f7f7; +} + +#logo img { + max-width: 15em; +} + +#tagline { + display: inline-block; + margin-left: 16em; +} + +#search { + margin: 0; + background: #444; + margin-left: 16em; + width: 59em; +} + +#search-field { + display: inline-block; + width: 50em; + padding-left: .5; + padding-right: .5; + padding: .1em .5em 0 .5em; +} + +#search-field input { + height: 2.8em; + border: none; + width: 49.5em; + font-size: 1em; + padding-left: .5em; + -webkit-border-radius: .5em; + -moz-border-radius: .5em; + border-radius: .5em; + -webkit-box-shadow:0 0 .5em #444 inset; + -moz-box-shadow:0 0 .5em #444 inset; + box-shadow: 0 0 .5em #444 inset; +} + +#search-button { + display: inline-block; + background: #02adb7; + padding: 0; + margin: 0; + width: 8em; +} +#search-button button { + font-size: 1em; + /* should match grid-line */ + height: 4em; + border: none; + background: #02adb7; + color: white; + width: 100%; + padding: 0; +} + +#search-button button span { + position:relative; + top: -.2em; +} + + +#nav-line { + background-color: #e2e2e2; + height: 3.95em; +} + +ul#catalogue { + list-style: none; + padding: 0; + margin: 0; +} +ul#catalogue li { + background-color: #e2e2e2; + float: left; +} +ul#catalogue a { + display: block; + padding-left: 1.5em; + padding-right: 1.5em; + /* must match grid-line */ + height: 2.7em; + padding-top: 1.3em; +} + + + +#lang-button:after { + content: url(/static/img/lang-arrow.png); + padding-left: .5em; +} +#lang-menu { + position: relative; + float: right; + display: block; + padding-left: 1.5em; + padding-right: 1.5em; + /* must match grid-line */ + height: 2.7em; + padding-top: 1.3em; + background: #f7f7f7; +} + +#lang-menu-items button { + display: none; + background: #f7f7f7; + color: #444; + cursor: pointer; + width: 100%; + border: solid #ddd; + border-width: 0 0 1px 0; + padding: .5em 0; + margin: 0; +} + +#lang-menu:hover button { + display: block; +} + +#lang-menu:hover #lang-menu-items { + position: absolute; + width: 100%; + padding: 0; + left: 0; + /* must match grid-line height */ + top: 3.9em; +} + +#lang-menu .active { + font-weight: bold; +} diff --git a/wolnelektury/static/css/main_page.css b/wolnelektury/static/css/main_page.css new file mode 100755 index 000000000..28a11480b --- /dev/null +++ b/wolnelektury/static/css/main_page.css @@ -0,0 +1,80 @@ +#big-cite { + background-color: white; + padding: 8em; + margin: 0; +} + +#big-cite a { + color: black; + display: block; +} + +#big-cite h2 { + margin: 0; +} + + +#big-cite-text { + margin: .5em 0; + font-size: 1.75em; + line-height: 1.3em; +} + + +#big-cite-source { + color: #02adb7; + margin: 0; +} + + +#promo-box { + float: right; + width: 24em; + /* should match grid-line */ + margin-top: -4em; +} +#promo-box-header { + padding-left: 2em; + padding-right: 2em; + background: #191919; + color: white; +} +#promo-box-body { + border-bottom: 2px solid #efefef; + padding: 1.3em 2em; + height: 23em; + background: #efefef; +} +#promo-box-title { + color: #02ADB7; + height: 2.7em; + margin: 0; +} +#promo-box-body p { + margin-top: 0; +} + +.infopages-box { + width: 16.75em; + display: inline-block; + margin: .5em 0 0 0; + padding: 0 1em; + vertical-align: top; +} +.infopages-box h2 { + color: #02ADB7; +} +.infopages-box a { + color: black; +} + +.infopages-box ol, .infopages-box ul { + font-size: .8em; + list-style: none; + padding: 0; + margin: 0; +} + +.social-links { + margin-top: 1em; +} \ No newline at end of file diff --git a/wolnelektury/static/fonts/WL.eot b/wolnelektury/static/fonts/WL.eot new file mode 100644 index 000000000..53fedbda0 Binary files /dev/null and b/wolnelektury/static/fonts/WL.eot differ diff --git a/wolnelektury/static/fonts/WL.ttf b/wolnelektury/static/fonts/WL.ttf new file mode 100644 index 000000000..7feb6b403 Binary files /dev/null and b/wolnelektury/static/fonts/WL.ttf differ diff --git a/wolnelektury/static/img/bg-header.png b/wolnelektury/static/img/bg-header.png new file mode 100644 index 000000000..f7e572edc Binary files /dev/null and b/wolnelektury/static/img/bg-header.png differ diff --git a/wolnelektury/static/img/lang-arrow.png b/wolnelektury/static/img/lang-arrow.png new file mode 100644 index 000000000..c79e3f1b2 Binary files /dev/null and b/wolnelektury/static/img/lang-arrow.png differ diff --git a/wolnelektury/templates/base.html b/wolnelektury/templates/base.html index 061197f9b..3a15613fd 100644 --- a/wolnelektury/templates/base.html +++ b/wolnelektury/templates/base.html @@ -1,7 +1,7 @@ - {% load i18n chunks compressed catalogue_tags sponsor_tags %} + {% load i18n compressed catalogue_tags sponsor_tags %} @@ -18,64 +18,106 @@ {% endblock %} - + {% block bodycontent %} -
- {% chunk "top-message" %} -
-