finally fix the archive post list sorting bug
This commit is contained in:
parent
71d62355d2
commit
682ba6905e
|
@ -7,16 +7,16 @@
|
|||
</div>
|
||||
|
||||
<div>
|
||||
{% for month in months %}
|
||||
{% for post in month %}
|
||||
{% if loop.first %}
|
||||
<h3>{{ post.mmyyyy }}</h3>
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
<div class="span2 muted text-right"><time title="{{ post.created_at|to_fulltime }}">{{ post.created_at|to_month_day }}</time></div>
|
||||
<div class="span9"><a href="{{ path(post|post_url) }}">{{ post.title }}</a></div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% set mmyyyy = '' %}
|
||||
{% for post in posts %}
|
||||
{% if (mmyyyy != post.mmyyyy) %}
|
||||
{% set mmyyyy = post.mmyyyy %}
|
||||
<h3>{{ post.mmyyyy }}</h3>
|
||||
{% endif %}
|
||||
<div class="row">
|
||||
<div class="span2 muted text-right"><time title="{{ post.created_at|to_fulltime }}">{{ post.created_at|to_month_day }}</time></div>
|
||||
<div class="span9"><a href="{{ path(post|post_url) }}">{{ post.title }}</a></div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
</div>
|
||||
|
||||
|
|
|
@ -96,10 +96,9 @@
|
|||
(if-let [posts (->post-list
|
||||
(couch/with-db posts
|
||||
(couch/get-view "posts" view-name {:descending true})))]
|
||||
(->> posts
|
||||
(map #(assoc % :mmyyyy (->nicer-month-year-str (:mmyyyy %))))
|
||||
(group-by #(:mmyyyy %))
|
||||
(vals)))))
|
||||
(map
|
||||
#(assoc % :mmyyyy (->nicer-month-year-str (:mmyyyy %)))
|
||||
posts))))
|
||||
|
||||
(defn count-posts
|
||||
[unpublished?]
|
||||
|
|
|
@ -59,7 +59,7 @@
|
|||
(defn list-archive []
|
||||
(layout/render
|
||||
"posts/listarchive.html"
|
||||
:params {:months (posts/list-posts-archive (auth/logged-in?))}))
|
||||
:params {:posts (posts/list-posts-archive (auth/logged-in?))}))
|
||||
|
||||
(defn show-post-page [year month day slug]
|
||||
(let [date (str (string->int year) "-" (string->int month) "-" (string->int day))
|
||||
|
|
Reference in a new issue