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;
}
.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 {
margin-bottom: auto;
}

View file

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