Navigation Menu

Skip to content

Commit

Permalink
reenable breadcrumbs
Browse files Browse the repository at this point in the history
  • Loading branch information
stuarthalloway committed Sep 27, 2010
1 parent 7292001 commit 63194bd
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 11 deletions.
18 changes: 9 additions & 9 deletions src/mycroft/breadcrumb.clj
Expand Up @@ -29,24 +29,24 @@
(get {:mycroft.data/deref "@" :mycroft.data/meta "<meta>"} selector-component selector-component)) (get {:mycroft.data/deref "@" :mycroft.data/meta "<meta>"} selector-component selector-component))


(defn render (defn render
[ns var {:keys [selector]}] [ns var {:keys [selectors]}]
[:div {:id "breadcrumb"} [:div {:id "breadcrumb"}
(if ns (top-link) "ns") (if ns (top-link) "ns")
(when ns (when ns
[:span " « " [:span " « "
(if var (namespace-link ns) ns)]) (if var (namespace-link ns) ns)])
(when var (when var
[:span " / " [:span " / "
(if selector (var-link (.ns var) (.sym var)) (.sym var))]) (if selectors (var-link (.ns var) (.sym var)) (.sym var))])


(when selector (when selectors
(let [first-crumb (if (= ::deref (first selector)) 2 1)] (let [first-crumb (if (= ::deref (first selectors)) 2 1)]
[:span [:span
(->> (map (fn [n] (subvec selector 0 n)) (range first-crumb (count selector))) (->> (map (fn [n] (subvec selectors 0 n)) (range first-crumb (count selectors)))
(map (fn [partial-selector] (map (fn [partial-selectors]
[:span [:span
" » " " » "
[:a {:href (str "?" (options->query-string {:selectors partial-selector}))} [:a {:href (str "?" (options->query-string {:selectors partial-selectors}))}
(breadcrumb-text (last partial-selector)) ]]))) (breadcrumb-text (last partial-selectors)) ]])))
[:span " » " (breadcrumb-text (last selector))]]))]) [:span " » " (breadcrumb-text (last selectors))]]))])


3 changes: 1 addition & 2 deletions src/mycroft/data.clj
Expand Up @@ -22,7 +22,7 @@
(= (namespace selector) "mycroft.data"))) (= (namespace selector) "mycroft.data")))


(defn add-selector (defn add-selector
"Update the options by adding a selector to the end of the "Update the options by adding a selector to the end of the
selectors already included." selectors already included."
[options s] [options s]
(let [options (if (:selectors options) (let [options (if (:selectors options)
Expand Down Expand Up @@ -210,7 +210,6 @@


(defn render-table (defn render-table
[content {:keys [headers] :as options}] [content {:keys [headers] :as options}]
(println "options are " options)
(if (seq content) (if (seq content)
(if headers (if headers
(render-table-with-headers content options) (render-table-with-headers content options)
Expand Down

0 comments on commit 63194bd

Please sign in to comment.