Commit a0bc95ea authored by Joachim Schunk's avatar Joachim Schunk

make formula-editor work again with bulma

parent c64d1d9b
Pipeline #45440 passed with stages
in 1 minute and 40 seconds
......@@ -187,7 +187,7 @@
[:&.active
{:opacity 1}]]
[:div.var-select {:cursor "pointer"}
[:&:hover {:color color-blue}]]
[:&:hover {:color color-info}]]
[:div.selectable-used-unit {:cursor "pointer"
:border-style "solid"
:border-width "1px"
......
......@@ -38,47 +38,44 @@
{:number (get-in authoring [(keyword id) :calc-mapping var-sign :number])}))
units-latex-str (build-units-latex-string (:units calc-mapping-val))]
[:tr
[:td var-sign]
[:td
[:td.is-vcentered var-sign]
[:td.is-vcentered
[ui/select
:label ""
:value (:precision calc-mapping-val)
:options decimal-places-options
:on-change #(change-fn (conj path :precision) (name %)
(collats-fn))]]
[:td [latex-span number-latex-str]]
[:td [latex-span units-latex-str]]
[:td action
#_{:class (:button-class action)
:on-click #((:click-fn action) var-sign)}
#_[:i.material-icons (:button-icon action)]]]))
{:value (:precision calc-mapping-val)
:options decimal-places-options
:on-change #(change-fn (conj path :precision) (name %)
(collats-fn))}]]
[:td.is-vcentered [latex-span number-latex-str]]
[:td.is-vcentered [latex-span units-latex-str]]
[:td.is-vcentered.has-text-right [:a.button {:class (:button-class action)
:on-click (partial (:on-click-fn action) var-sign)}
[:span.icon [:i.fas {:class (:icon-class action)}]]]]]))
(defn calc-mappings-input [{:keys [suffix id var-set calc-mapping with-oom change-fn path collats-fn
phrase-fn authoring action]}]
[:div.row
[:table
[:thead
[:tr
[:th (phrase-fn :var)]
[:th "Nachkommastellen"]
[:th "Testwert"]
[:th "Einheit"]
[:th ""]]]
[:tbody
(map
(fn [var]
^{:key (str "calc-mapping-" suffix "-" var)}
[calc-mapping-input
{:id id
:var-sign var
:calc-mapping-val (get calc-mapping var)
:with-oom with-oom
:change-fn change-fn
:path (conj path var)
:collats-fn collats-fn
:authoring authoring
:action action}])
var-set)]]])
[:table.table.is-fullwidth
[:thead
[:tr
[:th (phrase-fn :var)]
[:th "Nachkommastellen"]
[:th "Testwert"]
[:th "Einheit"]
[:th ""]]]
[:tbody
(map
(fn [var]
^{:key (str "calc-mapping-" suffix "-" var)}
[calc-mapping-input
{:id id
:var-sign var
:calc-mapping-val (get calc-mapping var)
:with-oom with-oom
:change-fn change-fn
:path (conj path var)
:collats-fn collats-fn
:authoring authoring
:action action}])
var-set)]])
(defn calc-mapping-builder [{:keys [id context-obj calc-mapping calc-mapping-var-set unassigned-var-set
with-oom change-fn path collats-fn phrase-fn authoring
......@@ -88,7 +85,7 @@
var-sign (get-in @local-state-atom [id-key :detail])]
(if var-sign
[:<>
[:h6 "Detailansicht"]
[:h5 "Detailansicht:"]
[calc-mappings-input
{:suffix "detail"
:id id
......@@ -100,14 +97,16 @@
:path path
:collats-fn collats-fn
:authoring authoring
:action [:a.button.is-success
{:on-click (fn [] (swap! local-state-cursor assoc :detail nil))}
[:span.icon [:i.fas.fa-arrow-left]]]}]
:action {:button-class "is-success"
:icon-class "fa-arrow-left"
:on-click-fn (fn [] (swap! local-state-cursor assoc :detail nil))}}]
[:div.vspace]
[value-builder {:phys-val (get-in authoring [id-key :calc-mapping var-sign])
:path [:authoring id-key :calc-mapping var-sign]
:number-key :number
:change-fn change-fn
:collats-fn collats-fn}]
[:div.vspace]
[units-builder {:units (get-in calc-mapping [var-sign :units])
:path (conj path var-sign)
:change-fn change-fn
......@@ -115,7 +114,7 @@
[:<>
(when (not-empty unassigned-var-set)
[:<>
[:h6.red-text (str (phrase-fn :vars) " ohne Formelzeichen")]
[:h5.has-text-danger (str (phrase-fn :vars) " ohne Formelzeichen:")]
[calc-mappings-input
{:suffix "unassigned"
:id id
......@@ -126,17 +125,12 @@
:phrase-fn phrase-fn
:path path
:authoring authoring
:action [:a.button.is-danger
{:on-click (fn [var-sign]
(change-fn path (dissoc calc-mapping var-sign)
[{: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]}]))}}]])
[:h6 (phrase-fn :vars)]
:action {:button-class "is-danger"
:icon-class "fa-trash"
:on-click-fn (fn [var-sign]
(change-fn path (dissoc calc-mapping var-sign)
[{:path [:authoring id-key :calc-mapping var-sign]}]))}}]])
[:h5 (str (phrase-fn :vars) ":")]
[calc-mappings-input
{:suffix "assigned"
:id id
......@@ -148,12 +142,14 @@
:collats-fn collats-fn
:phrase-fn phrase-fn
:authoring authoring
:action [:a.button.is-success
{:on-click (fn [var-sign]
(swap! local-state-cursor assoc :detail var-sign))}
[:span.icon [:i.fas.fa-arrow-right]]]}]
[:h6 "Einheit (Berechnungsergebnis)"]
:action {:button-class "is-success"
:icon-class "fa-arrow-right"
:on-click-fn (fn [var-sign]
(swap! local-state-cursor assoc :detail var-sign))}}]
[:h5 "Einheit des Berechnungsergebnisses:"]
[:div.vspace]
[units-renderer context-obj]
[:div.vspace]
[units-builder {:units (:units context-obj)
:path (pop path)
:change-fn change-fn
......@@ -193,6 +189,7 @@
:formula-change-fn (partial formula-change-fn
assignment-id calc-mapping-var-set path change-fn collats-fn)
:local-state-atom local-state-atom}]
[:div.vspace]
[calc-mapping-builder
{:id assignment-id
:context-obj context-obj
......
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