Commit 0fa7bebe authored by Joachim Schunk's avatar Joachim Schunk

Merge branch 'bulma-css' into 28-create-new-multistep-calculation-exercise-type

parents ab13837b 3c0ca384
Pipeline #45495 passed with stages
in 1 minute and 49 seconds
......@@ -4,14 +4,20 @@
[:div.card
(apply vector
:div.card-content
content)])
content)])
(defn card [{:keys [title footer-items class]} content]
(defn card [{:keys [title title-right footer-items class]} content]
[:div.card {:class class}
(when title
[:header.card-header
[:p.card-header-title
title]])
(when (or title
title-right)
[:header.card-header.is-block
[:div.level.is-mobile
[:div.level-left
[:div.level-item.card-header-title
title]]
[:div.level-right
[:div.level-item.is-pulled-right.card-header-title
title-right]]]])
[:div.card-content content]
(when (pos? (count footer-items))
[:footer.card-footer
......
......@@ -25,7 +25,7 @@
(defn input-text
[{:keys [field-class input-class input-size label-icon
placeholder value on-change label icons expanded?
disabled tooltip autocomplete readonly? help]}]
disabled? tooltip autocomplete readonly? help]}]
(let [id (gensym "input-text")]
(reagent/create-class
{:component-did-mount (fn []
......@@ -42,7 +42,7 @@
:reagent-render
(fn [{:keys [field-class input-class input-size label-icon
placeholder value on-change label icons expanded?
disabled tooltip autocomplete readonly? help]}]
disabled? tooltip autocomplete readonly? help]}]
[:<> ;;:div.field {:class field-class}
#_(when label
[:label.label {:for id} label])
......@@ -55,7 +55,7 @@
:value value
:placeholder (or placeholder "")
:size input-size
:disabled disabled
:disabled disabled?
:read-only readonly?
:on-change #(on-change (-> %
.-target
......@@ -72,14 +72,14 @@
(defn input-range
[{:keys [field-class input-class input-size label-icon
placeholder value on-change label
disabled tooltip autocomplete icons expanded?
disabled? tooltip autocomplete icons expanded?
min max]}]
(let [id (gensym "input-range")]
(reagent/create-class
{:reagent-render
(fn [{:keys [field-class input-class input-size label-icon
placeholder value on-change label
disabled tooltip autocomplete
disabled? tooltip autocomplete
min max]}]
[field {:addons? true}
[control {:icons icons
......@@ -99,7 +99,7 @@
:min min
:max max
:placeholder (or placeholder "")
:disabled disabled
:disabled disabled?
:on-change #(on-change
(-> % .-target .-value js/parseInt))
:id (str id "number")}]]
......
......@@ -34,7 +34,7 @@
(.removeEventListener js/window "scroll" close-fn)))
:reagent-render
(fn [{:keys [value on-change options label multiple icons
expanded? choose-option-label]}]
expanded? choose-option-label disabled?]}]
[:div.dropdown {:id (str id)
:class (str (when @active?
" is-active"))
......@@ -50,7 +50,8 @@
:style (when expanded?
{:width "100%"})}
[:button.button
{:style (when expanded?
{:disabled disabled?
:style (when expanded?
{:width "100%"
:justify-content :left})
:on-click #(swap! active? not)}
......@@ -78,12 +79,12 @@
)})))
(defn native-select [params]
(fn [{:keys [value on-change options label disabled multiple
(fn [{:keys [value on-change options label disabled? multiple
choose-option-label icons expanded?] :as params}]
(reagent/with-let [id (gensym "select")]
[:select
{:id id
:disabled disabled
:disabled disabled?
:multiple multiple
:value (if multiple
(or value [])
......@@ -125,7 +126,7 @@
(reagent/create-class
{:display-name "input-select-component"
:reagent-render
(fn [{:keys [value on-change options label disabled multiple
(fn [{:keys [value on-change options label disabled? multiple
choose-option-label icons expanded? node-type] :as params}]
[:<>
[control {:icons icons
......@@ -153,12 +154,13 @@
:reagent-render
(fn [{:keys [cursor options label multiple
choose-option-label on-change
expanded? node-type]}]
expanded? node-type disabled?]}]
[select
{:value @cursor
:options options
:label label
:multiple multiple
:disabled? disabled?
:expanded? expanded?
:node-type node-type
:choose-option-label choose-option-label
......
......@@ -9,10 +9,10 @@
points-max (:points-max result)]
(cond
(and points points-max
(== points points-max)) "green lighten-4"
(== points points-max)) "has-background-success"
(and points points-max
(< 0 points points-max)) "yellow lighten-4"
(and points (<= points 0)) "red lighten-4"
(< 0 points points-max)) "has-background-warning"
(and points (<= points 0)) "has-background-danger"
:else "")))
(defn renderMath [id]
......
......@@ -165,7 +165,7 @@
0 "Missing"
1 (:sign (find-in-vec-by-id assocs (:assoc-id step)))
[ui/select
{:disabled step-result
{:disabled? step-result
:label ""
:value (:assoc-id step)
:options (map (fn [assoc] {:key (:id assoc) :title (:sign assoc)}) assocs)
......@@ -173,7 +173,7 @@
[:td
[ui/select
{:node-type :dropdown
:disabled step-result
:disabled? step-result
:label ""
:value (:assignment-id step)
:options (map (fn [assignment]
......
......@@ -223,6 +223,8 @@
:phrase-fn phrase-fn
:on-click-fn #(reset! current-position %)}]
[:div.section
{:class (when result
"has-background-light")}
[:div
[multistep-calculation-answer-form {:answer answer
:exercise-core exercise-core
......@@ -231,7 +233,7 @@
:current-position @current-position
:result result}]]]
(if result
[:span.secondary-content [:b (str (:points result) "P")]]
[:span.is-pulled-right [:b (str (:points result) "P")]]
(when-not (= @current-position :steps)
[transfer-panel {:positions positions
:current-position @current-position
......
......@@ -242,6 +242,20 @@
[:p.flow-text "Dies ist ein Flow-Text in einer Card"]
[:p.flow-text "Dies ist ein Flow-Text in einer Card"]]])
(defcard-rg card-card-right-title
[ui/card
{:title "Title Left"
:title-right [:div
[:span "Title Right"]
[:span.icon [:i.fas.fa-exclamation-triangle]]]
:footer-items
[[:a.footer-item "senden"] [:a.footer-item "lll"]]}
[:div [:p.flow-text "Dies ist ein Flow-Text in einer Card"]
[:p.flow-text "Dies ist ein Flow-Text in einer Card"]
[:p.flow-text "Dies ist ein Flow-Text in einer Card"]
[:p.flow-text "Dies ist ein Flow-Text in einer Card"]]])
(defcard-rg menu
(let [sidenav-id "sidenav-id"
links [{:panel :home-panel :label "HOME" :route "#/home"}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment