Commit 1d6bd5a5 authored by Joachim Schunk's avatar Joachim Schunk

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

parents 16194b4c 2e6365de
Pipeline #45426 passed with stages
in 1 minute and 52 seconds
......@@ -2,10 +2,9 @@
(defn card-panel [& content]
[:div.card
[:div.card-content
(apply vector
:div.content
content)]])
(apply vector
:div.card-content
content)])
(defn card [{:keys [title footer-items class]} content]
[:div.card {:class class}
......
......@@ -200,7 +200,7 @@
(when (get state index)
[:div.card-content
[:div.content
[:div
(:content element)]])])
elements)]))})))
......
......@@ -173,7 +173,8 @@
:on-change #(change-fn (conj path :assoc-id) %)}]))]
[:td
[ui/select
{:disabled step-result
{:node-type :dropdown
:disabled step-result
:label ""
:value (:assignment-id step)
:options (map (fn [assignment]
......
......@@ -37,61 +37,69 @@
(defn b-crumb-step [{:keys [position current-position phrase-fn on-click-fn last-step]}]
[:<>
[:span {:class (when (= position current-position) "blue-text")
:style {:cursor "pointer"}
:on-click #(on-click-fn position)}
(phrase-fn position)]
[:li {:class (when (= position current-position) "is-active")
;;:style {:cursor "pointer"}
;;:on-click #(on-click-fn position)
}
[:a {:on-click #(on-click-fn position)}
(phrase-fn position)]]
(when-not last-step
[:i.material-icons "chevron_right"])])
#_[:i.material-icons "chevron_right"])])
(defn b-crumb [{:keys [positions current-position phrase-fn on-click-fn]}]
[:div.card-panel.valign-wrapper
(map-indexed
(fn [index position]
^{:key (str "b-crumb-step-" index)}
[b-crumb-step {:position position
:current-position current-position
:phrase-fn phrase-fn
:on-click-fn on-click-fn
:last-step (when (= index (dec (count positions))) true)}])
positions)])
[ui/card-panel
[:nav.breadcrumb.has-arrow-separator
[:ul {:style {:margin-top "0"}}
(map-indexed
(fn [index position]
^{:key (str "b-crumb-step-" index)}
[b-crumb-step {:position position
:current-position current-position
:phrase-fn phrase-fn
:on-click-fn on-click-fn
:last-step (when (= index (dec (count positions))) true)}])
positions)]]])
(defn transfer-panel [{:keys [positions current-position phrase-fn on-click-fn]}]
(let [position-indexes (zipmap positions (range (count positions)))
next-position (get positions (inc (current-position position-indexes)))]
[:div.card-panel.valign-wrapper {:style {:justify-content "space-between"}}
[:span (phrase-fn next-position)]
[:a.button.is-info {:on-click #(on-click-fn next-position)}
[:span.icon [:i.fas.fa-arrow-right]]]]))
[ui/card-panel #_{:style {:justify-content "space-between"}}
[:div.level
[:div.level-left
[:div.level-item
[:span (phrase-fn next-position)]]
[:div.level-item
[:a.button.is-info {:on-click #(on-click-fn next-position)}
[:span.icon [:i.fas.fa-arrow-right]]]]]]]))
(defn assoc-renderer [assoc]
[:div.row
[:div.col.s4 (:sign assoc)]
[:div.col.s8 (:description assoc)]])
[:div.columns.is-mobile
[:div.column.is-4 (:sign assoc)]
[:div.column.is-8 (:description assoc)]])
(defn param-renderer [{:keys [param assocs with-oom with-units]}]
(let [assoc-sign (:sign (find-in-vec-by-id assocs (:assoc-id param)))
substring (str (:idx param) ", " assoc-sign)
latex-string (build-latex-string (merge {:with-oom with-oom :with-units with-units}
param))]
[:div.row
[:div.col.s6 [modal-renderers/sign-with-subtext {:sign (:sign param) :subtext substring}]]
[:div.col.s6 [latex-span latex-string]]]))
[:div.columns.is-mobile
[:div.column.is-half [modal-renderers/sign-with-subtext {:sign (:sign param) :subtext substring}]]
[:div.column.is-half [latex-span latex-string]]]))
(defn assignment-renderer [assignment]
[:div.row
[:div.col.s4 [modal-renderers/sign-with-subtext {:sign (:sign assignment) :subtext (:idx assignment)}]]
[:div.col.s8 (assignment-type-mapping (:type assignment))]])
[:div.columns.is-mobile
[:div.column.is-4 [modal-renderers/sign-with-subtext {:sign (:sign assignment) :subtext (:idx assignment)}]]
[:div.column.is-8 (assignment-type-mapping (:type assignment))]])
(defn answer-params-tab [{:keys [assoc assocs descriptions mapped-params with-oom with-units]}]
(let [tab-params ((keyword (:id assoc)) mapped-params)]
(if (not-empty tab-params)
[:div.row
[:div.col.s7
[:div.columns.is-mobile
[:div.column.is-7
[:h6 (:description assoc)]
(when-let [description-id (:additional-description-id assoc)]
[default-task-description (get-in descriptions [(name description-id) :content])])]
[:div.col.s5
[:div.column.is-5
(map-indexed
(fn [index tab-param]
^{:key (str "answer-parameter-" index)}
......@@ -132,8 +140,8 @@
(if (not-empty assocs)
[:<>
(when-let [description-id (:params description-ids)]
[:div.row
[:div.col.s12
[:div.columns
[:div.column.is-full
[default-task-description
(get-in descriptions [(name description-id) :content])]]])
[ui/scrollable-tabs
......@@ -205,19 +213,23 @@
(conj v :params)
(if (:hide-assignments exercise-core) v (conj v :assignments))
(conj v :steps))]
[:div.card {:class (get-result-color-class result)}
[:div.card-content
[:span.card-title [:b (:title exercise)]]
[ui/card
{:title (:title exercise)
:class (get-result-color-class result)}
[:div
#_[:span.card-title [:b (:title exercise)]]
[b-crumb {:positions positions
:current-position @current-position
:phrase-fn phrase-fn
:on-click-fn #(reset! current-position %)}]
[multistep-calculation-answer-form {:answer answer
:exercise-core exercise-core
:change-fn change-fn
:phrase-fn phrase-fn
:current-position @current-position
:result result}]
[:div.section
[:div.content
[multistep-calculation-answer-form {:answer answer
:exercise-core exercise-core
:change-fn change-fn
:phrase-fn phrase-fn
:current-position @current-position
:result result}]]]
(if result
[:span.secondary-content [:b (str (:points result) "P")]]
(when-not (= @current-position :steps)
......
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