Skip to content

Commit

Permalink
added moved example button to buttom
Browse files Browse the repository at this point in the history
  • Loading branch information
itolimaesther committed Mar 10, 2020
1 parent 471a5c7 commit 86139bd
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 20 deletions.
3 changes: 3 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
"clojureVSCode.formatOnSave": true
}
6 changes: 6 additions & 0 deletions less/site.less
Original file line number Diff line number Diff line change
Expand Up @@ -417,3 +417,9 @@ button.btn, button.cta {
#csscompiling {
display: none;
}

.fl-right{
float: right;
margin-right: 19px;
margin-bottom: 20px;
}
20 changes: 10 additions & 10 deletions src/cljs/bluegenes/pages/mymine/views/modals.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -98,13 +98,13 @@
:value @state
:on-change (fn [evt] (reset! state (oget evt :target :value)))
:on-key-up (on-enter
#(when (not (s/blank? @state))
#(when (not (s/blank? @state))
; Call the succeess function with the value of the target
(on-success @state)
(on-success @state)
; Clear the state for re-use
(reset! state "")
(reset! state "")
; Find the modal parent and manually close it
(-> @dom-node (ocall :closest ".modal") (ocall :modal "hide"))))}]
(-> @dom-node (ocall :closest ".modal") (ocall :modal "hide"))))}]
(when (true? (:name-taken? errors))
[:div.alert.alert-warning "A list with this name already exists"])]]))})))

Expand All @@ -127,13 +127,13 @@
:value @state
:on-change (fn [evt] (reset! state (oget evt :target :value)))
:on-key-up (on-enter
#(when (not (s/blank? @state))
#(when (not (s/blank? @state))
; Call the succeess function with the value of the target
(on-success @state)
(on-success @state)
; Clear the state for re-use
(reset! state "")
(reset! state "")
; Find the modal parent and manually close it
(-> @dom-node (ocall :closest ".modal") (ocall :modal "hide"))))}]
(-> @dom-node (ocall :closest ".modal") (ocall :modal "hide"))))}]
(when (true? (:name-taken? errors))
[:div.alert.alert-warning "A list with this name already exists"])]]))})))

Expand Down Expand Up @@ -241,8 +241,8 @@
{:ref (fn [e] (when e (do (oset! e :value name) (reset! input-dom-node (js/$ e)))))
:type "text"
:on-key-up (on-enter
#(do ;(dispatch [::evts/copy trail (:name @dets) (ocall @input-dom-node :val)])
(ocall @modal-dom-node :modal "hide")))}]]
#(do ;(dispatch [::evts/copy trail (:name @dets) (ocall @input-dom-node :val)])
(ocall @modal-dom-node :modal "hide")))}]]
[:div.modal-footer
[:div.btn-toolbar.pull-right
[:button.btn.btn-default
Expand Down
10 changes: 5 additions & 5 deletions src/cljs/bluegenes/pages/profile/events.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -214,12 +214,12 @@
(-> db
(assoc-in [:profile :preferences] prefs')
(cond->
success?
success?
(->
(assoc-in [:profile :inputs :user-preferences] prefs')
(assoc-in [:profile :responses :user-preferences]
{:type :success
:message "Updated preferences have been saved."})))))))
(assoc-in [:profile :inputs :user-preferences] prefs')
(assoc-in [:profile :responses :user-preferences]
{:type :success
:message "Updated preferences have been saved."})))))))

(reg-event-fx
::start-deregistration
Expand Down
13 changes: 13 additions & 0 deletions src/cljs/bluegenes/pages/regions/results.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,15 @@
[:div.col [:h4 "Feature Type"]]
[:div.col [:h4 "Location"]]])

(defn ex
"Generate example region search input based on pre-configured per-mine settings"
[]
(let [active-mine (subscribe [:current-mine])
example-text (:regionsearch-example @active-mine)]
;; We can't use split-lines because the lines are split with an escaped
;; slash - that is, they are split on `\\n` and not `\n`
(clojure.string/join "\n" (split example-text #"\\n"))))

(defn table-row
"A single result row for a single region feature."
[chromosome {:keys [primaryIdentifier class chromosomeLocation objectId] :as result}]
Expand Down Expand Up @@ -116,13 +125,17 @@
[:div]))

(defn results-section []

(let [results (subscribe [:regions/results])
loading? (subscribe [:regions/loading])
error (subscribe [:regions/error])]
(if @loading? [loader "Regions"]

(if (not @error)
[:div
[:div.row [:button.btn.btn-default.btn-raised.fl-right
{:on-click #(dispatch [:regions/set-to-search (ex)])}
"Show Example"]]
[:div.results-summary [:h2 "Results"] [results-count-summary @results]]
(into [:div.allresults]
(map (fn [result]
Expand Down
7 changes: 2 additions & 5 deletions src/cljs/bluegenes/pages/regions/views.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
(ocall (oget e "target") "blur"))
:title "Enter something into the 'Regions to search' box or click on [Show me an example], then click here! :)"}
"Search"]]
; Results section
; Results section
[checkboxes to-search settings]]))

(defn main []
Expand All @@ -165,9 +165,6 @@
(fn []
[:div.container.regionsearch
[:div.headerwithguidance
[:h1 "Region Search"]
[:button.btn.btn-default.btn-raised
{:on-click #(dispatch [:regions/set-to-search (ex)])}
"Show Example"]]
[:h1 "Region Search"]]
[input-section]
[results-section]])}))

0 comments on commit 86139bd

Please sign in to comment.