Commit caa0c371 authored by Joachim Schunk's avatar Joachim Schunk

adapt additional-descriptions to bulma

parent af5912e3
......@@ -20,44 +20,41 @@
(get-collats-for-vec [:core :assocs] assocs-indices {:additional-description-id nil}))))
(defn descriptions-tab [{:keys [id descriptions description-ids assocs change-fn exercise-atom]}]
[:<>
[:div.is-block
[:div.row
[:div.col.s12.valign-wrapper {:style {:justify-content "space-between"}}
[:div.input-field
[:input {:type "text"
:value (get-in descriptions [id :name])
:on-change #(change-fn [:core :additional-descriptions id :name] (-> % .-target .-value))}]
[:label.active "Benennung"]]
[:div.right-align
[ui/field {:addons? true}
[:div.control
[:a.button.is-static "Benennung"]]
[ui/input-text {:expanded? true
:value (get-in descriptions [id :name])
:on-change #(change-fn [:core :additional-descriptions id :name] %)}]
[:div.control
[:a.button.is-danger
{:on-click #(change-fn [:core :additional-descriptions] (dissoc descriptions id)
(description-delete-collats assocs description-ids id))}
[:span.icon [:i.fas.fa-trash]]]]]]
[:div.row
[:div.col.s12
[c-edit/editor (reagent/cursor exercise-atom [:core :additional-descriptions id :content])]]]])
[:div.vspace]
[c-edit/editor (reagent/cursor exercise-atom [:core :additional-descriptions id :content])]])
(defn additional-descriptions-input [{:keys [descriptions description-ids assocs change-fn exercise-atom]}]
[:div.new-question.card-panel.z-depth-3
[ui/card {:title "Ergänzende Beschreibungen"
#_[:h6 " Ergänzende Beschreibungen"]}
[:<>
(when (not-empty descriptions)
[ui/scrollable-tabs
{:tabs (into [] (map
(fn [description]
{:id (key description)
:title (:name (val description))
:component [descriptions-tab {:id (key description)
:descriptions descriptions
:description-ids description-ids
:assocs assocs
:change-fn change-fn
:exercise-atom exercise-atom}]})
descriptions))}])
[:a.button.is-primary
{:on-click #(change-fn [:core :additional-descriptions]
(assoc descriptions (get-unique-id "mscadd")
(get-new-description (count descriptions))))}
[:span.icon [:i.fas.fa-plus]]]]]])
[ui/card {:title "Ergänzende Beschreibungen"}
[:<>
(when (not-empty descriptions)
[ui/scrollable-tabs
{:tabs (into [] (map
(fn [description]
{:id (key description)
:title (:name (val description))
:component [descriptions-tab {:id (key description)
:descriptions descriptions
:description-ids description-ids
:assocs assocs
:change-fn change-fn
:exercise-atom exercise-atom}]})
descriptions))}])
[:a.button.is-primary
{:on-click #(change-fn [:core :additional-descriptions]
(assoc descriptions (get-unique-id "mscadd")
(get-new-description (count descriptions))))}
[:span.icon [:i.fas.fa-plus]]]]]])
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