Browse Source

implement insert-dashboard-cat filter (view.lisp).

This filter is builds the path for the dashboard profile image. The
path points to a different icon in the /images/icons directory
depending on what time and day it is.

There is no major functionality addition with this code. It just a
little sprinkle of cuteness for the user of the site.
stable
Craig Oates 2 years ago
parent
commit
130a6d3061
  1. 31
      src/view.lisp

31
src/view.lisp

@ -93,3 +93,34 @@
(if (storage:file-exists-p "" "snippets" snippet-name)
(format nil "~a" (storage:open-text-file "" "snippets" snippet-name))
(format nil "<!-- ~a not found -->" snippet-name)))
(defun insert-dashboard-cat ()
(let ((timestamp (local-time:now)))
(cond ((and (> (local-time:timestamp-hour timestamp) 6)
(<= (local-time:timestamp-hour timestamp) 10))
(format nil "/images/icons/morning-cat.png"))
((and (> (local-time:timestamp-hour timestamp) 10)
(<= (local-time:timestamp-hour timestamp)) 12)
(format nil "/images/icons/coffee-cat.png"))
((and (> (local-time:timestamp-hour timestamp) 12)
(<= (local-time:timestamp-hour timestamp) 14))
(format nil "/images/icons/dinner-cat.png"))
((and (> (local-time:timestamp-hour timestamp) 14)
(<= (local-time:timestamp-hour timestamp) 18))
(format nil "/images/icons/study-cat.png"))
((and (> (local-time:timestamp-hour timestamp) 18)
(<= (local-time:timestamp-hour timestamp) 20))
(cond ((>= (local-time:timestamp-day-of-week timestamp) 5)
(format nil "/images/icons/workout-cat.png"))
((= (local-time:timestamp-day-of-week timestamp) 6)
(format nil "/images/icons/rock-star-cat.png"))
((= (local-time:timestamp-day-of-week timestamp) 7)
(format nil "/images/icons/love-cat.png"))))
((and (> (local-time:timestamp-hour timestamp) 20)
(<= (local-time:timestamp-hour timestamp) 22))
(format nil "/images/icons/dinner-cat.png"))
((and (> (local-time:timestamp-hour timestamp) 22)
(<= (local-time:timestamp-hour timestamp) 24))
(format nil "/images/icons/bed-time-cat.png"))
(t (format nil "/images/icons/default-cat.png")))))

Loading…
Cancel
Save