Skip to content

Commit

Permalink
fancy faculty title set multiselect
Browse files Browse the repository at this point in the history
  • Loading branch information
andrew committed Jun 6, 2016
1 parent 3854cba commit 3ed5165
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 25 deletions.
1 change: 1 addition & 0 deletions project.clj
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
[reagent "0.6.0-alpha2" :exclusions [cljsjs/react]]
[cljsjs/react-with-addons "15.0.2-0"] ; react
[re-frame "0.7.0"] ; state
[re-com "0.8.3"] ; reusable ui components
[cljs-ajax "0.5.4"] ; ajax requests
[bidi "2.0.9"] ; routing
[kibu/pushy "0.3.6"] ; auto html5 history
Expand Down
2 changes: 1 addition & 1 deletion src/cljs/ulysses/db.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@
:sort-direction "desc"}

; builder pool filters
:builder-filters {:faculty-title-set ["director"]
:builder-filters {:faculty-title-set #{"director"}
:faculty-years-uconn 0
:metrics {:publicationCount 0
:grantCount 0
Expand Down
37 changes: 13 additions & 24 deletions src/cljs/ulysses/pages/builder.cljs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
(ns ulysses.pages.builder
(:require [re-frame.core :as re-frame :refer [subscribe dispatch]]
[re-com.core :refer [selection-list]]
[ulysses.components.basic :refer [hink
link
loading-or-no-results
Expand Down Expand Up @@ -38,32 +39,20 @@
(fn [t] [:option {:value t} (str t "+")])
(range 0 (inc 30)))])


(defn faculty-title-multiselect
[faculty-titles {:keys [faculty-title-set]}]
[:select.multi-select
{:multiple true
:value faculty-title-set
:on-change (fn [e]
(dispatch [:builder-filter-faculty-title-set
(->> e
(.-target)
(.multiselect_values js/extra)
(js->clj))]))}
(map-subels
(fn [t] [:option {:value t} t])
faculty-titles)])

(defn metric-slider
[metric filters]
(let [value (get-in filters [:metrics metric])]
[:div
; [:div value "+"]
[range-slider
:min 0 :max 100 :value value
:on-change
(fn [v]
(dispatch [:builder-filter-faculty-metric metric v]))]]))
[selection-list
:multi-select? true
:hide-border? true
:required? true
:max-height "200px"
:choices
(mapv #(hash-map :id % :label %) faculty-titles)
:model
faculty-title-set
:on-change
(fn [v]
(dispatch [:builder-filter-faculty-title-set v]))])

(defn sidebar-section
[title & body]
Expand Down
20 changes: 20 additions & 0 deletions src/sass/_bootstrap-overrides.scss
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,23 @@
.label {
// padding-top: .35em;
}

// ----------------------------------------------------------------------------

// compact list group items

.list-group-item.compact {
border: 0;
cursor: default;
font-size: small;
height: 21px;
margin: 0;
overflow: hidden;
padding: 1px 5px;
text-overflow: ellipsis;
white-space: nowrap;

&:hover {
background-color: $gray-lightest;
}
}

0 comments on commit 3ed5165

Please sign in to comment.