clean up card inventory popover layout
This commit is contained in:
parent
a957440f3b
commit
5fe5568e2a
|
@ -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;
|
||||||
}
|
}
|
||||||
|
|
|
@ -28,49 +28,54 @@
|
||||||
(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
|
||||||
(map-indexed
|
[:th ""]
|
||||||
(fn [idx quality]
|
[:th {:col-span 2} [:span.text-center "Normal"]]
|
||||||
(let [inventory (get inventory quality)
|
[:th {:col-span 2} [:span.text-center "Foil"]]]]
|
||||||
quantities (group-by :foil inventory)
|
[:tbody
|
||||||
foil-quantity (or (:quantity (first (get quantities true))) 0)
|
(map-indexed
|
||||||
non-foil-quantity (or (:quantity (first (get quantities false))) 0)]
|
(fn [idx quality]
|
||||||
^{:key idx}
|
(let [inventory (get inventory quality)
|
||||||
[bs/Row
|
quantities (group-by :foil inventory)
|
||||||
{:class (if (or (> foil-quantity 0)
|
foil-quantity (or (:quantity (first (get quantities true))) 0)
|
||||||
(> non-foil-quantity 0))
|
non-foil-quantity (or (:quantity (first (get quantities false))) 0)]
|
||||||
"bg-warning")}
|
^{:key idx}
|
||||||
[bs/Col {:sm 4 :class "text-right"}
|
[:tr
|
||||||
[bs/FormControl.Static
|
{:class (if (or (> foil-quantity 0)
|
||||||
(str (string/capitalize quality) ": ")]]
|
(> non-foil-quantity 0))
|
||||||
;; non-foil
|
"bg-warning")}
|
||||||
[bs/Col {:sm 1}
|
[:td.quality-label.col-sm-4
|
||||||
[bs/FormControl.Static
|
[:span.text-right
|
||||||
[:strong non-foil-quantity]]]
|
[bs/FormControl.Static
|
||||||
[bs/Col {:sm 3}
|
(str (string/capitalize quality) ": ")]]]
|
||||||
[bs/ButtonGroup {:justified true}
|
;; non-foil
|
||||||
[bs/ButtonGroup
|
[:td.quantity.col-sm-1
|
||||||
[bs/Button {:bsStyle "success" :on-click #(on-add-card card-id quality false)}
|
[bs/FormControl.Static
|
||||||
[bs/Glyphicon {:glyph "plus"}]]]
|
[:strong non-foil-quantity]]]
|
||||||
[bs/ButtonGroup
|
[:td.col-sm-3
|
||||||
[bs/Button {:bsStyle "danger" :disabled (= 0 non-foil-quantity) :on-click #(on-remove-card card-id quality false)}
|
[bs/ButtonGroup {:justified true}
|
||||||
[bs/Glyphicon {:glyph "minus"}]]]]]
|
[bs/ButtonGroup
|
||||||
;; foil
|
[bs/Button {:bsStyle "success" :on-click #(on-add-card card-id quality false)}
|
||||||
[bs/Col {:sm 1}
|
[bs/Glyphicon {:glyph "plus"}]]]
|
||||||
[bs/FormControl.Static
|
[bs/ButtonGroup
|
||||||
[:strong foil-quantity]]]
|
[bs/Button {:bsStyle "danger" :disabled (= 0 non-foil-quantity) :on-click #(on-remove-card card-id quality false)}
|
||||||
[bs/Col {:sm 3}
|
[bs/Glyphicon {:glyph "minus"}]]]]]
|
||||||
[bs/ButtonGroup {:justified true}
|
;; foil
|
||||||
[bs/ButtonGroup
|
[:td.quantity.col-sm-1
|
||||||
[bs/Button {:bsStyle "success" :on-click #(on-add-card card-id quality true)}
|
[bs/FormControl.Static
|
||||||
[bs/Glyphicon {:glyph "plus"}]]]
|
[:strong foil-quantity]]]
|
||||||
[bs/ButtonGroup
|
[:td.col-sm-3
|
||||||
[bs/Button {:bsStyle "danger" :disabled (= 0 foil-quantity) :on-click #(on-remove-card card-id quality true)}
|
[bs/ButtonGroup {:justified true}
|
||||||
[bs/Glyphicon {:glyph "minus"}]]]]]]))
|
[bs/ButtonGroup
|
||||||
qualities)]))
|
[bs/Button {:bsStyle "success" :on-click #(on-add-card card-id quality true)}
|
||||||
|
[bs/Glyphicon {:glyph "plus"}]]]
|
||||||
|
[bs/ButtonGroup
|
||||||
|
[bs/Button {:bsStyle "danger" :disabled (= 0 foil-quantity) :on-click #(on-remove-card card-id quality true)}
|
||||||
|
[bs/Glyphicon {:glyph "minus"}]]]]]]))
|
||||||
|
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}]]
|
||||||
|
|
Loading…
Reference in a new issue