some opengraph info
authorRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Fri, 9 Mar 2012 12:47:52 +0000 (13:47 +0100)
committerRadek Czajka <radoslaw.czajka@nowoczesnapolska.org.pl>
Fri, 9 Mar 2012 12:47:52 +0000 (13:47 +0100)
apps/catalogue/templatetags/catalogue_tags.py
wolnelektury/context_processors.py
wolnelektury/settings.py
wolnelektury/templates/base.html
wolnelektury/templates/catalogue/book_detail.html
wolnelektury/templates/main_page.html
wolnelektury/templates/superbase.html [new file with mode: 0644]

index 14ed64d..e9b1610 100644 (file)
@@ -45,6 +45,10 @@ def capfirst(text):
     except IndexError:
         return ''
 
     except IndexError:
         return ''
 
+@register.filter
+def build_absolute_uri(uri, request):
+    return request.build_absolute_uri(uri)
+
 
 @register.simple_tag
 def html_title_from_tags(tags):
 
 @register.simple_tag
 def html_title_from_tags(tags):
index 0cbf605..fa8515e 100644 (file)
@@ -1,6 +1,6 @@
+from django.conf import settings
 
 def extra_settings(request):
 
 def extra_settings(request):
-    from django.conf import settings
     return {
         'STATIC_URL': settings.STATIC_URL,
     }
     return {
         'STATIC_URL': settings.STATIC_URL,
     }
index 8ee4e43..07b1ef0 100644 (file)
@@ -286,17 +286,6 @@ COMPRESS_VERSION = True
 COMPRESS_CSS_FILTERS = None
 
 THUMBNAIL_QUALITY = 95
 COMPRESS_CSS_FILTERS = None
 
 THUMBNAIL_QUALITY = 95
-THUMBNAIL_EXTENSION = 'png'
-
-THUMBNAIL_PROCESSORS = (
-    # Default processors
-    'sorl.thumbnail.processors.colorspace',
-    'sorl.thumbnail.processors.autocrop',
-    'sorl.thumbnail.processors.scale_and_crop',
-    'sorl.thumbnail.processors.filters',
-    # Custom processors
-    'sponsors.processors.add_padding',
-)
 
 TRANSLATION_REGISTRY = "wolnelektury.translation"
 
 
 TRANSLATION_REGISTRY = "wolnelektury.translation"
 
index e3faca1..fac9319 100644 (file)
@@ -1,193 +1,4 @@
-<!DOCTYPE html>
-<html class="no-js">
-       {% load cache compressed i18n %}
-    {% load catalogue_tags reporting_stats sponsor_tags %}
-    <head>
-        <meta http-equiv="Content-type" content="text/html; charset=utf-8" />
-        <meta name="description" 
-            content="{% block metadescription %}Darmowe opracowane, pełne teksty lektur, e-booki, audiobooki i pliki DAISY na wolnej licencji.{% endblock %}" />
-        <title>{% block title %}{% trans "Wolne Lektury" %} :: 
-            {% block titleextra %}{% endblock %}{% endblock %}</title>
-        <link rel="icon" href="{{ STATIC_URL }}img/favicon.png" type="image/png" />
-        <link rel="search" type="application/opensearchdescription+xml" title="Wolne Lektury" href="{{ STATIC_URL }}opensearch.xml" />
-        {% compressed_css "all" %}
-        {% compressed_css "screen" %}
-        <!--[if IE]>
-               {% compressed_css "ie" %}
-        <![endif]-->
-        <!--script src="{{ STATIC_URL }}js/modernizr.custom.13352.js"></script-->
-        <script src="{{ STATIC_URL }}js/modernizr-latest.js"></script>
+{% extends "superbase.html" %}
 
 
-        {% block extrahead %}
-        {% endblock %}
-    </head>
-    <body id="{% block bodyid %}base{% endblock %}">
 
 
-        {% block bodycontent %}
-
-               <div id="header-bg"></div>
-
-        <div id="header">
-
-        <div id="header-content">
-            <div id="logo">
-                <a class="logo" href="/">
-                Wolne Lektury</a>
-            </div>
-
-            <div id="tagline">
-                <span>
-                {% cache 60 tagline LANGUAGE_CODE %}
-                    {% url book_list as b %}
-                    {% url infopage 'o-projekcie' as r %}
-                        {% count_books book_count %}
-                    {% blocktrans count book_count as c %}
-                    <a href='{{b}}'>{{c}}</a> free reading you have <a href='{{r}}'>right to</a>
-                    {% plural %}
-                    <a href='{{b}}'>{{c}}</a> free readings you have <a href='{{r}}'>right to</a>
-                    {% endblocktrans %}
-                {% endcache %}
-                </span>
-            </div>
-
-            <p id="user-info" class="mono">
-                {% if user.is_authenticated %}
-                    {% trans "Welcome" %}, <strong>{{ user.username }}</strong>
-                    | <a href="{% url social_my_shelf %}" id="user-shelves-link">{% trans "My shelf" %}</a>
-                    {% if user.is_staff %}
-                    | <a href="/admin/">{% trans "Administration" %}</a>
-                    {% endif %}
-                    | <a href="{% url logout %}?next={% block logout %}{{ request.get_full_path }}{% endblock %}">{% trans "Logout" %}</a>
-                {% else %}
-                    <a href="{% url login %}?next={{ request.path }}"
-                        id="login" class="ajaxable">
-                            {% trans "Sign in" %}</a>
-                    /
-                    <a href="{% url register %}?next={{ request.path }}"
-                        id="register" class="ajaxable">
-                            {% trans "Register" %}</a>
-                {% endif %}
-            </p>
-
-
-            <div class="clearboth"></div>
-
-        </div>
-        </div>
-
-        <div id="half-header">
-        <div id="half-header-content">
-
-
-
-            <form id="search-area" action="/fullsearch/" class="hidelabels">
-                
-                <div id="search-field" class="grid-line">
-                       <label for="search">{{search_form.q.label}}</label>
-                 {{search_form.q}}
-<!--                    <input title="np. Leśmian" name="q" autocomplete="off" data-source="/fullsearch/hint/">-->
-                </div><div id="search-button">
-                    <button type='submit'><span class="mono">{% trans "Search" %}</span></button>
-                </div>
-                
-                <div class="clearboth"></div>
-            </form>
-
-
-
-        </div>
-        </div>
-
-
-
-        <div id="main-content">
-
-            <div id="nav-line">
-               {% cache 60 catalogue-menu LANGUAGE_CODE %}
-                       {% catalogue_menu %}
-               {% endcache %}
-
-            <form action="{% url django.views.i18n.set_language %}" method="post">
-            <div id="lang-menu">
-                <span id='lang-button' class='mono'>
-                    {% trans "Language versions" %}</span>
-                <div id="lang-menu-items">
-                {% for lang in LANGUAGES %}
-                    <button type="submit" name="language"
-                        class="{% ifequal lang.0 LANGUAGE_CODE %}active{% endifequal %} mono"
-                        value="{{ lang.0 }}">{{ lang.1 }}</button>
-                {% endfor %}
-                </div>
-            </div>
-            </form>
-            </div>
-
-            <div class="clearboth"></div>
-
-
-
-            {% block body %}
-            {% endblock %}
-
-
-
-
-        <div class="clearboth"></div>
-
-        </div>{# end main-content #}
-
-
-        <div id="footer">
-        <div id="footer-content">
-            <p>
-               {% blocktrans %}
-                               Wolne Lektury is a project lead by <a href="http://nowoczesnapolska.org.pl/">Modern Poland Foundation</a>.
-                               Digital reproductions are made by <a href="http://www.bn.org.pl/">The National Library</a>, <a href="http://www.bs.katowice.pl/">Biblioteka Śląska</a> and <a href="http://www.bibliotekaelblaska.pl/">Biblioteka Elbląska</a>, based on TNL, BŚ and BE resources.
-                               Hosting: <a href="http://www.icm.edu.pl/">ICM</a>.
-                               {% endblocktrans %}
-            </p>
-            <p>
-               {% blocktrans %}
-                               Modern Poland Foundation, 00-514 Warsaw, ul. Marszałkowska 84/92 lok. 125, tel/fax: (22) 621-30-17
-                e-mail: <a href="mailto:fundacja@nowoczesnapolska.org.pl">fundacja@nowoczesnapolska.org.pl</a>
-                               {% endblocktrans %}
-            </p>
-
-            {% block add_footer %}{% endblock %}
-
-                       {% sponsor_page "footer" %}
-        </div>
-        </div>
-
-
-
-        {# template #}
-        <div id="ajaxable-window" class='dialog-window'>
-            <div class="header mono"><a href="#" class="jqmClose">{% trans "Close" %}</a></div>
-            <div class="target">
-                <p><img src="{{ STATIC_URL }}img/indicator.gif" alt="*"/> {% trans "Loading" %}</p>
-            </div>
-        </div>
-
-
-        {% endblock bodycontent %}
-
-
-        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
-        <script type="text/javascript">
-            var LANGUAGE_CODE = "{{ LANGUAGE_CODE }}";
-            var STATIC_URL = "{{ STATIC_URL }}";
-        </script>
-        {% compressed_js "base" %}
-
-        <!--{{ piwik_tag|safe }}
-        <script type="text/javascript">
-        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
-        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
-        </script>
-        <script type="text/javascript">
-        var pageTracker = _gat._getTracker("UA-2576694-1");
-        pageTracker._trackPageview();
-        </script>-->
-    </body>
-</html>
+{% block ogtitle %}{% block titleextra %}{% endblock %}{% endblock %}
index dd4d907..a996d66 100644 (file)
@@ -1,8 +1,10 @@
 {% extends "base.html" %}
 {% load cache i18n %}
 {% extends "base.html" %}
 {% load cache i18n %}
+{% load thumbnail %}
 {% load catalogue_tags pagination_tags %}
 
 {% block titleextra %}{{ book.pretty_title }}{% endblock %}
 {% load catalogue_tags pagination_tags %}
 
 {% block titleextra %}{{ book.pretty_title }}{% endblock %}
+{% block ogimage %}{{ book.cover.url|build_absolute_uri:request }}{% endblock %}
 
 {% block metadescription %}{% book_title book %}. {{ block.super }}{% endblock %}
 
 
 {% block metadescription %}{% book_title book %}. {{ block.super }}{% endblock %}
 
index 9e8f922..f92028f 100755 (executable)
@@ -3,6 +3,7 @@
 
 
 {% block title %}{% trans "Wolne Lektury internet library" %}{% endblock %}
 
 
 {% block title %}{% trans "Wolne Lektury internet library" %}{% endblock %}
+{% block ogtitle %}{% trans "Wolne Lektury internet library" %}{% endblock %}
 
 {% block body %}
 
 
 {% block body %}
 
diff --git a/wolnelektury/templates/superbase.html b/wolnelektury/templates/superbase.html
new file mode 100644 (file)
index 0000000..5813a2b
--- /dev/null
@@ -0,0 +1,201 @@
+<!DOCTYPE html>
+<html class="no-js" xmlns:og="http://opengraphprotocol.org/schema/">
+       {% load cache compressed i18n %}
+    {% load catalogue_tags reporting_stats sponsor_tags %}
+    <head>
+        <meta charset="utf-8">
+        <meta name="application-name" content="Wolne Lektury" />
+        <meta property="og:site_name" content="Wolne Lektury" />
+        <meta property="og:title" content="{% block ogtitle %}{% endblock %}" />
+        <meta property="og:type" content="{% block ogtype %}website{% endblock %}" />
+        <meta property="og:image" content="{% block ogimage %}http://static.wolnelektury.pl/img/logo-bez.png{% endblock %}" />
+        <meta name="description" 
+            content="{% block metadescription %}Darmowe opracowane, pełne teksty lektur, e-booki, audiobooki i pliki DAISY na wolnej licencji.{% endblock %}" />
+        {% block ogextra %}{% endblock %}
+        
+
+        <title>{% block title %}{% trans "Wolne Lektury" %} :: 
+            {% block titleextra %}{% endblock %}{% endblock %}</title>
+        <link rel="icon" href="{{ STATIC_URL }}img/favicon.png" type="image/png" />
+        <link rel="search" type="application/opensearchdescription+xml" title="Wolne Lektury" href="{{ STATIC_URL }}opensearch.xml" />
+        {% compressed_css "all" %}
+        {% compressed_css "screen" %}
+        <!--[if IE]>
+               {% compressed_css "ie" %}
+        <![endif]-->
+        <!--script src="{{ STATIC_URL }}js/modernizr.custom.13352.js"></script-->
+        <script src="{{ STATIC_URL }}js/modernizr-latest.js"></script>
+
+        {% block extrahead %}
+        {% endblock %}
+    </head>
+    <body id="{% block bodyid %}base{% endblock %}">
+
+        {% block bodycontent %}
+
+               <div id="header-bg"></div>
+
+        <div id="header">
+
+        <div id="header-content">
+            <div id="logo">
+                <a class="logo" href="/">
+                Wolne Lektury</a>
+            </div>
+
+            <div id="tagline">
+                <span>
+                {% cache 60 tagline LANGUAGE_CODE %}
+                    {% url book_list as b %}
+                    {% url infopage 'o-projekcie' as r %}
+                        {% count_books book_count %}
+                    {% blocktrans count book_count as c %}
+                    <a href='{{b}}'>{{c}}</a> free reading you have <a href='{{r}}'>right to</a>
+                    {% plural %}
+                    <a href='{{b}}'>{{c}}</a> free readings you have <a href='{{r}}'>right to</a>
+                    {% endblocktrans %}
+                {% endcache %}
+                </span>
+            </div>
+
+            <p id="user-info" class="mono">
+                {% if user.is_authenticated %}
+                    {% trans "Welcome" %}, <strong>{{ user.username }}</strong>
+                    | <a href="{% url social_my_shelf %}" id="user-shelves-link">{% trans "My shelf" %}</a>
+                    {% if user.is_staff %}
+                    | <a href="/admin/">{% trans "Administration" %}</a>
+                    {% endif %}
+                    | <a href="{% url logout %}?next={% block logout %}{{ request.get_full_path }}{% endblock %}">{% trans "Logout" %}</a>
+                {% else %}
+                    <a href="{% url login %}?next={{ request.path }}"
+                        id="login" class="ajaxable">
+                            {% trans "Sign in" %}</a>
+                    /
+                    <a href="{% url register %}?next={{ request.path }}"
+                        id="register" class="ajaxable">
+                            {% trans "Register" %}</a>
+                {% endif %}
+            </p>
+
+
+            <div class="clearboth"></div>
+
+        </div>
+        </div>
+
+        <div id="half-header">
+        <div id="half-header-content">
+
+
+
+            <form id="search-area" action="/fullsearch/" class="hidelabels">
+                
+                <div id="search-field" class="grid-line">
+                       <label for="search">{{search_form.q.label}}</label>
+                 {{search_form.q}}
+<!--                    <input title="np. Leśmian" name="q" autocomplete="off" data-source="/fullsearch/hint/">-->
+                </div><div id="search-button">
+                    <button type='submit'><span class="mono">{% trans "Search" %}</span></button>
+                </div>
+                
+                <div class="clearboth"></div>
+            </form>
+
+
+
+        </div>
+        </div>
+
+
+
+        <div id="main-content">
+
+            <div id="nav-line">
+               {% cache 60 catalogue-menu LANGUAGE_CODE %}
+                       {% catalogue_menu %}
+               {% endcache %}
+
+            <form action="{% url django.views.i18n.set_language %}" method="post">
+            <div id="lang-menu">
+                <span id='lang-button' class='mono'>
+                    {% trans "Language versions" %}</span>
+                <div id="lang-menu-items">
+                {% for lang in LANGUAGES %}
+                    <button type="submit" name="language"
+                        class="{% ifequal lang.0 LANGUAGE_CODE %}active{% endifequal %} mono"
+                        value="{{ lang.0 }}">{{ lang.1 }}</button>
+                {% endfor %}
+                </div>
+            </div>
+            </form>
+            </div>
+
+            <div class="clearboth"></div>
+
+
+
+            {% block body %}
+            {% endblock %}
+
+
+
+
+        <div class="clearboth"></div>
+
+        </div>{# end main-content #}
+
+
+        <div id="footer">
+        <div id="footer-content">
+            <p>
+               {% blocktrans %}
+                               Wolne Lektury is a project lead by <a href="http://nowoczesnapolska.org.pl/">Modern Poland Foundation</a>.
+                               Digital reproductions are made by <a href="http://www.bn.org.pl/">The National Library</a>, <a href="http://www.bs.katowice.pl/">Biblioteka Śląska</a> and <a href="http://www.bibliotekaelblaska.pl/">Biblioteka Elbląska</a>, based on TNL, BŚ and BE resources.
+                               Hosting: <a href="http://www.icm.edu.pl/">ICM</a>.
+                               {% endblocktrans %}
+            </p>
+            <p>
+               {% blocktrans %}
+                               Modern Poland Foundation, 00-514 Warsaw, ul. Marszałkowska 84/92 lok. 125, tel/fax: (22) 621-30-17
+                e-mail: <a href="mailto:fundacja@nowoczesnapolska.org.pl">fundacja@nowoczesnapolska.org.pl</a>
+                               {% endblocktrans %}
+            </p>
+
+            {% block add_footer %}{% endblock %}
+
+                       {% sponsor_page "footer" %}
+        </div>
+        </div>
+
+
+
+        {# template #}
+        <div id="ajaxable-window" class='dialog-window'>
+            <div class="header mono"><a href="#" class="jqmClose">{% trans "Close" %}</a></div>
+            <div class="target">
+                <p><img src="{{ STATIC_URL }}img/indicator.gif" alt="*"/> {% trans "Loading" %}</p>
+            </div>
+        </div>
+
+
+        {% endblock bodycontent %}
+
+
+        <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.1/jquery.min.js"></script>
+        <script type="text/javascript">
+            var LANGUAGE_CODE = "{{ LANGUAGE_CODE }}";
+            var STATIC_URL = "{{ STATIC_URL }}";
+        </script>
+        {% compressed_js "base" %}
+
+        <!--{{ piwik_tag|safe }}
+        <script type="text/javascript">
+        var gaJsHost = (("https:" == document.location.protocol) ? "https://ssl." : "http://www.");
+        document.write(unescape("%3Cscript src='" + gaJsHost + "google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E"));
+        </script>
+        <script type="text/javascript">
+        var pageTracker = _gat._getTracker("UA-2576694-1");
+        pageTracker._trackPageview();
+        </script>-->
+    </body>
+</html>