diff options
author | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-12-11 21:00:40 +0100 |
---|---|---|
committer | Matthias Benkard <code@mail.matthias.benkard.de> | 2008-12-11 21:00:40 +0100 |
commit | f4124b2e828d340e01c686419b95cbf89a34151b (patch) | |
tree | 6f9fc7a4872323575366b85ea787c14afd435597 | |
parent | ad5dcc5423c50fabcf8af8bdedbab71b27038b44 (diff) |
Only show the most recent entries in full on the main page, add a complete table of all entries at the bottom.
darcs-hash:c67b0affeccbbcc24c70c7836795884c52f4a560
-rw-r--r-- | journal.css | 22 | ||||
-rwxr-xr-x | journal.lisp | 211 |
2 files changed, 137 insertions, 96 deletions
diff --git a/journal.css b/journal.css index 8737624..98fff40 100644 --- a/journal.css +++ b/journal.css @@ -125,3 +125,25 @@ img.JOURNAL-ENTRY-PORTRAIT { padding: 0 0.3em 0 0.3em; text-align: justify; } + +div.OLD-ENTRIES { + border: 3px outset #666; + color: #000; + background-color: #e8e8e8; + margin: 1em 0 0 0; + padding: 0 0.3em 0 0.3em; + text-align: justify; +} + +table.OLD-ENTRY-TABLE { + border-spacing: 0; + border-collapse: collapse; + margin: 0 0 0.3em 0; +} + +table.OLD-ENTRY-TABLE td { + padding: 0.2em 0.4em 0.2em 0.4em; + vertical-align: top; + border: 1px solid #aaa; + margin: 0 0 0 0; +} diff --git a/journal.lisp b/journal.lisp index 164d672..a7d7ae7 100755 --- a/journal.lisp +++ b/journal.lisp @@ -37,6 +37,7 @@ #'(lambda (&rest args) (apply #'format out args)) (case action (:index "") + (:full-index "/?full") (:view-atom-feed (values "/feed")) (:view (if post-id (values "/~D" post-id) @@ -139,23 +140,20 @@ (defun show-journal-entry-with-components (id title body categories posting-date comments comments-p) - (<:div :class :journal-entry - (unless *full-entry-view* - (<:h2 :style "display: inline; border: none;" - (<:a :href (link-to :view :post-id id) - (<:as-html title))) - (<:div :style "display: inline; text-align: right; padding: 0 3em 0 3em;" - (<:a :href (link-to :view :post-id id) - (<:as-is - (format nil "(~D Kommentar~:*~[e~;~:;e~])" (length comments))))) - (<:div :class :journal-entry-date - (<:as-html - (format-date nil " %day.%mon.%yr, %hr:%2min " - posting-date)))) - (when *full-entry-view* + (unless *full-entry-view* + (<:tr + (<:td (<:a :href (link-to :view :post-id id) + (<:as-html title))) + (<:td :style "text-align: right" + (<:as-is (format-date nil "%day.%mon.%yr, %hr:%2min" posting-date))) + (<:td (<:a :href (link-to :view :post-id id) + (<:as-is + (format nil "~D Kommentar~:*~[e~;~:;e~]" (length comments))))))) + + (when *full-entry-view* + (<:div :class :journal-entry (<:h2 (<:a :href (link-to :view :post-id id) - (<:as-html title)))) - (when *full-entry-view* + (<:as-html title))) (<:div :class :journal-entry-header (<:span :class :journal-entry-date (<:as-html @@ -164,11 +162,9 @@ (unless (null categories) (<:span :class :journal-entry-category (<:as-html - (format nil "Abgeheftet unter ...")))))) - (when *full-entry-view* + (format nil "Abgeheftet unter ..."))))) (<:div :class :journal-entry-body - (<:as-is (journal-markup->html body)))) - (when *full-entry-view* + (<:as-is (journal-markup->html body))) (<:div :class :journal-entry-footer (<:form :class :journal-entry-delete-button-form :style "display: inline;" @@ -197,77 +193,77 @@ " | " (<:a :href (link-to :view :post-id id) (<:as-is - (format nil "~D Kommentar~:*~[e~;~:;e~]" (length comments))))))) + (format nil "~D Kommentar~:*~[e~;~:;e~]" (length comments)))))) - (when (and *full-entry-view* comments-p (not (null comments))) - (<:div :class :journal-comments - (<:h2 "Kommentare") - (dolist (comment comments) - (with-slots (author body date id email website) - comment - (<:div :class :journal-comment - (<:div :class :journal-comment-header - (<:as-html (format nil "(~A) " - (format-date nil "%day.%mon.%yr, %hr:%min" date))) - (<:a :href website :rel "nofollow" - (<:as-html (format nil "~A" author))) - (<:as-html " meint: ")) - (<:div :class :journal-comment-body - (<:as-html (render-comment-body body)))))))) + (when (and comments-p (not (null comments))) + (<:div :class :journal-comments + (<:h2 "Kommentare") + (dolist (comment comments) + (with-slots (author body date id email website) + comment + (<:div :class :journal-comment + (<:div :class :journal-comment-header + (<:as-html (format nil "(~A) " + (format-date nil "%day.%mon.%yr, %hr:%min" date))) + (<:a :href website :rel "nofollow" + (<:as-html (format nil "~A" author))) + (<:as-html " meint: ")) + (<:div :class :journal-comment-body + (<:as-html (render-comment-body body)))))))) - (when (and *full-entry-view* comments-p) - (<:div :class :journal-new-comment - (<:h2 "Neuen Kommentar schreiben") - (<:p (<:as-is "Bitte beachten Sie, daß E-Mail-Adressen niemals - veröffentlicht werden und nur von Matthias eingesehen - werden können.")) - (<:p (<:strong "Hinweise: ") - "Diese Website verwendet " - (<:a :href "http://akismet.com/" "Akismet") - " zur Spamerkennung. " - (<:as-is "E-Mail-Adressen werden auch gegenüber Akismet - unter Verschluß gehalten. Nur unformatierter - Text ist erlaubt. Leerzeilen trennen - Absätze.")) - (<:form :action (link-to :view :post-id id) - :method "post" - :accept-charset #+(or) "ISO-10646-UTF-1" - "UTF-8" - :enctype #+(or) "multipart/form-data" - "application/x-www-form-urlencoded" - (<:div :style "display: none" - (<:input :type "hidden" - :name "id" - :value (prin1-to-string id)) - (<:input :type "hidden" - :name "action" - :value "post-comment")) - (<:div :style "display: table" - (loop for (name . desc) in '(("author" . "Name (nötig)") - ("email" . "E-Mail") - ("website" . "Website")) - do (<:div :style "display: table-row" - (<:div :style "display: table-cell; vertical-align: top" - (<:label :for name - :style "vertical-align: top" - (<:as-is (format nil "~A: " desc)))) - (<:div :style "display: table-cell;" - (<:input :type "text" - :name name - :id name)))) - (<:div :style "display: table-row" - (<:div :style "display: table-cell; vertical-align: top" - (<:label :for "comment-body" - :style "vertical-align: top" - (<:as-html "Kommentar: "))) - (<:div :style "display: table-cell" - (<:textarea :name "comment-body" - :id "comment-body" - :rows 10 - :cols 40)))) - (<:div - (<:button :type "submit" - (<:as-is "Veröffentlichen"))))))) + (when comments-p + (<:div :class :journal-new-comment + (<:h2 "Neuen Kommentar schreiben") + (<:p (<:as-is "Bitte beachten Sie, daß E-Mail-Adressen niemals + veröffentlicht werden und nur von Matthias eingesehen + werden können.")) + (<:p (<:strong "Hinweise: ") + "Diese Website verwendet " + (<:a :href "http://akismet.com/" "Akismet") + " zur Spamerkennung. " + (<:as-is "E-Mail-Adressen werden auch gegenüber Akismet + unter Verschluß gehalten. Nur unformatierter + Text ist erlaubt. Leerzeilen trennen + Absätze.")) + (<:form :action (link-to :view :post-id id) + :method "post" + :accept-charset #+(or) "ISO-10646-UTF-1" + "UTF-8" + :enctype #+(or) "multipart/form-data" + "application/x-www-form-urlencoded" + (<:div :style "display: none" + (<:input :type "hidden" + :name "id" + :value (prin1-to-string id)) + (<:input :type "hidden" + :name "action" + :value "post-comment")) + (<:div :style "display: table" + (loop for (name . desc) in '(("author" . "Name (nötig)") + ("email" . "E-Mail") + ("website" . "Website")) + do (<:div :style "display: table-row" + (<:div :style "display: table-cell; vertical-align: top" + (<:label :for name + :style "vertical-align: top" + (<:as-is (format nil "~A: " desc)))) + (<:div :style "display: table-cell;" + (<:input :type "text" + :name name + :id name)))) + (<:div :style "display: table-row" + (<:div :style "display: table-cell; vertical-align: top" + (<:label :for "comment-body" + :style "vertical-align: top" + (<:as-html "Kommentar: "))) + (<:div :style "display: table-cell" + (<:textarea :name "comment-body" + :id "comment-body" + :rows 10 + :cols 40)))) + (<:div + (<:button :type "submit" + (<:as-is "Veröffentlichen")))))))) (defun call-with-web-journal (page-title thunk) @@ -342,13 +338,36 @@ nil)) (case *action* ((:index nil) - (let ((number 0)) - (dolist (entry (select 'journal-entry - :order-by '(([date] :desc)) - :flatp t)) - (incf number) - (let ((*full-entry-view* (< number 5))) - (show-journal-entry entry))))) + (let ((entries (select 'journal-entry + :order-by '(([date] :desc)) + :flatp t)) + (full-journal-view (or (equal (getf *query* :|| nil) "full") + (and (listp (getf *query* :|| nil)) + (member "full" + (getf *query* :|| nil) + :test #'equal))))) + (dolist (entry (if full-journal-view + entries + (subseq entries 0 5))) + (let ((*full-entry-view* t)) + (show-journal-entry entry))) + (unless full-journal-view + (<:div :class :old-entries + (<:h2 (<:as-is "Ältere Einträge")) + (<:p + (<:a :href (link-to :full-index) + (<:as-is "Alle Einträge vollständig anzeigen (langsam!)."))) + (<:table :class :old-entry-table + (<:caption (<:as-is "Einträge nach Datum")) + (<:thead + (<:tr + (<:th (<:as-is "Titel")) + (<:th (<:as-is "Datum")) + (<:th (<:as-is "Kommentare")))) + (<:tbody + (dolist (entry entries) + (let ((*full-entry-view* nil)) + (show-journal-entry entry))))))))) ((:view :post-comment :save-entry) (show-journal-entry (find-entry *post-number*) :comments-p t)))) #.(restore-sql-reader-syntax-state)) |