Ab sofort ist der Login auf der Weboberfläche von git.fh-muenster.de bevorzugt über FH Muenster SSO möglich.

Commit c1e2374c authored by Bruno Burke's avatar Bruno Burke 😁

fix metadata-settings in content editor

parent 088f8177
......@@ -22,17 +22,16 @@
(let [difficulty (get-in @metadata [:difficulty])]
[:div.exercise-metadata
[:div
[:p.range-field
[:label.active {:for "exercise-difficulty"} "Schwierigkeitsgrad " difficulty " "]
[:div.range-field
[:span (when difficulty
[:a {:on-click #(swap! metadata dissoc :difficulty)} "(zurücksetzen)"])]
[:input {:id "exercise-difficulty"
:type "range"
:min 0
:max 100
:step 10
:value (get-in @metadata [:difficulty])
:on-change #(swap! metadata assoc :difficulty (-> % .-target .-value))}]]]]))}))
[ui/input-range
{:min 0
:max 100
:step 10
:label "Schwierigkeitsgrad"
:value (get-in @metadata [:difficulty])
:on-change #(swap! metadata assoc :difficulty %)}]]]]))}))
(defn exercise-preview [exercise answer]
(let [result (reagent/atom nil)
......@@ -71,17 +70,17 @@
[:p.flow-text "Bitte generieren Sie eine Beispielaufgabe."])
(if @modified?
[:a.button {:on-click #(do
(reset! answer nil)
(reset! built-exercise (e-build/build exercise))
(reset! prepared-exercise (e-prepare/prepare @built-exercise))
(reset! modified? false))}
(reset! answer nil)
(reset! built-exercise (e-build/build exercise))
(reset! prepared-exercise (e-prepare/prepare @built-exercise))
(reset! modified? false))}
"Beispielaufgabe generieren"]
[:a.button {:on-click #(if @result
(reset! result nil)
(reset! result (e-check/check-answer
@built-exercise
@answer
println)))}
(reset! result nil)
(reset! result (e-check/check-answer
@built-exercise
@answer
println)))}
(if @result
"Ergebnis zurücksetzen"
"Aufgabe überprüfen")])
......@@ -113,16 +112,16 @@
(fn [exercise]
[:div {:style {:padding "15px"}}
[:a.button {:on-click #(reset! generated
(try
(string/replace
(with-out-str
(-> exercise
pprint))
;;#"\"data:([A-Za-z])*\;base64\,([A-Za-z0-9\/\+\=])*\""
#"\"data\:.{45,}\""
"\"%%%BASE64 DATA%%%\"")
(catch js/Error e
(str "ERROR - " e))))}
(try
(string/replace
(with-out-str
(-> exercise
pprint))
;;#"\"data:([A-Za-z])*\;base64\,([A-Za-z0-9\/\+\=])*\""
#"\"data\:.{45,}\""
"\"%%%BASE64 DATA%%%\"")
(catch js/Error e
(str "ERROR - " e))))}
[ui/icon "fa-code"]
[:span "EDN Code generieren"]]
[:pre {:style {:overflow :auto}}
......@@ -151,38 +150,38 @@
"Einstellungen"
]]
[:div.card-content
(when (not-empty @error)
[:div.card-panel
[:span
[:p.red-text "ERROR"]
(let [lines (clojure.string/split-lines @error)]
(for [line lines]
[:p {:key (hash line)} line]))]])
(when exercise-types
[ui/select*
{:cursor (reagent/cursor exercise [:core :type])
:options (mapv #(hash-map :key (first %) :title (second %)) exercise-types)
:label "Typ"}])
[:div
[:label "Aufgabenstellung"]
[content-editor/editor (reagent/cursor exercise [:core :task-description])]]
(when-let [settings-dialog (get-method ex-edit/show-settings type)]
^{:key (str "settings-" type)}
[settings-dialog exercise options])]]
(when (not-empty @error)
[:div.card-panel
[:span
[:p.red-text "ERROR"]
(let [lines (clojure.string/split-lines @error)]
(for [line lines]
[:p {:key (hash line)} line]))]])
(when exercise-types
[ui/select*
{:cursor (reagent/cursor exercise [:core :type])
:options (mapv #(hash-map :key (first %) :title (second %)) exercise-types)
:label "Typ"}])
[:div
[:label "Aufgabenstellung"]
[content-editor/editor (reagent/cursor exercise [:core :task-description])]]
(when-let [settings-dialog (get-method ex-edit/show-settings type)]
^{:key (str "settings-" type)}
[settings-dialog exercise options])]]
(when-let [additional-forms-dialog (get-method ex-edit/show-additional-forms type)]
^{:key (str "aforms-" type)}
[additional-forms-dialog exercise options])
[ui/collapsible
{:elements
[{:label "EDN"
:icon "code"
:content [edn-code @exercise]}
{:label "Vorschau"
:icon "video_label"
:content (when (and @exercise type)
[exercise-preview @exercise (or answer answer-local)])}
{:label "Metainformationen"
:icon "settings_ethernet"
:content [metadata-settings (reagent/cursor exercise [:metadata])]}]}]
[{:label "EDN"
:icon "code"
:content [edn-code @exercise]}
{:label "Vorschau"
:icon "video_label"
:content (when (and @exercise type)
[exercise-preview @exercise (or answer answer-local)])}
{:label "Metainformationen"
:icon "settings_ethernet"
:content [metadata-settings (reagent/cursor exercise [:metadata])]}]}]
]]]))})))
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