From 4e4dc2422108e7d1a310aabd5fee2eeb5cf851f6 Mon Sep 17 00:00:00 2001 From: Laurence Chen Date: Fri, 23 Aug 2024 04:02:32 +0800 Subject: [PATCH] finish the frontend of profile editing --- src/co/gaiwan/compass/html/profiles.clj | 2 +- src/co/gaiwan/compass/routes/profiles.clj | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/co/gaiwan/compass/html/profiles.clj b/src/co/gaiwan/compass/html/profiles.clj index eee38b1..be86071 100644 --- a/src/co/gaiwan/compass/html/profiles.clj +++ b/src/co/gaiwan/compass/html/profiles.clj @@ -165,7 +165,7 @@ (map-indexed (fn [idx itm] [row itm {:row-index idx}]) links))]] - [:input#rows-count {:type "hidden" :name "rows-count" :value 0}] + [:input#rows-count {:type "hidden" :name "rows-count" :value (count (queries/all-links (:db/id user)))}] [:input#add-link {:type "button" :value "Add Links" :hx-get (url-for :profile/add-link) :hx-target "#links-block" diff --git a/src/co/gaiwan/compass/routes/profiles.clj b/src/co/gaiwan/compass/routes/profiles.clj index be4846d..8ad4bfd 100644 --- a/src/co/gaiwan/compass/routes/profiles.clj +++ b/src/co/gaiwan/compass/routes/profiles.clj @@ -58,6 +58,10 @@ :profile-link/user user-id :profile-link/type type-val :profile-link/href href-val}] + (tap> {:cond1 [link-id-val (private-profile-links link-id-val) (nil? private-link-val)] + :cond2 [link-id-val (nil? (private-profile-links link-id-val)) private-link-val] + :cond3 [link-id-val (public-profile-links link-id-val) (nil? public-link-val)] + :cond4 [link-id-val (nil? (public-profile-links link-id-val)) public-link-val]}) (cond-> [profile-data] ;; new profile-link (and (nil? link-id-val) private-link-val)