hide properties if none exist

integration-tests
Josha von Gizycki 6 years ago
parent acc9280f8a
commit 71ff06e3ca

@ -48,18 +48,20 @@
[:small (h (:name instance))]] [:small (h (:name instance))]]
[:p [:small [:a {:href (path :instance-edit-form instance)} [:p [:small [:a {:href (path :instance-edit-form instance)}
"Edit Instance"]]] "Edit Instance"]]]
[:h2 "Properties"] (when-not (empty? (:properties instance))
(for [prop (:properties instance) [:section.properties
:let [attr (:attribute prop) [:h2 "Properties"]
type (:type attr) (for [prop (:properties instance)
render-fn (case type :let [attr (:attribute prop)
"date" #(str (prettify-dt %)) type (:type attr)
"markdown" md/md-to-html-string render-fn (case type
:else #(str "<p>" % "</p>"))]] "date" #(str (prettify-dt %))
(list [:h3 (h (:name attr))] "markdown" md/md-to-html-string
[:div {:class (str "instance-content " :else #(str "<p>" % "</p>"))]]
"attr-type-" type)} (list [:h3 (h (:name attr))]
(render-fn (:value prop))])) [:div {:class (str "instance-content "
"attr-type-" type)}
(render-fn (:value prop))]))])
(when-not (empty? (:links-out instance)) (when-not (empty? (:links-out instance))
[:section.links [:section.links
[:h2 "Outgoing Links"] [:h2 "Outgoing Links"]

Loading…
Cancel
Save