teh publish button again
[redakcja.git] / apps / catalogue / templates / catalogue / book_detail.html
index 8e9c1f1..19e673c 100755 (executable)
@@ -68,7 +68,7 @@
 
 <p>{% trans "Last published" %}: {{ book.last_published }}</p>
 
-{% if book.publishable %}
+{% if publishable %}
     <p>
     <a href="{% url catalogue_book_xml book.slug %}">{% trans "Full XML" %}</a><br/>
     <a target="_blank" href="{% url catalogue_book_html book.slug %}">{% trans "HTML version" %}</a><br/>
     {% endcomment %}
     </p>
 
-    {% trans "This book cannot be published yet" %}
-    {% comment %}
-    <!--
-    Angel photos:
-    Angels in Ely Cathedral (http://www.flickr.com/photos/21804434@N02/4483220595/) /
-    mira66 (http://www.flickr.com/photos/21804434@N02/) /
-    CC BY 2.0 (http://creativecommons.org/licenses/by/2.0/)
-    -->
-    <form method="POST" action="{% url catalogue_publish book.slug %}">{% csrf_token %}
-        <img src="{{ STATIC_URL }}img/angel-left.png" style="vertical-align: middle" />
-        <button id="publish-button" type="submit">
-            <span>{% trans "Publish" %}</span></button>
-        <img src="{{ STATIC_URL }}img/angel-right.png" style="vertical-align: middle" />
-        </form>
-    {% endcomment %}
+    {% if user.is_authenticated %}
+        <!--
+        Angel photos:
+        Angels in Ely Cathedral (http://www.flickr.com/photos/21804434@N02/4483220595/) /
+        mira66 (http://www.flickr.com/photos/21804434@N02/) /
+        CC BY 2.0 (http://creativecommons.org/licenses/by/2.0/)
+        -->
+        <form method="POST" action="{% url catalogue_publish book.slug %}">{% csrf_token %}
+            <img src="{{ STATIC_URL }}img/angel-left.png" style="vertical-align: middle" />
+            <button id="publish-button" type="submit">
+                <span>{% trans "Publish" %}</span></button>
+            <img src="{{ STATIC_URL }}img/angel-right.png" style="vertical-align: middle" />
+            </form>
+    {% else %}
+        <a href="{% url login %}">{% trans "Log in to publish." %}</a>
+    {% endif %}
 {% else %}
-    {% trans "This book cannot be published yet" %}
+    <p>{% trans "This book can't be published yet, because:" %}</p>
+    <ul><li>{{ publishable_error }}</li></ul>
 {% endif %}
 
 {% endblock leftcolumn %}