tags/infos/fixed viewer
authorMarcin Koziej <marcin@lolownia.org>
Thu, 5 Dec 2013 16:15:38 +0000 (17:15 +0100)
committerMarcin Koziej <marcin@lolownia.org>
Thu, 5 Dec 2013 16:15:38 +0000 (17:15 +0100)
apps/picture/models.py
apps/picture/templates/picture/picture_short.html
apps/picture/templates/picture/picture_viewer.html
apps/picture/templates/picture/picture_wide.html
apps/picture/templatetags/picture_tags.py
apps/picture/views.py
apps/wolnelektury_core/static/css/book_box.css
apps/wolnelektury_core/static/css/master.picture.css
apps/wolnelektury_core/static/css/screen.css
apps/wolnelektury_core/static/img/logo_nck.jpg [new file with mode: 0644]

index fa602e6..65002ae 100644 (file)
@@ -41,6 +41,9 @@ class Picture(models.Model):
     image_file  = ImageField(_('image_file'), upload_to="images", storage=picture_storage)
     html_file   = models.FileField('html_file', upload_to="html", storage=picture_storage)
     areas       = jsonfield.JSONField(_('picture areas'), default={}, editable=False)
     image_file  = ImageField(_('image_file'), upload_to="images", storage=picture_storage)
     html_file   = models.FileField('html_file', upload_to="html", storage=picture_storage)
     areas       = jsonfield.JSONField(_('picture areas'), default={}, editable=False)
+    extra_info    = jsonfield.JSONField(_('extra information'), default={})
+    culturepl_link   = models.CharField(blank=True, max_length=240)
+    wiki_link     = models.CharField(blank=True, max_length=240)
 
     objects     = models.Manager()
     tagged      = managers.ModelTaggedItemManager(catalogue.models.Tag)
 
     objects     = models.Manager()
     tagged      = managers.ModelTaggedItemManager(catalogue.models.Tag)
@@ -108,6 +111,7 @@ class Picture(models.Model):
                 raise Picture.AlreadyExists('Picture %s already exists' % picture_xml.slug)
 
             picture.title = picture_xml.picture_info.title
                 raise Picture.AlreadyExists('Picture %s already exists' % picture_xml.slug)
 
             picture.title = picture_xml.picture_info.title
+            picture.extra_info = picture_xml.picture_info.to_dict()
 
             motif_tags = set()
             thing_tags = set()
 
             motif_tags = set()
             thing_tags = set()
index edc59b8..e7bbdd8 100644 (file)
                 {% endfor %}
             </span>
 
                 {% endfor %}
             </span>
 
+            <span class="mono">{% trans "Genre" %}:&nbsp;</span>
+            <span class="book-box-tag">
+                {% for tag in tags.genre %}
+                    <a href="{{ tag.get_absolute_url }}">{{ tag.name }} </a>{% if not forloop.last %},{% endif %}
+                {% endfor %}
+            </span>
+
             {% endspaceless %}
         </div>
     </div>
             {% endspaceless %}
         </div>
     </div>
        </div>-->
       </li>
     </ul>
        </div>-->
       </li>
     </ul>
+    {% block book-box-extra-info %}{% endblock %}
+    {% block box-append %}
+    {% endblock %}
+    {% block right-column %}
+    {% endblock %}
     <div class="clearboth"/>
 </div>
 </div>
     <div class="clearboth"/>
 </div>
 </div>
index fbf3610..d190af8 100644 (file)
 
     </head>
     <body>
 
     </head>
     <body>
-        <div id="menu">
+        <div id="menu" class="moveright">
             <ul>
 <!--                <li><a class="menu" href="#themes">{% trans "Themes" %}</a></li>
                 <li><a class="menu" href="#objects">{% trans "Objects" %}</a></li>-->
                <!-- XXX do we have this? -->
             <ul>
 <!--                <li><a class="menu" href="#themes">{% trans "Themes" %}</a></li>
                 <li><a class="menu" href="#objects">{% trans "Objects" %}</a></li>-->
                <!-- XXX do we have this? -->
-                <li><a class="menu" href="#nota_red">{% trans "Edit. note" %}</a></li>
+<!--                <li><a class="menu" href="#nota_red">{% trans "Edit. note" %}</a></li>-->
                 <li><a class="menu" href="#info">{% trans "Infobox" %}</a></li>
                 <li><a href="{{ picture.get_absolute_url }}">{% trans "Picture's page" %}</a></li>
 <!-- XXX -->
                 <li><a class="menu" href="#download">{% trans "Download" %}</a></li>
             </ul>
         </div>
                 <li><a class="menu" href="#info">{% trans "Infobox" %}</a></li>
                 <li><a href="{{ picture.get_absolute_url }}">{% trans "Picture's page" %}</a></li>
 <!-- XXX -->
                 <li><a class="menu" href="#download">{% trans "Download" %}</a></li>
             </ul>
         </div>
-        <div id="info">
-            {# book_info book #}
+        <div id="info" class="moveright">
+            {% book_info picture %}
         </div>
        {{ picture.html_file.read|safe }}
 
         </div>
        {{ picture.html_file.read|safe }}
 
        </div>
         {{ piwik_tag|safe }}
        <div id="spinner"></div>
        </div>
         {{ piwik_tag|safe }}
        <div id="spinner"></div>
+       <div id="sponsors">
+         <div>
+           <a href="/"><img src="{% static "img/logo-220.png" %}" alt="Wolne Lektury" ></img>
+             </a>
+           </div>
+         <div>
+           <a href="http://www.nck.pl"><img src="{% static "img/logo_nck.jpg" %}" alt="Narodowe Centrum Kultury" ></img></a>
+         </div>
+       </div>
     </body>
 </html
     </body>
 </html
index 6eec8d4..46e37c9 100644 (file)
 
 
 {% block book-box-extra-info %}
 
 
 {% block book-box-extra-info %}
-{% if themes %}
+{% if themes or things%}
     <div class="hidden-box-wrapper" id="theme-list-wrapper">
         <p><a class="mono hidden-box-trigger theme-list-link"
     <div class="hidden-box-wrapper" id="theme-list-wrapper">
         <p><a class="mono hidden-box-trigger theme-list-link"
-                href="#">{% trans "Motifs and themes" %}</a></p>
+                href="#">{% trans "Motifs, themes and objects" %}</a></p>
         <div class="hidden-box">
         <div class="hidden-box">
-            <ul>
+         {% if themes %}
+         <p>{% trans "Motifs and themes" %}</p>
+          <ul>
             {% for theme in themes %}
             {% for theme in themes %}
-                <li><a href="{% url 'book_fragments' book.slug theme.slug %}">{{ theme }} ({{ theme.count }})</a></li>
-            {% endfor %}
+            <li><a href="{% url 'picture_viewer' picture.slug %}#theme-{{theme.slug}}">{{ theme }}{# ({{ theme.picture_count }})#}</a></li>
+               {% endfor %}
             </ul>
             </ul>
+           {% endif %}
+           {% if things %}
+         <p>{% trans "Objects" %}</p>
+          <ul>
+            {% for thing in things %}
+            <li><a href="{% url 'picture_viewer' picture.slug %}#object-{{thing.slug}}">{{ thing }}{# ({{ thing.picture_count }})#}</a></li>
+            {% endfor %}
+          </ul>
+         {% endif %}
         </div>
     </div>
 {% else %}
         </div>
     </div>
 {% else %}
 
 {% block right-column %}
 <div class="right-column">
 
 {% block right-column %}
 <div class="right-column">
-   INFO
-  {% comment %}<div class="other-tools">
+  <div class="other-tools">
     <h2 class="mono">{% trans "See" %}</h2>
     <ul class="plain">
       {% if extra_info.source_url %}
     <h2 class="mono">{% trans "See" %}</h2>
     <ul class="plain">
       {% if extra_info.source_url %}
-      <li><a href="{{ extra_info.source_url }}">{% trans "Source" %}</a> {% trans "of the book" %}</li>
+      <li><a href="{{ extra_info.source_url }}">{% trans "Source" %}</a> {% trans "of the picture" %}</li>
       {% endif %}
       {% endif %}
-      <li><a href="{{ book.xml_file.url }}">{% trans "Source XML file" %}</a></li>
+      <li><a href="{{ picture.xml_file.url }}">{% trans "Source XML file" %}</a></li>
       {% if extra_info.about and not hide_about %}
       {% if extra_info.about and not hide_about %}
-      <li>{% trans "Book on" %} <a href="{{ extra_info.about }}">{% trans "Editor's Platform" %}</a></li>
+      <li>{% trans "Picture on" %} <a href="{{ extra_info.about }}">{% trans "Editor's Platform" %}</a></li>
       {% endif %}
       {% endif %}
-      {% if book.gazeta_link %}
-      <li><a href="{{ book.gazeta_link }}">{% trans "Book description on Lektury.Gazeta.pl" %}</a></li>
+      {% if picture.culturepl_link %}
+      <li><a href="{{ picture.culturepl_link }}">{% trans "Picture description on Lektury.Gazeta.pl" %}</a></li>
       {% endif %}
       {% endif %}
-      {% if book.wiki_link %}
-      <li><a href="{{ book.wiki_link }}">{% trans "Book description on Wikipedia" %}</a></li>
+      {% if picture.wiki_link %}
+      <li><a href="{{ picture.wiki_link }}">{% trans "Picture description on Wikipedia" %}</a></li>
       {% endif %}
       {% endif %}
-      <li><a href="{% url 'poem_from_book' book.slug %}">{% trans "Mix this book" %}</a></li>
     </ul>
   </div>
     </ul>
   </div>
+
+  {% comment %}
   <div class="other-download">
     <h2 class="mono">{% trans "Download" %}</h2>
     <ul class="plain">
       <li>
        {% if related.media.mp3 or related.media.ogg or related.media.daisy %}
         {% trans "Download all audiobooks for this book" %}:
   <div class="other-download">
     <h2 class="mono">{% trans "Download" %}</h2>
     <ul class="plain">
       <li>
        {% if related.media.mp3 or related.media.ogg or related.media.daisy %}
         {% trans "Download all audiobooks for this book" %}:
-           {% download_audio book %}.
+       {% download_audio book %}.
        {% endif %}
       </li>
       {% custom_pdf_link_li book %}
     </ul>
        {% endif %}
       </li>
       {% custom_pdf_link_li book %}
     </ul>
-  </div>{% endcomment %}
+  </div>
+  {% endcomment %}
 </div>
 {% endblock %}
 </div>
 {% endblock %}
index 3fe5b36..ef297c9 100644 (file)
@@ -6,21 +6,23 @@ register = template.Library()
 
 @register.inclusion_tag('picture/picture_short.html', takes_context=True)
 def picture_short(context, picture):
 
 @register.inclusion_tag('picture/picture_short.html', takes_context=True)
 def picture_short(context, picture):
-    return {
+    context.update({
         'picture': picture,
         'main_link': picture.get_absolute_url(),
         # 'related': picture.related_info(),
         'request': context.get('request'),
         'tags': split_tags(picture.tags),
         'picture': picture,
         'main_link': picture.get_absolute_url(),
         # 'related': picture.related_info(),
         'request': context.get('request'),
         'tags': split_tags(picture.tags),
-        }
+        })
+    return context
                             
 @register.inclusion_tag('picture/picture_wide.html', takes_context=True)
 def picture_wide(context, picture):
                             
 @register.inclusion_tag('picture/picture_wide.html', takes_context=True)
 def picture_wide(context, picture):
-    return {
+    context.update({
         'picture': picture,
         'main_link': picture.get_absolute_url(),
         # 'related': picture.related_info(),
         'request': context.get('request'),
         'tags': split_tags(picture.tags),
         'picture': picture,
         'main_link': picture.get_absolute_url(),
         # 'related': picture.related_info(),
         'request': context.get('request'),
         'tags': split_tags(picture.tags),
-        }
+        })
+    return context
 
 
index 65e5fa4..c39969a 100644 (file)
@@ -38,7 +38,10 @@ def picture_detail(request, slug):
     for tag in picture.tags.iterator():
         categories.setdefault(tag.category, []).append(tag)
 
     for tag in picture.tags.iterator():
         categories.setdefault(tag.category, []).append(tag)
 
-    picture_themes = []
+    themes = categories.get('theme', [])
+    things = categories.get('thing', [])
+
+    extra_info = picture.extra_info
 
     return render_to_response("picture/picture_detail.html", locals(),
                               context_instance=RequestContext(request))
 
     return render_to_response("picture/picture_detail.html", locals(),
                               context_instance=RequestContext(request))
index 8a7cff2..21299f9 100755 (executable)
        width: 30em;
 }
 
        width: 30em;
 }
 
+.picture.book-wide-box #theme-list-wrapper {
+    margin-left: 55em;
+}
+
 
 
 .book-box-read a:before {
 
 
 .book-box-read a:before {
@@ -273,7 +277,10 @@ ul.inline-items li {
     float: left;
     width: 14.5em;
     margin: 5em 0 0 1.5em;
     float: left;
     width: 14.5em;
     margin: 5em 0 0 1.5em;
-    
+}
+
+.picture.book-wide-box .other-tools {
+    margin: 5em 0 0 0;
 }
 
 .book-wide-box .other-download {
 }
 
 .book-wide-box .other-download {
index c4e952c..d731bd0 100644 (file)
@@ -4,12 +4,16 @@
     position:absolute;
     top: 0;
     bottom: 0;
     position:absolute;
     top: 0;
     bottom: 0;
+    z-index: 10;
 }
  
 #picture-view .picture-wrap {
     margin: 3rem auto 1rem auto;
     display: block;
 }
  
 #picture-view .picture-wrap {
     margin: 3rem auto 1rem auto;
     display: block;
-//    position: absolute;
+    z-index: 10;
+}
+#picture-view .picture-wrap img {
+    z-index: 10;
 }
 
 #picture-view .picture-wrap {
 }
 
 #picture-view .picture-wrap {
 
 .toolbar {
     position: fixed;
 
 .toolbar {
     position: fixed;
-    top: 1.5rem;
+    //top: 1.5rem;
     left: 0rem;
     color: #FFF;
     z-index: 99;
     list-style: none; 
     padding: 0;
     margin: 0;
     left: 0rem;
     color: #FFF;
     z-index: 99;
     list-style: none; 
     padding: 0;
     margin: 0;
+    
+    background: #333;
+    opacity: 0.9;
+    width: 8rem;
 }
 
 .toolbar ul {
 }
 
 .toolbar ul {
 }
 
 .toolbar .button a {
 }
 
 .toolbar .button a {
-    background: #333;
-    opacity: 0.9;
+    //background: #333;
+    //opacity: 0.9;
     display: block;
     height:1.5rem;
 
     text-align: center;
     color: #FFF;
     display: block;
     height:1.5rem;
 
     text-align: center;
     color: #FFF;
-    padding: 0.2rem;
+    padding: 0.2rem 0;
     text-decoration: none;
 }
 
     text-decoration: none;
 }
 
@@ -80,7 +88,7 @@
 }
 
 #picture-view .toolbar .button.square a {
 }
 
 #picture-view .toolbar .button.square a {
-    width:1.5rem;
+    width: 4rem; //1.5rem;
 }
 
 li.button {
 }
 
 li.button {
@@ -98,4 +106,25 @@ li.button.square {
 
 #picture-view .toolbar.button a:active {
     color: yellow;
 
 #picture-view .toolbar.button a:active {
     color: yellow;
+}
+
+.moveright {
+    margin-left: 8rem !important;
+}
+
+#sponsors {
+    position: absolute;
+    display: block;
+    top: 3.5rem;
+    right: 2rem;
+    z-index:1;
+    width: 9rem;
+}
+#sponsors div {
+    z-index: -10;
+}
+
+#sponsors img {
+    width: 100%;
+    z-index: -10;
 }
\ No newline at end of file
 }
\ No newline at end of file
index 8522996..9059f55 100644 (file)
     margin-top: -23em;
 }
 
     margin-top: -23em;
 }
 
+.picture.book-wide-box .right-column {
+    float: none;
+    width: 41.5em;
+    top: 0;
+    margin-left: 55em;
+    margin-top: 0em;
+}
+
+
 .book-wide-box #theme-list-wrapper {
        margin-bottom: 0;
 }
 .book-wide-box #theme-list-wrapper {
        margin-bottom: 0;
 }
diff --git a/apps/wolnelektury_core/static/img/logo_nck.jpg b/apps/wolnelektury_core/static/img/logo_nck.jpg
new file mode 100644 (file)
index 0000000..c030f6a
Binary files /dev/null and b/apps/wolnelektury_core/static/img/logo_nck.jpg differ