Commit 5a1c49d6 authored by Joachim Schunk's avatar Joachim Schunk

remove redundant editor-headings

parent a82ccf56
......@@ -158,8 +158,7 @@
:type (:type @modal-state-atom)
:with-oom (:with-oom @modal-state-atom)
:with-units (:with-units @modal-state-atom)
:collats-fn (:collats-fn @modal-state-atom)
:symbol-data (:symbol-data @modal-state-atom)}]]]]))
:collats-fn (:collats-fn @modal-state-atom)}]]]]))
(defn new-exercise-options [{:keys [exercise change-fn phrase-fn]}]
(let [exercise-core (:core exercise)
......
......@@ -195,8 +195,7 @@
:with-oom (:with-oom @modal-state-atom)
:with-units (:with-units @modal-state-atom)
:collats-fn (:collats-fn @modal-state-atom)
:used-units @selectable-units
:symbol-data (:symbol-data @modal-state-atom)}]]]]))
:used-units @selectable-units}]]]]))
(defn print-multistep-calculation-exercise [{:keys [answer exercise change-fn phrase-fn result]}]
(reagent/with-let [current-position (reagent/atom :task)]
......
......@@ -8,10 +8,9 @@
[formula-calculator var-mapping-builder]]
[lernmeister.components.modal-editor.helper
:refer
[phys-val-map-from-var-set var-set-from-formula-vec]]
[lernmeister.components.modal-editor.renderers :refer [editor-heading]]))
[phys-val-map-from-var-set var-set-from-formula-vec]]))
(defn calc-editor [{:keys [subject path change-fn with-oom with-units collats-fn symbol-data phrase-fn]}]
(defn calc-editor [{:keys [subject path change-fn with-oom with-units collats-fn phrase-fn]}]
(let [steps (get-in subject [:core :steps])
step (get-in subject path)
step-id (:id step)
......@@ -29,7 +28,6 @@
var-phys-val-map (phys-val-map-from-var-set var-set var-mapping params assignments steps
authoring :edit)]
[:<>
[editor-heading symbol-data]
[formula-calculator
{:id step-id
:phys-val phys-val
......
......@@ -5,10 +5,9 @@
[var-selection-builder]]
[lernmeister.components.modal-editor.helper
:refer
[get-phys-val-for-var]]
[lernmeister.components.modal-editor.renderers :refer [editor-heading]]))
[get-phys-val-for-var]]))
(defn calc-answer-editor [{:keys [subject context path change-fn with-oom collats-fn symbol-data phrase-fn]}]
(defn calc-answer-editor [{:keys [subject context path change-fn with-oom collats-fn phrase-fn]}]
(let [step (get-in subject path)
vars (:vars step)
assignments (:assignments context)
......@@ -23,7 +22,6 @@
var {:id-key :var-id :params params :steps steps :scenario :show})]
(conj res phys-val))) [] vars)]
[:<>
[editor-heading symbol-data]
[var-selection-builder
{:steps steps
:assignment-categories (:assignment-categories context)
......
......@@ -13,9 +13,7 @@
[lernmeister.components.modal-editor.helper
:refer
[calc-mapping-obj decimal-places-options var-set-from-formula-vec]]
[lernmeister.components.modal-editor.renderers
:refer
[editor-heading units-renderer]]
[lernmeister.components.modal-editor.renderers :refer [units-renderer]]
[lernmeister.components.ui :as ui]
[reagent.core :as reagent]))
......@@ -52,7 +50,7 @@
[:td [latex-span units-latex-str]]
[:td action
#_{:class (:button-class action)
:on-click #((:click-fn action) var-sign)}
:on-click #((:click-fn action) var-sign)}
#_[:i.material-icons (:button-icon action)]]]))
(defn calc-mappings-input [{:keys [suffix id var-set calc-mapping with-oom change-fn path collats-fn
......@@ -135,10 +133,10 @@
[{:path [:authoring id-key :calc-mapping var-sign]}]))}
[:span.icon [:i.fas.fa-trash]]]
#_{:button-class ["red" "right"]
:button-icon "delete"
:click-fn (fn [var-sign]
(change-fn path (dissoc calc-mapping var-sign)
[{:path [:authoring id-key :calc-mapping var-sign]}]))}}]])
:button-icon "delete"
:click-fn (fn [var-sign]
(change-fn path (dissoc calc-mapping var-sign)
[{:path [:authoring id-key :calc-mapping var-sign]}]))}}]])
[:h6 (phrase-fn :vars)]
[calc-mappings-input
{:suffix "assigned"
......@@ -162,11 +160,11 @@
:change-fn change-fn
:collats-fn collats-fn}]])))
(defn formula-editor [{:keys [subject path with-oom with-units change-fn collats-fn symbol-data phrase-fn]}]
(defn formula-editor [{:keys [subject path with-oom with-units change-fn collats-fn phrase-fn]}]
(let [local-state-atom (reagent/atom {})]
(reagent/create-class
{:reagent-render
(fn [{:keys [subject path with-oom with-units change-fn collats-fn symbol-data phrase-fn]}]
(fn [{:keys [subject path with-oom with-units change-fn collats-fn phrase-fn]}]
(let [context-obj (get-in subject path)
assignment-id (:id context-obj)
calc-mapping (:calc-mapping context-obj)
......@@ -183,7 +181,6 @@
(get-in authoring [(keyword assignment-id) :calc-mapping])
calc-mapping)]
[:<>
[editor-heading symbol-data]
[formula-calculator
{:id assignment-id
:phys-val phys-val
......
......@@ -11,7 +11,7 @@
[compare-number-objects]]
[lernmeister.components.modal-editor.renderers
:refer
[editor-heading list-renderer value-renderer]]
[list-renderer value-renderer]]
[reagent.core :as reagent]))
(defn get-insert-index-for-number-obj
......@@ -30,7 +30,7 @@
(vec-insert n-obj-v n-obj insert-idx)
n-obj-v))
(defn list-editor [{:keys [subject path variable-idx change-fn with-oom with-units collats-fn symbol-data]}]
(defn list-editor [{:keys [subject path variable-idx change-fn with-oom with-units collats-fn]}]
(reagent/with-let [val-state-atom (reagent/atom {:number number-obj})]
(let [number (:number @val-state-atom)
units (get-in subject (conj path :units))
......@@ -48,7 +48,6 @@
(set-test-fn [index]
(change-fn authoring-number-path (:number (nth list index)) (collats-fn)))]
[:<>
[editor-heading symbol-data]
[list-renderer {:list list
:units units
:test-number {:number (get-in subject authoring-number-path)}
......
(ns lernmeister.components.modal-editor.editors.number
(:require [lernmeister.components.modal-editor.builders :refer [number-builder]]
[lernmeister.components.modal-editor.renderers
:refer
[editor-heading number-renderer]]))
[lernmeister.components.modal-editor.renderers :refer [number-renderer]]))
(defn number-editor [{:keys [subject path change-fn collats-fn symbol-data]}]
(defn number-editor [{:keys [subject path change-fn collats-fn]}]
(let [phys-val (get-in subject path)]
[:<>
[editor-heading symbol-data]
[number-renderer {:phys-val phys-val}]
[number-builder {:phys-val phys-val
:path path
......
......@@ -2,14 +2,11 @@
(:require [lernmeister.components.modal-editor.builders
:refer
[units-builder value-builder]]
[lernmeister.components.modal-editor.renderers
:refer
[editor-heading value-renderer]]))
[lernmeister.components.modal-editor.renderers :refer [value-renderer]]))
(defn physical-value-editor [{:keys [subject path change-fn with-oom with-units collats-fn symbol-data]}]
(defn physical-value-editor [{:keys [subject path change-fn with-oom with-units collats-fn]}]
(let [phys-val (get-in subject path)]
[:<>
[editor-heading symbol-data]
[value-builder {:phys-val phys-val
:path path
:with-oom with-oom
......
......@@ -7,7 +7,7 @@
[decimal-places-options]]
[lernmeister.components.modal-editor.renderers
:refer
[editor-heading value-range-renderer]]
[value-range-renderer]]
[lernmeister.components.ui :as ui]
[reagent.core :as reagent]))
......@@ -29,7 +29,7 @@
:options decimal-places-options
:on-change #(precision-change-fn (name %))]]])
(defn range-editor [{:keys [subject path variable-idx change-fn with-oom with-units collats-fn symbol-data]}]
(defn range-editor [{:keys [subject path variable-idx change-fn with-oom with-units collats-fn]}]
(reagent/with-let [val-state-atom (reagent/atom {})]
(let [state-id (str "variable-" variable-idx)
units (get-in subject (conj path :units))
......@@ -39,7 +39,6 @@
[:variables variable-idx :data])
sig-path [:variables variable-idx :data :precision]]
[:<>
[editor-heading symbol-data]
[value-builder {:phys-val (get-in subject number-path)
:path number-path
:number-key val-key
......
(ns lernmeister.components.modal-editor.editors.units
(:require [lernmeister.components.modal-editor.builders :refer [units-builder]]
[lernmeister.components.modal-editor.renderers
:refer
[editor-heading units-renderer]]))
[lernmeister.components.modal-editor.renderers :refer [units-renderer]]))
(defn units-editor [{:keys [subject path used-units change-fn collats-fn symbol-data]}]
(defn units-editor [{:keys [subject path used-units change-fn collats-fn]}]
(let [phys-val (get-in subject path)]
[:<>
[editor-heading symbol-data]
[units-renderer phys-val]
[units-builder {:units (:units phys-val)
:path path
......
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