Commit 4ee47938 authored by Bruno Burke's avatar Bruno Burke 😁

Merge branch 'converge-calculation-and-multistep-calculation-exercise' into develop

parents 95de2c3e 1e55c721
......@@ -33,14 +33,26 @@
(fn []
[:span.has-text-info "✔ "]))
(defn correct-tick-fa []
[:span.icon.has-background-white.has-text-success
[:i.far.fa-check-square]])
(defn neutral-tick []
(fn []
[:span.has-text-info "😐 "]))
(defn neutral-tick-fa []
[:span.icon.has-background-white.has-text-info
[:i.far.fa-meh]])
(defn wrong-tick []
(fn []
[:span.has-text-info "✘ "]))
(defn wrong-tick-fa []
[:span.icon.has-background-white.has-text-danger
[:i.far.fa-times-circle]])
(defn binary-input [{:keys [default-bits result on-change-fn bitcount]
:or {bitcount 8}}]
(let [bits (reagent/atom
......
(ns lernmeister.components.exercise-types.calculation.views.show
(:require [lernmeister.components.common
:refer
[correct-tick
[correct-tick-fa
get-result-color-class
latex-span
unmigrateable-answer
wrong-tick]]
wrong-tick-fa]]
[lernmeister.components.content-elements.exercise.show :as ce-ex]
[lernmeister.components.content-elements.exercise.task-description
:refer
......@@ -48,23 +48,23 @@
:with-units (:with-units exercise)}
(get answer id)))]
[:<>
[:div.columns
(when-let [correct-calculations (and result
(:correct-calculations result))]
{:class
(cond
(correct-calculations id)
"has-background-success"
:else
"has-background-danger")})
[:div.columns.is-gapless
[:div.column.is-half
(if do-render
[:div.col [latex-span name] " = " [latex-span latex-str]]
[:div.col name " = " latex-str])
(when result
(if (contains? (:correct-calculations result) id)
[correct-tick]
[wrong-tick]))]
[:div.columns.is-gapless.is-vcentered {:style {:height "100%"}}
[:div.column.is-narrow.mr-2
{:class (when-let [correct-calculations (:correct-calculations result)]
(if (correct-calculations id)
"has-background-success"
"has-background-danger"))
:style {:width "0.5rem" :align-self "stretch"}}]
[:div.column
(if do-render
[:div.is-inline-block.mr-1 [latex-span name] " = " [latex-span latex-str]]
[:div.is-inline-block.mr-1 name " = " latex-str])
(when result
(if (contains? (:correct-calculations result) id)
[correct-tick-fa]
[wrong-tick-fa]))]]]
(when-not result
[:div.column.is-half
[:div.columns.is-mobile
......@@ -114,10 +114,8 @@
(defn print-calculation-exercise [{:keys [answer exercise change-fn result]}]
[:<>
[ui/card
{:title (:title exercise)
:class (get-result-color-class result)}
{:title (str (:title exercise))}
[:div
{:class (when result "has-background-light")}
[default-task-description (get-in exercise [:core :task-description])]
[:h5 [:b "Antwort"]]
[calculations {:exercise-core (:core exercise)
......@@ -125,7 +123,8 @@
:answer answer
:change-fn change-fn}]
(when result
[:span.is-pulled-right [point-result {:result result}]])]]
[:div.has-text-right {:class (get-result-color-class result)}
[point-result {:result result}]])]]
[ui/modal-panel
{:state (reagent/cursor modal-state-atom [:modal-visible?])
......
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