added generate button

This commit is contained in:
bom 2021-08-30 14:31:57 +02:00
parent 39b2aaee87
commit ab5eb367b0

View file

@ -77,6 +77,14 @@
{:type :element :attrs {:name id :id id :class "form-control" :rows rows} :tag :textarea :content default-value} {:type :element :attrs {:name id :id id :class "form-control" :rows rows} :tag :textarea :content default-value}
(generate-feedback-tag id)]) (generate-feedback-tag id)])
(defn generate-button
[id
label]
{:type :element
:attrs {:type "button", :id id, :class "btn btn-primary"}
:tag :button
:content [label]})
(defn generate-output (defn generate-output
[id [id
label label
@ -91,7 +99,6 @@
{:type :element, :attrs {:class :needs-validation, :id :form}, :tag :form, :content []}) {:type :element, :attrs {:class :needs-validation, :id :form}, :tag :form, :content []})
; TODO: add br tags ; TODO: add br tags
; TODO: add generate button
(defn generate-content (defn generate-content
[] []
(conj (conj
@ -106,16 +113,17 @@
:aws-access-key-id \" aws-id \" :aws-access-key-id \" aws-id \"
:aws-secret-access-key \" aws-secret \" :aws-secret-access-key \" aws-secret \"
:restic-password \" restic-password \"}" :restic-password \" restic-password \"}"
5)))] 5)
(generate-button "generate-button" "Generate c4k yaml")))]
[(generate-output "c4k-keycloak-output" "Your c4k deployment.yaml:" 25)])) [(generate-output "c4k-keycloak-output" "Your c4k deployment.yaml:" 25)]))
(defn find-map (defn find-map
[zipper] [coll]
(postwalk #(if (and (map? %) (postwalk #(if (and (map? %)
(= (:class (:attrs %)) "container jumbotron")) (= (:class (:attrs %)) "container jumbotron"))
;replace instead of print later (assoc coll :content (generate-content))
(assoc zipper :content (generate-content)) %)
%) zipper)) coll))
; END REFACTOR ; END REFACTOR