    qualified URL."
   [str]
   (remote/make-url (replace str #"/api/v1" "")))
+
+(defn- build-caption
+  [item]
+  (let [datetime (.-date item)
+        date (-> datetime js/moment (.format "MMM D, YYYY"))
+        time (-> datetime js/moment (.format "h:mm A"))]
+    (format "%s <br/><small>Submitted at %s on %s <br/>Record ID: %s </small>"
+            (.-title item) time date (.-id item))))
 
 ;;; We use strings for some keywords below because keywords are forced to
 ;;; lower-case.

(defn- build-photos
  "Build photos for photoswipe from a set of form data."
  [data]
  (flatten
   (for [datum data
         :let [attachments (get datum constants/_attachments)]
         :when (seq attachments)]
     (for [attachment attachments
           :let [rank (get datum constants/_rank)]]
       {:src (resize-image
              (make-url (get attachment constants/download-url))
              width-px
              width-px)
        :thumb (make-url (get attachment constants/small-download-url))
        :title (format "Submission %s" rank)
        :date (get datum constants/_submission_time)
        :id (get datum constants/_id)
        :rank rank
        :w width-px
        :h width-px}))))

(defn- build-photo-gallery
  "Build markup with actions for a photo gallery."

                 "addCaptionHTMLFn"
                 (fn [item caption-el is-fake]
                   (set! (-> caption-el .-children first .-innerHTML)
                         (build-caption item)))}
        gallery (js/PhotoSwipe. pswp-element
                                js/PhotoSwipeUI_Default
                                (clj->js photos)
