modify stats page to allow display list-specific stats
This commit is contained in:
parent
e4c2a03b72
commit
c3722371d3
|
@ -21,7 +21,8 @@
|
||||||
(defroute "/card/:id" [id] (page/page [cards/card-details id 0]))
|
(defroute "/card/:id" [id] (page/page [cards/card-details id 0]))
|
||||||
(defroute "/lists" [] (page/page [lists/lists-list]))
|
(defroute "/lists" [] (page/page [lists/lists-list]))
|
||||||
(defroute "/list/:id" [id] (page/page [lists/list-details (parse-int id)]))
|
(defroute "/list/:id" [id] (page/page [lists/list-details (parse-int id)]))
|
||||||
(defroute "/stats" [] (page/page [stats/stats-page]))
|
(defroute "/stats/list/:list-id" [list-id] (page/page [stats/stats-page (parse-int list-id)]))
|
||||||
|
(defroute "/stats" [] (page/page [stats/stats-page 0]))
|
||||||
(defroute "*" [] (page/barebones-page [:div "not found"]))
|
(defroute "*" [] (page/barebones-page [:div "not found"]))
|
||||||
|
|
||||||
(defn ^:export run
|
(defn ^:export run
|
||||||
|
|
|
@ -185,15 +185,19 @@
|
||||||
|
|
||||||
:else
|
:else
|
||||||
[:div.context
|
[:div.context
|
||||||
(if (auth/can-modify-data?)
|
|
||||||
[:div.absolute.top-right
|
[:div.absolute.top-right
|
||||||
|
[:span [bs/Button {:bsStyle "info"
|
||||||
|
:href (->url "#/stats/list/" list-id)} "List Statistics"]]
|
||||||
|
" "
|
||||||
|
(if (auth/can-modify-data?)
|
||||||
|
[:span
|
||||||
(if-not (:is_public @list) [:span.large-font [bs/Label {:bsStyle "danger"} "Private"] " "])
|
(if-not (:is_public @list) [:span.large-font [bs/Label {:bsStyle "danger"} "Private"] " "])
|
||||||
(if (:require_qualities @list) [:span.large-font [bs/Label {:bsStyle "primary"} "Card Qualities"] " "])
|
(if (:require_qualities @list) [:span.large-font [bs/Label {:bsStyle "primary"} "Card Qualities"] " "])
|
||||||
[bs/DropdownButton {:title "Actions"}
|
[bs/DropdownButton {:title "Actions"}
|
||||||
[bs/MenuItem {:on-click #(js/alert "TODO: Copy to Owned")} "Copy to Owned"]
|
[bs/MenuItem {:on-click #(js/alert "TODO: Copy to Owned")} "Copy to Owned"]
|
||||||
(if (auth/auth-required?)
|
(if (auth/auth-required?)
|
||||||
[bs/MenuItem {:on-click #(change-list-visibility! list-id (not (:is_public @list)))} (if (:is_public @list) "Make Private" "Make Public")])
|
[bs/MenuItem {:on-click #(change-list-visibility! list-id (not (:is_public @list)))} (if (:is_public @list) "Make Private" "Make Public")])
|
||||||
[bs/MenuItem {:on-click #(reset! show-delete-confirm? true)} "Delete"]]])
|
[bs/MenuItem {:on-click #(reset! show-delete-confirm? true)} "Delete"]]])]
|
||||||
[bs/PageHeader (:name @list)]
|
[bs/PageHeader (:name @list)]
|
||||||
[confirm-modal
|
[confirm-modal
|
||||||
show-delete-confirm?
|
show-delete-confirm?
|
||||||
|
|
|
@ -239,18 +239,20 @@
|
||||||
:pricing-source nil}))
|
:pricing-source nil}))
|
||||||
|
|
||||||
(defvc stats-page
|
(defvc stats-page
|
||||||
[]
|
[list-id]
|
||||||
(let [pricing-sources (view-cursor :pricing-sources)
|
(let [pricing-sources (view-cursor :pricing-sources)
|
||||||
|
list-info (view-cursor :list-info list-id (auth/get-username))
|
||||||
online? (:online? @settings)
|
online? (:online? @settings)
|
||||||
pricing-source (:pricing-source @settings)
|
pricing-source (:pricing-source @settings)]
|
||||||
list-id c/owned-list-id]
|
|
||||||
(set-active-breadcrumb! :stats)
|
(set-active-breadcrumb! :stats)
|
||||||
(if (and (not (vc/loading? pricing-sources))
|
(if (and (not (vc/loading? pricing-sources))
|
||||||
(nil? (:pricing-source @settings)))
|
(nil? (:pricing-source @settings)))
|
||||||
(swap! settings assoc :pricing-source (->> @pricing-sources first :source)))
|
(swap! settings assoc :pricing-source (->> @pricing-sources first :source)))
|
||||||
|
(if (and (not (vc/loading? list-info))
|
||||||
|
(not (vc/loading? pricing-sources)))
|
||||||
[:div.statistics-container
|
[:div.statistics-container
|
||||||
[:div.header
|
[:div.header
|
||||||
[bs/PageHeader "Collection Statistics"]
|
[bs/PageHeader "Statistics " [:small (if (= c/owned-list-id list-id) "Owned Cards" (:name @list-info))]]
|
||||||
[:div.settings
|
[:div.settings
|
||||||
[bs/Form {:inline true}
|
[bs/Form {:inline true}
|
||||||
[bs/FormGroup {:bsSize "large"}
|
[bs/FormGroup {:bsSize "large"}
|
||||||
|
@ -280,4 +282,5 @@
|
||||||
[widget-row [widget-basic-type-totals online? list-id]]
|
[widget-row [widget-basic-type-totals online? list-id]]
|
||||||
[widget-row [widget-most-valuable-cards online? list-id pricing-source {:width 10}]]
|
[widget-row [widget-most-valuable-cards online? list-id pricing-source {:width 10}]]
|
||||||
[widget-row [widget-most-copies-of-card online? list-id {:width 10}]]
|
[widget-row [widget-most-copies-of-card online? list-id {:width 10}]]
|
||||||
[widget-row [widget-most-nonland-copies-of-card online? list-id {:width 10}]]]]]]))
|
[widget-row [widget-most-nonland-copies-of-card online? list-id {:width 10}]]]]]]
|
||||||
|
[:div "Loading ..."])))
|
||||||
|
|
Loading…
Reference in a new issue