Cancel
Apply to Collection
diff --git a/templates/collection_rules_templ.go b/templates/collection_rules_templ.go
index 2b2fc3fe..7135cf8e 100644
--- a/templates/collection_rules_templ.go
+++ b/templates/collection_rules_templ.go
@@ -89,9 +89,9 @@ func CollectionRules(user User, collection CollectionData, fieldsJSON string, tr
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var6 string
- templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.ResolveAttributeValue("initCollectionRules('" + collection.ID + "', '" + scope + "', " + JSONArg(treeJSON) + ")")
+ templ_7745c5c3_Var6, templ_7745c5c3_Err = templ.ResolveAttributeValue("initCollectionRules('" + collection.ID + "', '" + scope + "')")
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/collection_rules.templ`, Line: 24, Col: 102}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/collection_rules.templ`, Line: 24, Col: 75}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var6)
if templ_7745c5c3_Err != nil {
@@ -172,9 +172,9 @@ func CollectionRules(user User, collection CollectionData, fieldsJSON string, tr
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var10 string
- templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.ResolveAttributeValue(JSONArg(fieldsJSON))
+ templ_7745c5c3_Var10, templ_7745c5c3_Err = templ.ResolveAttributeValue(fieldsJSON)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/collection_rules.templ`, Line: 55, Col: 45}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/collection_rules.templ`, Line: 55, Col: 36}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var10)
if templ_7745c5c3_Err != nil {
@@ -187,7 +187,7 @@ func CollectionRules(user User, collection CollectionData, fieldsJSON string, tr
var templ_7745c5c3_Var11 string
templ_7745c5c3_Var11, templ_7745c5c3_Err = templ.ResolveAttributeValue(scope)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/collection_rules.templ`, Line: 56, Col: 24}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/collection_rules.templ`, Line: 56, Col: 23}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var11)
if templ_7745c5c3_Err != nil {
@@ -198,9 +198,9 @@ func CollectionRules(user User, collection CollectionData, fieldsJSON string, tr
return templ_7745c5c3_Err
}
var templ_7745c5c3_Var12 string
- templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.ResolveAttributeValue(JSONArg(treeJSON))
+ templ_7745c5c3_Var12, templ_7745c5c3_Err = templ.ResolveAttributeValue(treeJSON)
if templ_7745c5c3_Err != nil {
- return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/collection_rules.templ`, Line: 57, Col: 34}
+ return templ.Error{Err: templ_7745c5c3_Err, FileName: `templates/collection_rules.templ`, Line: 57, Col: 25}
}
_, templ_7745c5c3_Err = templ_7745c5c3_Buffer.WriteString(templ_7745c5c3_Var12)
if templ_7745c5c3_Err != nil {
@@ -210,7 +210,7 @@ func CollectionRules(user User, collection CollectionData, fieldsJSON string, tr
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
- templ_7745c5c3_Err = FilterBuilderRows("items").Render(ctx, templ_7745c5c3_Buffer)
+ templ_7745c5c3_Err = FilterBuilderRows("item").Render(ctx, templ_7745c5c3_Buffer)
if templ_7745c5c3_Err != nil {
return templ_7745c5c3_Err
}
diff --git a/templates/filter_builder.templ b/templates/filter_builder.templ
index 498dd714..c8385dd2 100644
--- a/templates/filter_builder.templ
+++ b/templates/filter_builder.templ
@@ -10,7 +10,7 @@ templ FilterBuilderRows(countNoun string) {
-
+
+ rule
@@ -19,7 +19,7 @@ templ FilterBuilderRows(countNoun string) {
-
+
@@ -60,8 +60,8 @@ templ FilterBuilderRows(countNoun string) {
-
-
+
+
-
diff --git a/templates/filter_builder_templ.go b/templates/filter_builder_templ.go
index 5ababd60..acbdc3cc 100644
--- a/templates/filter_builder_templ.go
+++ b/templates/filter_builder_templ.go
@@ -35,7 +35,7 @@ func FilterBuilderRows(countNoun string) templ.Component {
templ_7745c5c3_Var1 = templ.NopComponent
}
ctx = templ.ClearChildren(ctx)
- templ_7745c5c3_Err = templruntime.WriteString(templ_7745c5c3_Buffer, 1, " 0 ? 'fb-nested' : ''\" class=\"flex items-center gap-1.5 flex-wrap py-1\" :style=\"`margin-left:${row.depth * 14}px`\"> + rule + group ×
0\">
+ Rule + Group
0 ? 'fb-nested' : ''\" class=\"flex items-center gap-1.5 flex-wrap py-1\" :style=\"'margin-left:' + (row.depth * 14) + 'px'\"> + rule + group ×
0\">
+ Rule + Group
{
const token = localStorage.getItem("token");
if (!token) {
diff --git a/web/src/filter_builder.ts b/web/src/filter_builder.ts
index 88d5081a..04d0c8e5 100644
--- a/web/src/filter_builder.ts
+++ b/web/src/filter_builder.ts
@@ -393,10 +393,10 @@ function filterBuilderData() {
// applyCollectionTree delegates to the page-registered hook (the
// collection editor PUTs the tree; All-Books never sets one).
applyCollectionTree(): void {
- const hook = (
- window.Alpine?.store("collectionTreeApply") as { hook?: (wire: string) => void } | undefined
- )?.hook;
- if (hook) hook(this.treeJSON());
+ const store = Alpine.store("collectionTreeApply") as
+ | { hook?: (wire: string) => void }
+ | undefined;
+ if (store?.hook) store.hook(this.treeJSON());
},
// Rule tree (source of truth; hidden wire inputs are synced after
// every mutation).
@@ -426,6 +426,20 @@ function filterBuilderData() {
fieldMeta(key: string): FieldMeta | undefined {
return FIELD_BY_KEY.get(key);
},
+ // CSP-safe accessor: attribute expressions cannot use optional
+ // chaining (the CSP parser rejects `?.`), so the null-walk lives
+ // here.
+ fieldIsDays(key: string): boolean {
+ return this.fieldMeta(key)?.valueKind === "days";
+ },
+ // CSP-safe click-outside for the value menu (attribute expressions
+ // cannot carry if-statements).
+ dismissSuggestions(e: Event): void {
+ const target = e.target as HTMLElement | null;
+ if (!target || !target.closest(".fb-value-cell")) {
+ this.suggestionsOpen = "";
+ }
+ },
fieldLabelOf(key: string): string {
return FIELD_BY_KEY.get(key)?.label ?? "Field";
},