diff --git a/project.clj b/project.clj
index 6990ea9..5950359 100644
--- a/project.clj
+++ b/project.clj
@@ -17,7 +17,7 @@
[org.clojure/tools.cli "0.3.5"]
[org.clojure/tools.logging "0.3.1"]
[org.webjars.bower/tether "1.4.0"]
- [org.webjars/bootstrap "4.0.0-alpha.5"]
+ [org.webjars/bootstrap "4.0.0-alpha.6"]
[org.webjars/font-awesome "4.7.0"]
[org.webjars/webjars-locator-jboss-vfs "0.1.0"]
[org.xerial/sqlite-jdbc "3.16.1"]
@@ -32,7 +32,10 @@
[image-resizer "0.1.9"]
[me.raynes/fs "1.4.6"]
[digest "1.4.5"]
- [clj-exif-orientation "0.2.1"]]
+ [markdown-clj "0.9.98"]
+ [clj-exif-orientation "0.2.1"]
+ [markdown-clj "0.9.98"]
+ [clj-time "0.8.0"]]
:min-lein-version "2.0.0"
diff --git a/resources/public/css/screen.css b/resources/public/css/screen.css
index 7b1f2ac..b9f3c61 100644
--- a/resources/public/css/screen.css
+++ b/resources/public/css/screen.css
@@ -1,5 +1,15 @@
+#content {
+ margin-top: 20px; }
+
.thumbnail-image {
display: block;
margin: 10px;
border: 1px solid #ccc;
float: left; }
+
+.detail-image img {
+ max-width: 100%; }
+
+.detail-image a {
+ display: block;
+ text-align: center; }
diff --git a/resources/scss/screen.scss b/resources/scss/screen.scss
index 932bd27..98f5e85 100644
--- a/resources/scss/screen.scss
+++ b/resources/scss/screen.scss
@@ -1,6 +1,20 @@
+#content {
+ margin-top: 20px;
+}
+
.thumbnail-image {
display: block;
margin: 10px;
border: 1px solid #ccc;
float: left;
}
+
+.detail-image {
+ img {
+ max-width: 100%;
+ }
+ a {
+ display: block;
+ text-align: center;
+ }
+}
diff --git a/resources/templates/detail.html b/resources/templates/detail.html
index 44776dc..27ccb2a 100644
--- a/resources/templates/detail.html
+++ b/resources/templates/detail.html
@@ -2,19 +2,49 @@
{% block content %}
-{% if next-image %}
-Weiter
-{% endif %}
+
+
-{{ image.title }}
-
+
+
{{ image.title }}
+
+
{{ image.created_at|parse-date|date:"dd-MM-yyyy HH:mm" }}
+
+
+ {% for tag in tags %}
+ {{ tag.tagname }}
+ {% endfor %}
+
+
+
+
+
+
{% if image.description|length > 0 %}
-{{ image.description }}
+
+
{{ image.description|markdown-to-html|safe }}
+
{% endif %}
{% endblock %}
diff --git a/src/clj/yenu/layout.clj b/src/clj/yenu/layout.clj
index a822654..598d424 100644
--- a/src/clj/yenu/layout.clj
+++ b/src/clj/yenu/layout.clj
@@ -4,13 +4,17 @@
[ring.util.http-response :refer [content-type ok]]
[ring.util.anti-forgery :refer [anti-forgery-field]]
[yenu.helpers.images :as image-helper]
- [ring.middleware.anti-forgery :refer [*anti-forgery-token*]]))
+ [ring.middleware.anti-forgery :refer [*anti-forgery-token*]]
+ [clj-time.format :as time-format])
+ (:use [markdown.core]))
(declare ^:dynamic *app-context*)
(parser/set-resource-path! (clojure.java.io/resource "templates"))
(parser/add-tag! :csrf-field (fn [_ _] (anti-forgery-field)))
(filter/add-filter! :inc inc)
(filter/add-filter! :dec dec)
+(filter/add-filter! :markdown-to-html md-to-html-string)
+(filter/add-filter! :parse-date time-format/parse)
(defn render
"renders the HTML template located relative to resources/templates"
diff --git a/src/clj/yenu/routes/admin.clj b/src/clj/yenu/routes/admin.clj
index 8e0b3e8..af11800 100644
--- a/src/clj/yenu/routes/admin.clj
+++ b/src/clj/yenu/routes/admin.clj
@@ -25,6 +25,7 @@
(defn add-tag [image-id tag]
(db/create-tag! {:tagname tag})
+
(let [{tag-id :id} (db/get-tag {:tagname tag})]
(db/add-tag-to-image! {:imageid image-id :tagid tag-id})))
@@ -32,7 +33,7 @@
(let [img (db/create-image! {:hash filehash :title title :description description})
image-id ((keyword "last_insert_rowid()") img)
all-tags (str/split tags, #"(\s*,\s*|\s+)")]
- (map #(add-tag image-id %) all-tags)))
+ (run! #(add-tag image-id %) all-tags)))
(defroutes admin-routes
(GET "/upload" []
diff --git a/src/clj/yenu/routes/core.clj b/src/clj/yenu/routes/core.clj
index 3060ddb..36cb154 100644
--- a/src/clj/yenu/routes/core.clj
+++ b/src/clj/yenu/routes/core.clj
@@ -11,7 +11,7 @@
(/ (:count (db/get-image-count)) images-on-page))))
(defn index-page [current-page]
- (let [image-count 5
+ (let [image-count 15
offset (* (dec current-page) image-count)
pages (number-of-pages image-count)
images (db/get-all-images {:offset offset :count image-count})]
@@ -27,7 +27,9 @@
(layout/render "detail.html"
{:image image
:next-image next-img
- :prev-image prev-img})))
+ :prev-image prev-img
+ :tags (db/get-tags-for-image {:id (:id image)})
+ :comments (db/get-comments-for-image {:image_id (:id image)})})))
(defn image-file [type hash ext]
(let [filename (str hash "." ext)]