clean up card inventory popover layout

This commit is contained in:
Gered 2016-06-29 11:52:21 -04:00
parent a957440f3b
commit 5fe5568e2a
2 changed files with 58 additions and 43 deletions

View file

@ -63,6 +63,16 @@ div.card-title > h1 > small {
background-color: #f5f5f5; background-color: #f5f5f5;
} }
.inventory-container td.quality-label {
white-space: nowrap;
}
.inventory-container td.quantity {
padding-left: 20px;
padding-right: 20px;
text-align: center;
}
.search-filters .form-group { .search-filters .form-group {
margin-bottom: auto; margin-bottom: auto;
} }

View file

@ -28,10 +28,14 @@
(let [inventory (view-cursor :owned-card card-id) (let [inventory (view-cursor :owned-card card-id)
inventory (group-by :quality @inventory)] inventory (group-by :quality @inventory)]
[bs/Grid {:fluid true :class "inventory-container"} [bs/Grid {:fluid true :class "inventory-container"}
[bs/Row [bs/Table
[bs/Col {:sm 4} ""] {:condensed true :hover true :bordered true}
[bs/Col {:sm 4 :class "text-center"} [:strong "Normal"]] [:thead
[bs/Col {:sm 4 :class "text-center"} [:strong "Foil"]]] [:tr
[:th ""]
[:th {:col-span 2} [:span.text-center "Normal"]]
[:th {:col-span 2} [:span.text-center "Foil"]]]]
[:tbody
(map-indexed (map-indexed
(fn [idx quality] (fn [idx quality]
(let [inventory (get inventory quality) (let [inventory (get inventory quality)
@ -39,18 +43,19 @@
foil-quantity (or (:quantity (first (get quantities true))) 0) foil-quantity (or (:quantity (first (get quantities true))) 0)
non-foil-quantity (or (:quantity (first (get quantities false))) 0)] non-foil-quantity (or (:quantity (first (get quantities false))) 0)]
^{:key idx} ^{:key idx}
[bs/Row [:tr
{:class (if (or (> foil-quantity 0) {:class (if (or (> foil-quantity 0)
(> non-foil-quantity 0)) (> non-foil-quantity 0))
"bg-warning")} "bg-warning")}
[bs/Col {:sm 4 :class "text-right"} [:td.quality-label.col-sm-4
[:span.text-right
[bs/FormControl.Static [bs/FormControl.Static
(str (string/capitalize quality) ": ")]] (str (string/capitalize quality) ": ")]]]
;; non-foil ;; non-foil
[bs/Col {:sm 1} [:td.quantity.col-sm-1
[bs/FormControl.Static [bs/FormControl.Static
[:strong non-foil-quantity]]] [:strong non-foil-quantity]]]
[bs/Col {:sm 3} [:td.col-sm-3
[bs/ButtonGroup {:justified true} [bs/ButtonGroup {:justified true}
[bs/ButtonGroup [bs/ButtonGroup
[bs/Button {:bsStyle "success" :on-click #(on-add-card card-id quality false)} [bs/Button {:bsStyle "success" :on-click #(on-add-card card-id quality false)}
@ -59,10 +64,10 @@
[bs/Button {:bsStyle "danger" :disabled (= 0 non-foil-quantity) :on-click #(on-remove-card card-id quality false)} [bs/Button {:bsStyle "danger" :disabled (= 0 non-foil-quantity) :on-click #(on-remove-card card-id quality false)}
[bs/Glyphicon {:glyph "minus"}]]]]] [bs/Glyphicon {:glyph "minus"}]]]]]
;; foil ;; foil
[bs/Col {:sm 1} [:td.quantity.col-sm-1
[bs/FormControl.Static [bs/FormControl.Static
[:strong foil-quantity]]] [:strong foil-quantity]]]
[bs/Col {:sm 3} [:td.col-sm-3
[bs/ButtonGroup {:justified true} [bs/ButtonGroup {:justified true}
[bs/ButtonGroup [bs/ButtonGroup
[bs/Button {:bsStyle "success" :on-click #(on-add-card card-id quality true)} [bs/Button {:bsStyle "success" :on-click #(on-add-card card-id quality true)}
@ -70,7 +75,7 @@
[bs/ButtonGroup [bs/ButtonGroup
[bs/Button {:bsStyle "danger" :disabled (= 0 foil-quantity) :on-click #(on-remove-card card-id quality true)} [bs/Button {:bsStyle "danger" :disabled (= 0 foil-quantity) :on-click #(on-remove-card card-id quality true)}
[bs/Glyphicon {:glyph "minus"}]]]]]])) [bs/Glyphicon {:glyph "minus"}]]]]]]))
qualities)])) qualities)]]]))
(defn inventory (defn inventory
[card-id & [{:keys [num-owned owned? button-size button-style] :as opts}]] [card-id & [{:keys [num-owned owned? button-size button-style] :as opts}]]