Update all dependencies and change language to EN

Update bootstrap required a lot of template work, so I had no change to
split the commit in two separate commits to rebase the language change.
This means, yenu is EN only by now.
This commit is contained in:
Aaron Fischer 2021-07-31 00:05:13 +02:00 committed by Aaron Fischer
parent bf76a4b323
commit 4a135f7880
No known key found for this signature in database
GPG key ID: A62EFAEA293B99D7
13 changed files with 188 additions and 171 deletions

View file

@ -1,38 +1,45 @@
;;; We need to allow http connections because some dependencies are fetched
;;; over http instead of https. See here for more detail:
;;; https://github.com/technomancy/leiningen/blob/master/doc/FAQ.md
(require 'cemerick.pomegranate.aether)
(cemerick.pomegranate.aether/register-wagon-factory!
"http" #(org.apache.maven.wagon.providers.http.HttpWagon.))
(defproject yenu "1.0.1" (defproject yenu "1.0.1"
:description "yenu -- The image sharing tool for friends" :description "yenu -- The image sharing tool for friends"
:url "https://yenu.de/" :url "https://yenu.de/"
:dependencies [[bouncer "1.0.1"] :dependencies [[bouncer "1.0.1"]
[compojure "1.6.1"] [compojure "1.6.2"]
[conman "0.7.8"] [conman "0.9.1"]
[cprop "0.1.11"] [cprop "0.1.18"]
[luminus-immutant "0.2.4"] [luminus-immutant "0.2.5"]
[luminus-migrations "0.5.0"] [luminus-migrations "0.7.1"]
[luminus-nrepl "0.1.4"] [luminus-nrepl "0.1.7"]
[metosin/ring-http-response "0.9.0"] [metosin/ring-http-response "0.9.2"]
[mount "0.1.12"] [mount "0.1.16"]
[org.clojure/clojure "1.9.0"] [clojure.java-time "0.3.2"]
[org.clojure/tools.cli "0.3.5"] [org.clojure/clojure "1.10.3"]
[org.clojure/tools.logging "0.4.0"] [org.clojure/tools.cli "1.0.206"]
[org.webjars/jquery "3.3.1"] [org.clojure/tools.logging "1.1.0"]
[org.webjars/bootstrap "4.1.0"] [org.webjars/jquery "3.6.0"]
[org.webjars/bootstrap "5.0.1"]
[org.webjars/webjars-locator-jboss-vfs "0.1.0"] [org.webjars/webjars-locator-jboss-vfs "0.1.0"]
[org.webjars.bower/tether "1.4.3"] [org.webjars.bower/tether "1.4.7"]
[org.webjars.bower/font-awesome "4.7.0"] [org.webjars.bower/font-awesome "4.7.0"]
[org.xerial/sqlite-jdbc "3.21.0"] [org.xerial/sqlite-jdbc "3.36.0"]
[ring-webjars "0.2.0"] [ring-webjars "0.2.0"]
[ring-middleware-format "0.7.2"] [ring-middleware-format "0.7.4"]
[ring/ring-core "1.6.3"] [ring/ring-core "1.9.3"]
[ring/ring-defaults "0.3.1"] [ring/ring-defaults "0.3.3"]
[selmer "1.11.7"] [selmer "1.12.44"]
[hiccup "1.0.5"] [hiccup "1.0.5"]
[image-resizer "0.1.10"] [image-resizer "0.1.10"]
[me.raynes/fs "1.4.6"] ;; R.I.P. Anthony! [me.raynes/fs "1.4.6"] ;; R.I.P. Anthony!
[digest "1.4.8"] [digest "1.4.10"]
[markdown-clj "1.0.2"] [markdown-clj "1.10.5"]
[clj-exif-orientation "0.2.1"] [clj-exif-orientation "0.2.1"]
[clj-time "0.14.3"] [buddy/buddy-auth "3.0.1"]]
[buddy/buddy-auth "2.1.0"]]
:min-lein-version "2.0.0" :min-lein-version "2.0.0"
@ -43,11 +50,11 @@
:main yenu.core :main yenu.core
:migratus {:store :database :db ~(get (System/getenv) "DATABASE_URL")} :migratus {:store :database :db ~(get (System/getenv) "DATABASE_URL")}
:plugins [[lein-cprop "1.0.1"] :plugins [[lein-cprop "1.0.3"]
[migratus-lein "0.4.3"] [migratus-lein "0.7.3"]
[lein-immutant "2.1.0"] [lein-immutant "2.1.0"]
[lein-sassc "0.10.4"] [lein-sassc "0.10.5"]
[lein-auto "0.1.2"]] [lein-auto "0.1.3"]]
:sassc :sassc
[{:src "resources/scss/screen.scss" [{:src "resources/scss/screen.scss"
:output-to "resources/public/css/screen.css" :output-to "resources/public/css/screen.css"

View file

@ -2,51 +2,49 @@
{% block content %} {% block content %}
{% if image %} {% if image %}
<h1>Bild editieren</h1> <h1>Edit image</h1>
<p>Hier kann ein bestehendes Bild bearbeitet werden. Das Bild selbst kann nicht <p>Edit an image metadata. To change the image itself, you need to delete and add a new one.</p>
verändert werden (hierzu muss das Bild gelöscht und neu angelegt werden)</p>
{% else %} {% else %}
<h1>Bild hochladen</h1> <h1>Upload image</h1>
<p>Hier kann ein neues Bild der Gallerie hinzugefügt werden. Dabei sind alle <p>Here you can add a new image to the gallery. You can use all common image types. The uploaded
gängigen Bildformate und Auflösungen möglich. Das hochgeladene Bild wird image will be cropped (Thumbnail) and resized (detail image).</p>
zugeschnitten (Thumbnail) und skaliert (Detailseite).</p>
{% endif %} {% endif %}
<form action="{% if image %}/edit/{{ image.id }}{% else %}/upload{% endif %}" enctype="multipart/form-data" method="POST" class="form-horizontal"> <form action="{% if image %}/edit/{{ image.id }}{% else %}/upload{% endif %}" enctype="multipart/form-data" method="POST" class="form-horizontal">
{% csrf-field %} {% csrf-field %}
{% if not image %} {% if not image %}
<div class="form-group"> <div class="mb-3">
<label for="file" class="sr-only">Bild</label> <label for="file" class="form-label sr-only">Image</label>
<input id="file" class="form-control" name="file" type="file" /> <input id="file" class="form-control" name="file" type="file" />
</div> </div>
{% endif %} {% endif %}
<div class="form-group"> <div class="mb-3">
<label for="title">Bildüberschrift</label> <label for="title" class="form-label">Image title</label>
<input type="text" name="title" class="form-control" <input type="text" name="title" class="form-control"
value="{{ image.title }}" value="{{ image.title }}"
placeholder="Leer lassen für Dateiname"> placeholder="Leave empty for filename">
</div> </div>
<div class="form-group"> <div class="mb-3">
<label for="description">Beschreibung (optional)</label> <label for="description" clas="form-label">Description (optional)</label>
<textarea name="description" class="form-control" rows="4">{{image.description }}</textarea> <textarea name="description" class="form-control" rows="4">{{image.description }}</textarea>
</div> </div>
<div class="form-group"> <div class="mb-3">
<label for="tags">Tags</label> <label for="tags" class="form-label">Tags</label>
<input type="text" id="tags" name="tags" class="form-control" <input type="text" id="tags" name="tags" class="form-control"
value="{% if tags %}{% for tag in tags %}{{ tag.tagname }} {% endfor %}{% endif %}" value="{% if tags %}{% for tag in tags %}{{ tag.tagname }} {% endfor %}{% endif %}"
placeholder="Trennen mit Leerzeichen oder Kommas"> placeholder="Separate with space or comma">
</div> </div>
<button type="submit" class="btn btn-success"> <button type="submit" class="btn btn-success">
<span class="fa fa-floppy-o"></span> <span class="fa fa-floppy-o"></span>
{% if image %} {% if image %}
Bild bearbeiten Edit image
{% else %} {% else %}
Bild hochladen Upload image
{% endif %} {% endif %}
</button> </button>
</form> </form>

View file

@ -1,17 +1,19 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% block content %} {% block content %}
<h1>Kommentarstream</h1> <h1>Comments</h1>
<ul class="list-unlisted">
<div class="container">
{% for comment in comments %} {% for comment in comments %}
<hr/> <hr/>
<li class="media mb-3"> <div class="row">
<div class="col-1">
<img src="https://robohash.org/{{ comment.author }}?size=40x40" class="d-flex mr-3"/> <img src="https://robohash.org/{{ comment.author }}?size=40x40" class="d-flex mr-3"/>
<div class="media-body"> </div>
<div class="col-11">
<i>{{ comment.created_at|parse-date|date:"dd-MM-yyyy HH:mm" }} Uhr</i> <i>{{ comment.created_at|parse-date|date:"dd-MM-yyyy HH:mm" }}</i>
von <strong>{{ comment.author }}</strong> from <strong>{{ comment.author }}</strong>
<br/> <br/>
<small><a href="/show/{{ comment.image_id }}#{{ comment.id }}"> <small><a href="/show/{{ comment.image_id }}#{{ comment.id }}">
{% if comment.title %} {% if comment.title %}
@ -25,8 +27,8 @@
{{ comment.comment|markdown-to-html|safe }} {{ comment.comment|markdown-to-html|safe }}
</div> </div>
</div> </div>
</li> </div>
{% endfor %} {% endfor %}
</ul> </div>
{% endblock %} {% endblock %}

View file

@ -2,20 +2,20 @@
{% block content %} {% block content %}
<div class="btn-group float-right clearfix" role="group"> <div class="btn-group pull-right clearfix" role="group">
{% if next-image %} {% if next-image %}
<a class="btn btn-secondary" href="/show/{{ next-image.id }}" id="next-image"> <a class="btn btn-secondary" href="/show/{{ next-image.id }}" id="next-image">
{% else %} {% else %}
<a class="btn btn-secondary disabled" href="#"> <a class="btn btn-secondary disabled" href="#">
{% endif %} {% endif %}
<span class="fa fa-arrow-left"></span> Neuer <span class="fa fa-arrow-left"></span> Newer
</a> </a>
<a class="btn btn-secondary" href="/"> <a class="btn btn-secondary" href="/">
<span class="fa fa-home"></span> <span class="fa fa-home"></span>
Gallerie Gallery
</a> </a>
{% if prev-image %} {% if prev-image %}
@ -24,7 +24,7 @@
<a class="btn btn-secondary disabled" href="#"> <a class="btn btn-secondary disabled" href="#">
{% endif %} {% endif %}
Älter <span class="fa fa-arrow-right"></span> Older <span class="fa fa-arrow-right"></span>
</a> </a>
</div> </div>
@ -47,60 +47,63 @@
<div id="detail-attributes"> <div id="detail-attributes">
{% ifequal identity ":creator" %} {% ifequal identity ":creator" %}
<div class="btn-group float-right clearfix" role="group"> <div class="btn-group pull-right clearfix" role="group">
<a class="btn btn-primary btn-sm" href="/edit/{{ image.id }}"> <a class="btn btn-primary btn-sm" href="/edit/{{ image.id }}">
<span class="fa fa-pencil"></span> <span class="fa fa-pencil"></span>
Bearbeiten Edit
</a> </a>
<a class="btn btn-danger btn-sm" href="/delete/{{ image.id }}"> <a class="btn btn-danger btn-sm" href="/delete/{{ image.id }}">
<span class="fa fa-trash"></span> <span class="fa fa-trash"></span>
Löschen Delete
</a> </a>
</div> </div>
{% endifequal %} {% endifequal %}
<p>{{ image.created_at|parse-date|date:"dd.MM.yyyy, HH:mm" }} Uhr</p> <p>{{ image.created_at|parse-date|date:"dd.MM.yyyy, HH:mm" }}</p>
{% if image.description|length > 0 %} {% if image.description|length > 0 %}
<div class="col-md7"> <div class="col-md7">
<p>{{ image.description|markdown-to-html|safe }}</p> <p>{{ image.description|markdown-to-html|safe }}</p>
</div> </div>
{% endif %} {% endif %}
<ul class="list-unlisted"> <div class="container">
{% for comment in comments %} {% for comment in comments %}
<li class="media mb-3">
<a name="{{ comment.id }}"></a> <a name="{{ comment.id }}"></a>
<div class="row">
<div class="col-1">
<img src="https://robohash.org/{{ comment.author }}?size=50x50" class="d-flex mr-3"/> <img src="https://robohash.org/{{ comment.author }}?size=50x50" class="d-flex mr-3"/>
<div class="media-body"> </div>
<div class="col-11">
<h5 class="mt-0 mb-1">{{ comment.author }}</h5> <h5 class="mt-0 mb-1">{{ comment.author }}</h5>
{% ifequal identity ":creator" %} {% ifequal identity ":creator" %}
<a class="btn btn-sm btn-danger" href="/delete-comment/{{ comment.id}}">Löschen</a> <a class="btn btn-sm btn-danger" href="/delete-comment/{{ comment.id}}">Delete</a>
{% endifequal %} {% endifequal %}
{{ comment.comment|markdown-to-html|safe }} {{ comment.comment|markdown-to-html|safe }}
</div> </div>
</li> </div>
{% endfor %} {% endfor %}
</ul> </div>
<form action="/add-comment/{{ image.id }}" method="POST" class="form-horizontal"> <form action="/add-comment/{{ image.id }}" method="POST" class="form-horizontal">
{% csrf-field %} {% csrf-field %}
<div class="form-group"> <div class="mb-3">
<label for="author">Name</label> <label for="author" class="form-label">Name</label>
<input type="text" name="author" class="form-control" <input type="text" name="author" class="form-control"
value="{{ saved-author }}" value="{{ saved-author }}"
placeholder="Bitte einen Namen wählen (wird beim nächsten Mal gespeichert)"> placeholder="Bitte einen Namen wählen (wird beim nächsten Mal gespeichert)">
</div> </div>
<div class="form-group"> <div class="mb-3">
<label for="comment">Kommentar</label> <label for="comment" class="form-label">Comment</label>
<textarea name="comment" class="form-control" rows="3" <textarea name="comment" class="form-control" rows="3"
placeholder="Es kann auch Markdown-Syntax verwendet werden"></textarea> placeholder="Es kann auch Markdown-Syntax verwendet werden"></textarea>
</div> </div>
<button type="submit" class="btn btn-success"> <button type="submit" class="btn btn-success">
<span class="fa fa-floppy-o"></span> <span class="fa fa-floppy-o"></span>
Kommentar hinzufügen Add Comment
</button> </button>
</form> </form>
</div> </div>

View file

@ -1,7 +1,7 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% block content %} {% block content %}
<h1><span class="text-danger">Fehler: {{status}}</span></h1> <h1><span class="text-danger">Error: {{status}}</span></h1>
<hr> <hr>
{% if title %} {% if title %}
<h2 class="without-margin">{{title}}</h2> <h2 class="without-margin">{{title}}</h2>

View file

@ -9,12 +9,16 @@
{% endif %} {% endif %}
</head> </head>
<body> <body>
<nav class="navbar navbar-expand-lg navbar-toggleable-md bg-dark navbar-dark"> <nav class="navbar navbar-expand-lg navbar-toggleable-md bg-dark navbar-dark">
<div class="container-fluid">
{% if identity %} {% if identity %}
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span> <span class="navbar-toggler-icon"></span>
</button> </button>
{% endif %} {% endif %}
<a class="navbar-brand" href="/"> <a class="navbar-brand" href="/">
<img src="/img/logo.png"> <img src="/img/logo.png">
yenu yenu
@ -27,20 +31,20 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/upload"> <a class="nav-link" href="/upload">
<span class="fa fa-upload"></span> <span class="fa fa-upload"></span>
Hochladen Upload
</a> </a>
</li> </li>
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/comments"> <a class="nav-link" href="/comments">
<span class="fa fa-comments"></span> <span class="fa fa-comments"></span>
Kommentarstream Comments
</a> </a>
</li> </li>
<!-- <!--
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/statistics"> <a class="nav-link" href="/statistics">
<span class="fa fa-bar-chart"></span> <span class="fa fa-bar-chart"></span>
Statistik Statistics
</a> </a>
</li> </li>
--> -->
@ -55,14 +59,16 @@
<li class="nav-item"> <li class="nav-item">
<a class="nav-link" href="/logout"> <a class="nav-link" href="/logout">
<span class="fa fa-sign-out"></span> <span class="fa fa-sign-out"></span>
Ausloggen Logout
</a> </a>
</li> </li>
{% endif %} {% endif %}
</ul>
</div>
</div> </div>
</nav> </nav>
<div id="content" class="col-md-12"> <div id="content" class="container col-md-12">
{% if flash.message %} {% if flash.message %}
<div class="alert alert-{{ flash.type }}" role="alert"> <div class="alert alert-{{ flash.type }}" role="alert">
{{ flash.message }} {{ flash.message }}
@ -73,10 +79,12 @@
{% endblock %} {% endblock %}
</div> </div>
<div class="col-md-12 text-right mt-4 mb-1 text-muted"> <div class="col-md-12mt-4 mb-1">
<hr> <hr>
<div class="container text-muted text-end">
<p>{{ footer }}</p> <p>{{ footer }}</p>
</div> </div>
</div>
{% style "/assets/bootstrap/css/bootstrap.min.css" %} {% style "/assets/bootstrap/css/bootstrap.min.css" %}
{% style "/assets/font-awesome/css/font-awesome.min.css" %} {% style "/assets/font-awesome/css/font-awesome.min.css" %}

View file

@ -6,13 +6,13 @@
<div class="col-lg-5 col-sm-12"> <div class="col-lg-5 col-sm-12">
<img src="/img/logo_big.png"> <img src="/img/logo_big.png">
<p>Um die Seite anzusehen oder die Aktion auszuführen wird ein Passwort benötigt.</p> <p>To access this area, you need a password.</p>
<form method="POST" class="form-horizontal"> <form method="POST" class="form-horizontal">
{% csrf-field %} {% csrf-field %}
<div class="form-group"> <div class="mb-3">
<label for="title">Passwort</label> <label for="title" class="form-label">Password</label>
<input type="password" name="password" class="form-control" autofocus> <input type="password" name="password" class="form-control" autofocus>
</div> </div>

View file

@ -1,6 +1,6 @@
{% extends "layout.html" %} {% extends "layout.html" %}
{% block content %} {% block content %}
<h1>Statistiken</h1> <h1>Stats</h1>
<img src="/img/warning_clojure.png"> <img src="/img/warning_clojure.png">
{% endblock %} {% endblock %}

View file

@ -5,11 +5,10 @@
[ring.util.anti-forgery :refer [anti-forgery-field]] [ring.util.anti-forgery :refer [anti-forgery-field]]
[yenu.helpers.images :as image-helper] [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]
[yenu.config :refer [env]] [yenu.config :refer [env]]
[yenu.db.core :as db] [yenu.db.core :as db]
[digest :as digest] [digest :as digest]
[clj-time.core :as time]) [java-time :refer [local-date-time]])
(:use [markdown.core])) (:use [markdown.core]))
(declare ^:dynamic *identity*) (declare ^:dynamic *identity*)
@ -19,7 +18,7 @@
(filter/add-filter! :inc inc) (filter/add-filter! :inc inc)
(filter/add-filter! :dec dec) (filter/add-filter! :dec dec)
(filter/add-filter! :markdown-to-html md-to-html-string) (filter/add-filter! :markdown-to-html md-to-html-string)
(filter/add-filter! :parse-date #(time/to-time-zone (time-format/parse %) (time/default-time-zone))) (filter/add-filter! :parse-date #(local-date-time "yyyy-MM-dd HH:mm:ss" %))
(defn footer [] (defn footer []
(if (= (:count (db/get-image-count)) 0) (if (= (:count (db/get-image-count)) 0)
@ -27,7 +26,7 @@
(let [first-year (subs (:created_at (db/get-first-year)) 0 4) (let [first-year (subs (:created_at (db/get-first-year)) 0 4)
recent-year (subs (:created_at (db/get-recent-year)) 0 4) recent-year (subs (:created_at (db/get-recent-year)) 0 4)
copy (if (= first-year recent-year) first-year (str first-year " - " recent-year))] copy (if (= first-year recent-year) first-year (str first-year " - " recent-year))]
(str "© " copy " " (clojure.string/join ", " (:authors env)))))) (str "© " copy " " (:authors env)))))
(defn render-file [template & [params]] (defn render-file [template & [params]]
(content-type (content-type

View file

@ -74,20 +74,20 @@
(do (do
(add-image-to-database imghash title description tags) (add-image-to-database imghash title description tags)
(-> (redirect "/upload") (-> (redirect "/upload")
(assoc :flash {:message "Upload erfolgreich." :type "success"}))) (assoc :flash {:message "Upload successfull" :type "success"})))
(-> (redirect "/upload") (-> (redirect "/upload")
(assoc :flash {:message "Fehler beim Upload." :type "danger"}))))) (assoc :flash {:message "Upload failed" :type "danger"})))))
(GET "/delete/:id" [id :as request] (GET "/delete/:id" [id :as request]
(delete-image! id request) (delete-image! id request)
(-> (redirect "/page/1") (-> (redirect "/page/1")
(assoc :flash {:message "Bild wurde gelöscht" :type "danger"}))) (assoc :flash {:message "Image deleted" :type "danger"})))
(GET "/delete-comment/:id" [id] (GET "/delete-comment/:id" [id]
(let [image-id (image-id-from-comment id)] (let [image-id (image-id-from-comment id)]
(db/delete-comment! {:id id}) (db/delete-comment! {:id id})
(-> (redirect (str "/show/" image-id)) (-> (redirect (str "/show/" image-id))
(assoc :flash {:message "Kommentar wurde gelöscht" :type "danger"})))) (assoc :flash {:message "Comment deleted" :type "danger"}))))
(GET "/edit/:id" [id :as request] (GET "/edit/:id" [id :as request]
(edit-image-form id request)) (edit-image-form id request))
@ -95,7 +95,7 @@
(POST "/edit/:id" [id title description tags :as request] (POST "/edit/:id" [id title description tags :as request]
(edit-image! id title description tags request) (edit-image! id title description tags request)
(-> (redirect (str "/show/" id)) (-> (redirect (str "/show/" id))
(assoc :flash {:message "Bild wurde bearbeitet" :type "success"}))) (assoc :flash {:message "Image edited" :type "success"})))
(GET "/statistics" [] (GET "/statistics" []
(layout/render-file "statistics.html")) (layout/render-file "statistics.html"))

View file

@ -17,15 +17,15 @@
(if user-identity (if user-identity
(let [updated-session (assoc session :identity user-identity)] (let [updated-session (assoc session :identity user-identity)]
(-> (redirect next-url) (-> (redirect next-url)
(assoc :flash {:message "Erfolgreich eingeloggt." :type "success"}) (assoc :flash {:message "Login successfull" :type "success"})
(assoc :session updated-session))) (assoc :session updated-session)))
(-> (redirect (format "/login?next=%s" next-url)) (-> (redirect (format "/login?next=%s" next-url))
(assoc :flash {:message "Falsches Passwort." :type "danger"}))))) (assoc :flash {:message "Wrong password" :type "danger"})))))
(defn logout! [request] (defn logout! [request]
(-> (redirect "/login") (-> (redirect "/login")
(assoc :session {}) (assoc :session {})
(assoc :flash {:message "Erfolgreich ausgeloggt." :type "success"}))) (assoc :flash {:message "Logout successfull" :type "success"})))
(defroutes auth-routes (defroutes auth-routes
(GET "/login" [:as request] (GET "/login" [:as request]

View file

@ -30,15 +30,15 @@
(if (< num 2) (if (< num 2)
"" ""
(h/html (h/html
[:nav.float-right.clearfix {:aria-label "Page navigation"} [:nav.pull-right.clearfix {:aria-label "Page navigation"}
[:ul.pagination.d-none.d-sm-none.d-xs-none.d-md-flex [:ul.pagination.d-none.d-sm-none.d-xs-none.d-md-flex
(page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Zurück")) (page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Prev"))
(cond (cond
(< num 13) (pagelist 1 num current) (< num 13) (pagelist 1 num current)
(<= current 7) (h/html (pagelist 1 10 current) (dots) (pagelist (- num 1) num current)) (<= current 7) (h/html (pagelist 1 10 current) (dots) (pagelist (- num 1) num current))
(>= current (- num 6)) (h/html (pagelist 1 2 current) (dots) (pagelist (- num 9) num current)) (>= current (- num 6)) (h/html (pagelist 1 2 current) (dots) (pagelist (- num 9) num current))
:else (h/html (pagelist 1 2 current) (dots) (pagelist (- current 3) (+ current 3) current) (dots) (pagelist (- num 1) num current))) :else (h/html (pagelist 1 2 current) (dots) (pagelist (- current 3) (+ current 3) current) (dots) (pagelist (- num 1) num current)))
(page (inc current) (= current num) "disabled" (h/html "Weiter " [:span.fa.fa-arrow-right]))]] (page (inc current) (= current num) "disabled" (h/html "Next " [:span.fa.fa-arrow-right]))]]
[:div.clearfix]))) [:div.clearfix])))
(defn pagination-mobile [num current] (defn pagination-mobile [num current]
@ -46,12 +46,12 @@
"" ""
(h/html (h/html
[:ul.pagination.justify-content-end.d-md-none [:ul.pagination.justify-content-end.d-md-none
(page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Zurück")) (page (dec current) (= current 1) "disabled" (h/html [:span.fa.fa-arrow-left] " Prev"))
[:form.form-inline [:form.form-inline
[:select#page-switcher.form-control [:select#page-switcher.form-control
(for [p (range 1 (inc num))] (for [p (range 1 (inc num))]
[:option (cond-> {:value p} (= p current) (assoc :selected "selected")) p])]] [:option (cond-> {:value p} (= p current) (assoc :selected "selected")) p])]]
(page (inc current) (= current num) "disabled" (h/html "Weiter " [:span.fa.fa-arrow-right]))]))) (page (inc current) (= current num) "disabled" (h/html "Next " [:span.fa.fa-arrow-right]))])))
(defn index-page [current request] (defn index-page [current request]
(let [image-count (:images-per-page env) (let [image-count (:images-per-page env)
@ -90,8 +90,8 @@
:comment comment})) :comment comment}))
(-> (redirect (str "/show/" image-id)) (-> (redirect (str "/show/" image-id))
(assoc :flash (if (not= comment "") (assoc :flash (if (not= comment "")
{:message "Danke für deinen Kommentar" :type "success"} {:message "Thank you for your comment." :type "success"}
{:message "Der kommentar war leider leer." :type "danger"})) {:message "The comment was empty." :type "danger"}))
(assoc-in [:cookies "author"] (assoc-in [:cookies "author"]
{:value author {:value author
:path "/" :path "/"

View file

@ -63,7 +63,7 @@
<p>This tool is written in <a href="https://clojure.org/">Clojure</a> by <a href="https://aaron-fischer.net/">Aaron Fischer</a>. It is free to use <p>This tool is written in <a href="https://clojure.org/">Clojure</a> by <a href="https://aaron-fischer.net/">Aaron Fischer</a>. It is free to use
and is placed under and is placed under
the <a href="https://www.gnu.org/licenses/gpl-3.0.en.html">GPL v.3</a>. You the <a href="https://www.gnu.org/licenses/gpl-3.0.en.html">GPL v.3</a>. You
can inspect and download the sourcecode <a href="http://git.datenhalter.de/aaron/yenu">here</a>. The images, can inspect and download the sourcecode <a href="https://git.okoyono.de/f/yenu">here</a>. The images,
comments and other metadata belongs to you. Make sure, you store the data on comments and other metadata belongs to you. Make sure, you store the data on
a place you trust and make backups.</p> a place you trust and make backups.</p>