diff --git a/src/sb/app/account/data.cljc b/src/sb/app/account/data.cljc index b56db007..fdea59bb 100644 --- a/src/sb/app/account/data.cljc +++ b/src/sb/app/account/data.cljc @@ -50,12 +50,8 @@ {:member/entity [:entity/id :entity/kind :entity/title - {:image/avatar [:asset/link - :entity/id - {:asset/provider [:s3/bucket-host]}]} - {:image/background [:asset/link - :entity/id - {:asset/provider [:s3/bucket-host]}]}]}]}] + {:image/avatar [:entity/id]} + {:image/background [:entity/id]}]}]}] account-id) :member/_account (map #(u/lift-key % :member/entity)))) diff --git a/src/sb/app/domain_name/data.cljc b/src/sb/app/domain_name/data.cljc index 6e03139b..ca10383f 100644 --- a/src/sb/app/domain_name/data.cljc +++ b/src/sb/app/domain_name/data.cljc @@ -32,7 +32,7 @@ (when domain (if (str/includes? domain ".") domain - (str domain ".sb.com")))) + (str domain ".sparkboard.com")))) (defn unqualify-domain [domain] (when domain diff --git a/src/sb/app/entity/data.cljc b/src/sb/app/entity/data.cljc index 851ba555..df22b966 100644 --- a/src/sb/app/entity/data.cljc +++ b/src/sb/app/entity/data.cljc @@ -25,7 +25,26 @@ s- :string :db/fulltext true} :entity/parent (sch/ref :one) - :entity/kind {s- [:enum :board :org :collection :member :project :chat :chat.message :field]} + :entity/kind {s- [:enum + :org + :board + :collection + :member + :project + :field + :discussion + :post + :comment + :notification + :tag + :chat + :message + :roles + :account + :ballot + :site + :asset + :chat.message]} :entity/draft? {:doc "Entity is not yet published - visible only to creator/team" s- :boolean} :entity/description {:doc "Description of an entity (for card/header display)" diff --git a/src/sb/app/field/admin_ui.cljc b/src/sb/app/field/admin_ui.cljc index f7d37c65..af67b2f6 100644 --- a/src/sb/app/field/admin_ui.cljc +++ b/src/sb/app/field/admin_ui.cljc @@ -2,7 +2,7 @@ (:require [applied-science.js-interop :as j] [clojure.set :as set] [clojure.string :as str] - [inside-out.forms :as forms] + [inside-out.forms :as io] [promesa.core :as p] [re-db.api :as db] [sb.app.entity.data :as entity.data] @@ -99,10 +99,10 @@ (orderable-props {:group-id (goog/getUid ?options) :id (:sym ?option) :on-move (fn [{:keys [source side destination]}] - (forms/swap-many! ?options re-order - (get ?options source) - side - (get ?options destination)) + (io/swap-many! ?options re-order + (get ?options source) + side + (get ?options destination)) (save!))})] [:div.flex.gap-2.items-center.group.relative.-ml-6.py-1 (merge {:key @?value} @@ -130,7 +130,7 @@ (radix/simple-alert! {:message "Are you sure you want to remove this?" :confirm-text (tr :tr/remove) :confirm-fn (fn [] - (forms/remove-many! ?option) + (io/remove-many! ?option) (p/do (save!) (radix/close-alert!)))}))} (tr :tr/remove)]]}]])) @@ -139,10 +139,10 @@ persisted-value]}] (let [memo-by [(str (map :field-option/value persisted-value))] {:syms [?options]} (h/use-memo (fn [] - (forms/form (?options :many {:field-option/label ?label + (io/form (?options :many {:field-option/label ?label :field-option/value ?value :field-option/color ?color} - :init (mapv #(set/rename-keys % '{:field-option/label ?label + :init (mapv #(set/rename-keys % '{:field-option/label ?label :field-option/value ?value :field-option/color ?color}) @?field)))) memo-by)] @@ -155,13 +155,13 @@ (into [:div.flex-v] (map (partial show-option {:?options ?options :save! save!}) ?options)) - (let [?new (h/use-memo #(forms/field :init "") memo-by)] + (let [?new (h/use-memo #(io/field :init "") memo-by)] [:form.flex.gap-2 {:on-submit (fn [^js e] (.preventDefault e) - (forms/add-many! ?options {'?value (str (random-uuid)) + (io/add-many! ?options {'?value (str (random-uuid)) '?label @?new '?color "#ffffff"}) - (forms/try-submit+ ?new (save!)))} + (io/try-submit+ ?new (save!)))} [field.ui/text-field ?new {:placeholder "Option label" :wrapper-class "flex-auto"}] [:div.btn.bg-white.px-3.py-1.shadow "Add Option"]]) #_[ui/pprinted @?options]]))) @@ -236,13 +236,13 @@ (field-editor-detail parent attribute field))])) (ui/defview fields-editor [entity attribute] - (let [label (:label (forms/global-meta attribute)) + (let [label (:label (io/global-meta attribute)) !new-field (h/use-state nil) !autofocus-ref (ui/use-autofocus-ref) fields (get entity attribute) [expanded expand!] (h/use-state nil)] [:div.field-wrapper {:class "labels-semibold"} - (when-let [label (or label (form.ui/attribute-label attribute))] + (when-let [label (or label (:label (io/global-meta attribute)))] [:label.field-label {:class "flex items-center"} label [:div.flex.ml-auto.items-center @@ -252,13 +252,13 @@ "Add Field"] :children (for [[type {:keys [icon label]}] data/field-types] [{:on-select #(reset! !new-field - (forms/form {:field/type ?type + (io/form {:field/type ?type :field/label ?label :field/published? (case type :field.type/select false true)} - :init {'?type type} - :required [?label]))} + :init {'?type type} + :required [?label]))} [:div.flex.gap-4.items-center.cursor-default [icon "text-gray-600"] label]])}))]]) [:div.flex-v.border.rounded.labels-sm (->> fields @@ -277,7 +277,7 @@ [:form.flex.gap-2.items-start.relative {:on-submit (ui/prevent-default (fn [e] - (forms/try-submit+ ?new-field + (io/try-submit+ ?new-field (p/let [{:as result :keys [field/id]} (data/add-field nil (:entity/id entity) attribute @?new-field)] (expand! id) (reset! !new-field nil) diff --git a/src/sb/app/field/ui.cljc b/src/sb/app/field/ui.cljc index beda2e93..942bbab1 100644 --- a/src/sb/app/field/ui.cljc +++ b/src/sb/app/field/ui.cljc @@ -82,7 +82,7 @@ [:input.h-5.w-5.rounded.border-gray-300.text-primary (form.ui/pass-props props)] [:div.flex-v.gap-1.ml-2 - (when-let [label (form.ui/get-label ?field (:label props))] + (when-let [label (form.ui/get-label (:label props) ?field)] [:div.flex.items-center.h-5 label]) (when (seq messages) (into [:div.text-gray-500] (map form.ui/view-message) messages))]]])) diff --git a/src/sb/app/form/ui.cljc b/src/sb/app/form/ui.cljc index 8e2de0a3..06d9d66e 100644 --- a/src/sb/app/form/ui.cljc +++ b/src/sb/app/form/ui.cljc @@ -30,17 +30,11 @@ :can-edit? :label)) -(defn attribute-label [attribute] - (or (get-in forms/global-meta [attribute :label]) - (tr* (keyword "tr" (name attribute))))) - -(defn get-label [?field label] - (u/some-or label - (:label ?field) - (some->> (:attribute ?field) attribute-label))) +(defn get-label [label ?field] + (u/some-or label (:label ?field))) (defn show-label [?field & [label]] - (when-let [label (get-label ?field label)] + (when-let [label (get-label label ?field)] [:label.field-label {:for (field-id ?field)} label])) (defn ?field-props [?field diff --git a/src/sb/client/core.cljs b/src/sb/client/core.cljs index a7826780..27f264d2 100644 --- a/src/sb/client/core.cljs +++ b/src/sb/client/core.cljs @@ -65,7 +65,10 @@ (cond-> (k field-meta) validator (update :validators conj validator)))) - (forms/set-global-meta! app/global-field-meta) + (forms/set-global-meta! (fn [k] + (when k + (merge {:label (sb.i18n/tr* (keyword "tr" (name k)))} + (app/global-field-meta k))))) ) (defn ^:dev/after-load init-endpoints! [] diff --git a/src/sb/schema.cljc b/src/sb/schema.cljc index 4e7c47b0..8591abb4 100644 --- a/src/sb/schema.cljc +++ b/src/sb/schema.cljc @@ -218,13 +218,11 @@ :member "a3" :project "a4" :field "a5" - :entry "a6" :discussion "a7" :post "a8" :comment "a9" :notification "aa" :tag "ab" - :tag-spec "ac" :chat "ad" :message "ae" :roles "af" diff --git a/src/sb/server/assets.clj b/src/sb/server/assets.clj index d68eb334..f577fc10 100644 --- a/src/sb/server/assets.clj +++ b/src/sb/server/assets.clj @@ -103,7 +103,7 @@ :entity/created-by account-id} (validate/assert :asset/as-map))]) {:status 200 - :body {:entity/id asset-id}}))) + :body [:entity/id asset-id]}))) (defn resizable? [content-type] (not (contains? #{"image/svg+xml" "image/gif"} content-type)))