From 213111247fe5884fdac95eb481888f532ec16d5a Mon Sep 17 00:00:00 2001 From: Gabriel Horner Date: Wed, 22 Jan 2025 16:44:22 -0500 Subject: [PATCH] fix: `Show as checkbox` config showing up on a property's page when it doesn't apply there. Also clarify desc so user understands when the configuration applies to a node vs tagged nodes --- .../frontend/components/property/config.cljs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/src/main/frontend/components/property/config.cljs b/src/main/frontend/components/property/config.cljs index 479f4c9062..dcbc06e3e4 100644 --- a/src/main/frontend/components/property/config.cljs +++ b/src/main/frontend/components/property/config.cljs @@ -706,25 +706,25 @@ :on-select (fn [] (shui/popup-hide-all!) (route-handler/redirect-to-page! (:block/uuid property)))}})]) - (when enable-closed-values? + (when (and enable-closed-values? owner-block) (let [values (:property/closed-values property)] (when (>= (count values) 2) (let [checked? (contains? - (set (map :db/id (:logseq.property/checkbox-display-properties owner-block))) - (:db/id property))] - (dropdown-editor-menuitem - {:icon :checkbox :title "Show as checkbox on node" - :disabled? config/publishing? - :desc (when owner-block - (shui/switch - {:id "show as checkbox" :size "sm" - :checked checked? - :on-click util/stop-propagation - :on-checked-change - (fn [value] - (if value - (db-property-handler/set-block-property! (:db/id owner-block) :logseq.property/checkbox-display-properties (:db/id property)) - (db-property-handler/delete-property-value! (:db/id owner-block) :logseq.property/checkbox-display-properties (:db/id property))))}))}))))) + (set (map :db/id (:logseq.property/checkbox-display-properties owner-block))) + (:db/id property))] + (dropdown-editor-menuitem + {:icon :checkbox + :title (if class-schema? "Show as checkbox on tagged nodes" "Show as checkbox on node") + :disabled? config/publishing? + :desc (shui/switch + {:id "show as checkbox" :size "sm" + :checked checked? + :on-click util/stop-propagation + :on-checked-change + (fn [value] + (if value + (db-property-handler/set-block-property! (:db/id owner-block) :logseq.property/checkbox-display-properties (:db/id property)) + (db-property-handler/delete-property-value! (:db/id owner-block) :logseq.property/checkbox-display-properties (:db/id property))))})}))))) (when (and owner-block ;; Any property should be removable from Tag Properties