[bknr-cvs] hans changed trunk/projects/quickhoney/

BKNR Commits bknr at bknr.net
Wed Sep 10 20:23:31 UTC 2008


Revision: 3887
Author: hans
URL: http://bknr.net/trac/changeset/3887

More deep link page display tweaks

U   trunk/projects/quickhoney/src/tags.lisp
U   trunk/projects/quickhoney/website/static/index.css
U   trunk/projects/quickhoney/website/static/javascript.js
U   trunk/projects/quickhoney/website/templates/index.xml

Modified: trunk/projects/quickhoney/src/tags.lisp
===================================================================
--- trunk/projects/quickhoney/src/tags.lisp	2008-09-10 16:32:48 UTC (rev 3886)
+++ trunk/projects/quickhoney/src/tags.lisp	2008-09-10 20:23:30 UTC (rev 3887)
@@ -27,6 +27,14 @@
            (html ((:div :class "next")
                   ((:a :href next) ">>")))))))
 
+(defmacro with-navigation ((&key previous up next) &body body)
+  `(prog1
+       (html ((:div :id "html-content-foo")
+              (navigation :previous ,previous :up ,up :next ,next)
+              , at body))
+     (html ((:script :type "text/javascript")
+            "document.getElementById('html-content-foo').style.visibility = 'hidden'"))))
+
 (define-bknr-tag simple-image-browser ()
   (tbnl:handle-if-modified-since (last-image-upload-timestamp))
   (destructuring-bind (&optional category subcategory image-name)
@@ -41,56 +49,57 @@
                               when (equal image (cadr rest))
                               do (return (car rest))))
               (next (cadr (member image images-in-category))))
-         (navigation :previous (and previous (image-url previous))
-                     :up (format nil "/~(~A/~A~)"
-                                 (quickhoney-image-category image)
-                                 (quickhoney-image-subcategory image))
-                     :next (and next (image-url next)))
+         (with-navigation (:previous (and previous (image-url previous))
+                           :up (format nil "/~(~A/~A~)"
+                                       (quickhoney-image-category image)
+                                       (quickhoney-image-subcategory image))
+                           :next (and next (image-url next)))
+           (html
+            (:h1 (:princ #?"$(category) / $(subcategory)"))
+            ((:img :src #?"/image/$(image-name)"
+                   :class "image"
+                   :alt ""
+                   :width (bknr.images:store-image-width image)
+                   :height (bknr.images:store-image-height image)))
+            ((:div :class "metadata" :style #?"height: $((bknr.images:store-image-height image))px")
+             (:table
+              (:tbody
+               (:tr (:th "name")
+                    (:td (:princ image-name)))
+               (:tr (:th "artist")
+                    (:td (:princ (bknr.user:user-full-name (or (bknr.user:owned-object-owner image)
+                                                               (bknr.user:find-user "hans"))))
+                         ", QuickHoney"))
+               (:tr (:th "date")
+                    (:td (:princ (format-date-time (bknr.datastore:blob-timestamp image) :vms-style t :show-time nil))))
+               (when (and (quickhoney-image-client image)
+                          (not (equal "" (quickhoney-image-client image))))
+                 (html (:tr (:th "client")
+                            (:td (:princ (quickhoney-image-client image))))))
+               (when (quickhoney-image-spider-keywords image)
+                 (html (:tr (:th "keywords")
+                          (:td (:princ (quickhoney-image-spider-keywords image)))))))))))))
+      (subcategory
+       (with-navigation (:up (format nil "/~(~A~)" category))
          (html
           (:h1 (:princ #?"$(category) / $(subcategory)"))
-          ((:img :src #?"/image/$(image-name)"
-                 :class "image"
-                 :alt ""
-                 :width (bknr.images:store-image-width image)
-                 :height (bknr.images:store-image-height image)))
-          ((:div :class "metadata" :style #?"height: $((bknr.images:store-image-height image))px")
-           (:table
-            (:tbody
-             (:tr (:th "name")
-                  (:td (:princ image-name)))
-             (:tr (:th "artist")
-                  (:td (:princ (bknr.user:user-full-name (or (bknr.user:owned-object-owner image)
-                                                             (bknr.user:find-user "hans"))))
-                       ", QuickHoney"))
-             (:tr (:th "date")
-                  (:td (:princ (format-date-time (bknr.datastore:blob-timestamp image) :vms-style t :show-time nil))))
-             (when (and (quickhoney-image-client image)
-                        (not (equal "" (quickhoney-image-client image))))
-               (html (:tr (:th "client")
-                          (:td (:princ (quickhoney-image-client image))))))
-             (when (quickhoney-image-spider-keywords image)
-               (html (:tr (:th "keywords")
-                          (:td (:princ (quickhoney-image-spider-keywords image))))))))))))
-      (subcategory
-       (navigation :up (format nil "/~(~A~)" category))
-       (html
-        (:h1 (:princ #?"$(category) / $(subcategory)"))
-        (:ul
-         (dolist (image (sort (copy-list (quickhoney:images-in-category (mapcar #'make-keyword-from-string (list category subcategory))))
-                              #'>
-                              :key #'bknr.datastore:blob-timestamp))
-           (html
-            (:li ((:a :href #?"/$(category)/$(subcategory)/$((bknr.images:store-image-name image))")
-                  (:princ (bknr.images:store-image-name image)))))))))
+          (:ul
+           (dolist (image (sort (copy-list (quickhoney:images-in-category
+                                            (mapcar #'make-keyword-from-string (list category subcategory))))
+                                #'>
+                                :key #'bknr.datastore:blob-timestamp))
+             (html
+              (:li ((:a :href #?"/$(category)/$(subcategory)/$((bknr.images:store-image-name image))")
+                    (:princ (bknr.images:store-image-name image))))))))))
       (category
-       (navigation :up "/")
-       (html
-        (:h1 (:princ category))
-        (:ul
-         (dolist (subcategory (subcategories-of (make-keyword-from-string category)))
-           (html
-            (:li ((:a :href (format nil "/~A/~(~A~)" category subcategory)))
-                 (:princ subcategory)))))))
+       (with-navigation (:up "/")
+         (html
+          (:h1 (:princ category))
+          (:ul
+           (dolist (subcategory (subcategories-of (make-keyword-from-string category)))
+             (html
+              (:li ((:a :href (format nil "/~A/~(~A~)" category subcategory)))
+                   (:princ subcategory))))))))
       (t
        (emit-tag-children)))))
 

Modified: trunk/projects/quickhoney/website/static/index.css
===================================================================
--- trunk/projects/quickhoney/website/static/index.css	2008-09-10 16:32:48 UTC (rev 3886)
+++ trunk/projects/quickhoney/website/static/index.css	2008-09-10 20:23:30 UTC (rev 3887)
@@ -317,6 +317,7 @@
 	width: 648px;
         margin-top: 36px;
 	text-align: center;
+        visibility: hidden;
 }
 
 /* cue bar */

Modified: trunk/projects/quickhoney/website/static/javascript.js
===================================================================
--- trunk/projects/quickhoney/website/static/javascript.js	2008-09-10 16:32:48 UTC (rev 3886)
+++ trunk/projects/quickhoney/website/static/javascript.js	2008-09-10 20:23:30 UTC (rev 3887)
@@ -21,6 +21,7 @@
 /* logged_in - will be set when the user has CMS access */
 
 var logged_in;
+var application_initialized = false;
 
 /* current colors */
 
@@ -435,7 +436,9 @@
 
 function hide_cue() {
     $("cue").style.visibility = 'hidden';
-    $('footer').style.visibility = 'inherit';
+    if (application_initialized) {
+        $('footer').style.visibility = 'inherit';
+    }
 }
 
 var db_cache = {};
@@ -479,7 +482,7 @@
         process_query_result(key, db_cache[key]);
 
     } else {
-	show_cue();
+        show_cue();
 	loadJSONDoc("/json-image-query/" + key)
             .addCallbacks(partial(process_query_result, key), alert);
     }
@@ -1152,6 +1155,8 @@
     document.location.href = "/#" + path;
 
     poll_path();
+
+    application_initialized = true;
 }
 
 function button_images_loaded() {

Modified: trunk/projects/quickhoney/website/templates/index.xml
===================================================================
--- trunk/projects/quickhoney/website/templates/index.xml	2008-09-10 16:32:48 UTC (rev 3886)
+++ trunk/projects/quickhoney/website/templates/index.xml	2008-09-10 20:23:30 UTC (rev 3887)
@@ -4,8 +4,7 @@
 <html
    xmlns="http://www.w3.org/1999/xhtml"
    xmlns:bknr="http://bknr.net/"
-   xmlns:quickhoney="http://quickhoney.com/"
-   >
+   xmlns:quickhoney="http://quickhoney.com/">
   <head>
     <link rel="stylesheet" href="/static/yui/reset-fonts/reset-fonts.css" />
     <link rel="stylesheet" href="/static/quickhoney.css" />




More information about the Bknr-cvs mailing list