Add timezone, image description, code cleanup, ... #18

This commit is contained in:
Aaron Fischer 2017-04-18 23:14:16 +02:00
parent 855dac7e1a
commit 7429e12dbe
6 changed files with 40 additions and 46 deletions

View file

@ -1,4 +1,4 @@
(defproject yenu "0.1.0-SNAPSHOT"
(defproject yenu "1.0.1"
:description "yenu -- The image sharing tool for friends"
:url "https://yenu.de/"

View file

@ -6,25 +6,25 @@
{% if next-image %}
<a class="btn btn-secondary" href="/show/{{ next-image.id }}">
{% else %}
<a class="btn btn-secondary disabled" href="#">
{% endif %}
<span class="fa fa-arrow-left"></span>
Neuer
</a>
<a class="btn btn-secondary disabled" href="#">
{% endif %}
<span class="fa fa-arrow-left"></span>
Neuer
</a>
<a class="btn btn-secondary" href="/">
<span class="fa fa-home"></span>
Gallerie
</a>
<a class="btn btn-secondary" href="/">
<span class="fa fa-home"></span>
Gallerie
</a>
{% if prev-image %}
<a class="btn btn-secondary" href="/show/{{ prev-image.id }}">
{% else %}
<a class="btn btn-secondary disabled" href="#">
{% endif %}
Älter
<span class="fa fa-arrow-right"></span>
</a>
{% if prev-image %}
<a class="btn btn-secondary" href="/show/{{ prev-image.id }}">
{% else %}
<a class="btn btn-secondary disabled" href="#">
{% endif %}
Älter
<span class="fa fa-arrow-right"></span>
</a>
</div>
<div class="pull-left clearfix">
@ -38,13 +38,11 @@
<div class="clearfix"></div>
<hr>
<div class="detail-image">
<div class="detail-image mb-3">
<a href="/images/raw/{{ image.hash }}">
<img class="card-img-top" src="/images/normal/{{ image.hash }}" alt="{{ image.title }}"/>
</a>
</div>
<hr>
{% ifequal identity ":creator" %}
<div class="btn-group pull-right clearfix" role="group">
<a class="btn btn-primary btn-sm" href="/edit/{{ image.id }}">
@ -58,7 +56,7 @@
</div>
{% 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" }} Uhr</p>
{% if image.description|length > 0 %}
<div class="col-md7">
<p>{{ image.description|markdown-to-html|safe }}</p>
@ -84,23 +82,23 @@
<form action="/add-comment/{{ image.id }}" method="POST" class="form-horizontal">
{% csrf-field %}
<div class="form-group">
<label for="author">Name</label>
<input type="text" name="author" class="form-control"
value="{{ saved-author }}"
placeholder="Bitte einen Namen wählen (wird beim nächsten Mal gespeichert)">
</div>
<div class="form-group">
<label for="author">Name</label>
<input type="text" name="author" class="form-control"
value="{{ saved-author }}"
placeholder="Bitte einen Namen wählen (wird beim nächsten Mal gespeichert)">
</div>
<div class="form-group">
<label for="comment">Kommentar</label>
<textarea name="comment" class="form-control" rows="3"
placeholder="Es kann auch Markdown-Syntax verwendet werden"></textarea>
</div>
<div class="form-group">
<label for="comment">Kommentar</label>
<textarea name="comment" class="form-control" rows="3"
placeholder="Es kann auch Markdown-Syntax verwendet werden"></textarea>
</div>
<button type="submit" class="btn btn-success">
<span class="fa fa-floppy-o"></span>
Kommentar hinzufügen
</button>
<button type="submit" class="btn btn-success">
<span class="fa fa-floppy-o"></span>
Kommentar hinzufügen
</button>
</form>
{% endblock %}

View file

@ -1,17 +1,14 @@
{% extends "layout.html" %}
{% block content %}
{% safe %}{{ pagination }}{% endsafe %}
{% safe %}{{ pagination-mobile }}{% endsafe %}
<div class="clearfix d-flex justify-content-center flex-wrap">
{% for image in images %}
<a href="/show/{{ image.id }}" class="thumbnail-image">
<a href="/show/{{ image.id }}" class="thumbnail-image" title="{{ image.title }}">
<img src="/images/thumbnails/{{ image.hash }}" alt="{{ image.title }}">
</a>
{% endfor %}
</div>
{% endblock %}

View file

@ -6,7 +6,6 @@
<title>yenu -- the image sharing tool for friends</title>
</head>
<body>
<nav class="navbar navbar-toggleable-md bg-inverse navbar-inverse">
{% if identity %}
<button class="navbar-toggler navbar-toggler-right" type="button" data-toggle="collapse" data-target="#navbarSupportedContent" aria-controls="navbarSupportedContent" aria-expanded="false" aria-label="Toggle navigation">
@ -64,7 +63,7 @@
{% endblock %}
</div>
<div class="col-md-12 text-right mt-4 mb-1">
<div class="col-md-12 text-right mt-4 mb-1 text-muted">
<hr>
<p>© 2013 - {% now yyyy %} Aaron & Beatrice Fischer</p>
</div>

View file

@ -1,7 +1,6 @@
{% extends "layout.html" %}
{% block content %}
<div class="container mt-5">
<div class="row justify-content-md-center">
<div class="col-lg-5 col-sm-12">

View file

@ -5,7 +5,8 @@
[ring.util.anti-forgery :refer [anti-forgery-field]]
[yenu.helpers.images :as image-helper]
[ring.middleware.anti-forgery :refer [*anti-forgery-token*]]
[clj-time.format :as time-format])
[clj-time.format :as time-format]
[clj-time.core :as time])
(:use [markdown.core]))
(declare ^:dynamic *identity*)
@ -15,7 +16,7 @@
(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)
(filter/add-filter! :parse-date #(time/to-time-zone (time-format/parse %) (time/default-time-zone)))
(defn render
"renders the HTML template located relative to resources/templates"