From cc8d25d6adda998bb27148d189011fcdbdae3572 Mon Sep 17 00:00:00 2001
From: "J.-S. Caux" <J.S.Caux@uva.nl>
Date: Sat, 27 Oct 2018 19:58:24 +0200
Subject: [PATCH] Add topic detail card

---
 ontology/templates/ontology/_topic_card.html  | 19 +++++++++++++++++++
 ontology/templates/ontology/topic_detail.html |  3 +--
 ontology/urls.py                              |  2 +-
 3 files changed, 21 insertions(+), 3 deletions(-)
 create mode 100644 ontology/templates/ontology/_topic_card.html

diff --git a/ontology/templates/ontology/_topic_card.html b/ontology/templates/ontology/_topic_card.html
new file mode 100644
index 000000000..e9b4cd708
--- /dev/null
+++ b/ontology/templates/ontology/_topic_card.html
@@ -0,0 +1,19 @@
+
+<div class="card">
+  <div class="card-header">
+    <h3>{{ topic }}</h3>
+    {% if perms.scipost.can_manage_ontology %}
+    <a href="{% url 'ontology:topic_update' slug=topic.slug %}">Update</a>
+    {% endif %}
+  </div>
+  <div class="card-body">
+    {% if topic.tags.all %}
+    <ul class="list list-inline">
+      <li class="list-inline-item"><strong>Tags</strong>:</li>
+      {% for tag in topic.tags.all %}
+      <li class="list-inline-item">{{ tag }}</li>
+      {% endfor %}
+    </ul>
+    {% endif %}
+  </div>
+</div>
diff --git a/ontology/templates/ontology/topic_detail.html b/ontology/templates/ontology/topic_detail.html
index c0d36b83e..12d5d926d 100644
--- a/ontology/templates/ontology/topic_detail.html
+++ b/ontology/templates/ontology/topic_detail.html
@@ -4,7 +4,6 @@
 
 {% block breadcrumb_items %}
     {{ block.super }}
-<span class="breadcrumb-item"><a href="{% url 'ontology:topics' %}">Topics</a></span>
 <span class="breadcrumb-item">{{ topic }}</span>
 {% endblock %}
 
@@ -13,7 +12,7 @@
 {% block content %}
 <div class="row">
   <div class="col-12">
-    {{ topic }}
+    {% include 'ontology/_topic_card.html' with topic=topic %}
   </div>
 </div>
 {% endblock content %}
diff --git a/ontology/urls.py b/ontology/urls.py
index 5a864cb50..14ed0745d 100644
--- a/ontology/urls.py
+++ b/ontology/urls.py
@@ -14,7 +14,7 @@ urlpatterns = [
         ),
     url(
         r'^topic/(?P<slug>[-\w]+)/update/$',
-        views.TopicCreateView.as_view(),
+        views.TopicUpdateView.as_view(),
         name='topic_update'
         ),
     url(
-- 
GitLab