Documentation
¶
Index ¶
- func AdFieldsPartial(cfg AdFormConfig, facets []facet.Def) g.Node
- func AdPriceRow(cfg AdFormConfig, d facet.Def, defaults facet.FormDefaults, view PriceRowView) g.Node
- func DescriptionTextWithLinks(text string) g.Node
- func FilterModalName(key string) string
- func LocationInput(id, name, value, placeholder string, inputClass ...string) g.Node
- func LocationSummaryText(f SearchFilters) string
- func NewAdFieldsPartial(facets []facet.Def, defaults facet.FormDefaults) g.Node
- func NewAdPriceRow(d facet.Def, defaults facet.FormDefaults, view PriceRowView) g.Node
- func SearchFilterModalBody(d facet.Def, filter facet.Filter) g.Node
- func SearchFilterPills(facets []facet.Def, f SearchFilters, categoryControl g.Node) g.Node
- func SearchLocationBar(f SearchFilters) g.Node
- func SearchLocationOOB(f SearchFilters) g.Node
- func SuggestionsFormName() string
- func SuggestionsPartial(opts []SuggestionOption) g.Node
- func WithinSelect(id string, selected int, options []int, suffix string, inputClass ...string) g.Node
- type AdFormConfig
- type AdFormMode
- type AdFormValues
- type CategoryOption
- type PriceRowView
- type SearchFilters
- type SuggestionOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AdFieldsPartial ¶
func AdFieldsPartial(cfg AdFormConfig, facets []facet.Def) g.Node
AdFieldsPartial renders create or edit ad fields for the given category facets.
func AdPriceRow ¶
func AdPriceRow(cfg AdFormConfig, d facet.Def, defaults facet.FormDefaults, view PriceRowView) g.Node
AdPriceRow renders the price facet. FREE and Wanted are exclusive; either one hides the amount and currency inputs.
func DescriptionTextWithLinks ¶
DescriptionTextWithLinks renders description text with https URLs linked.
func FilterModalName ¶ added in v0.0.27
FilterModalName is the modal id prefix for a facet editor.
func LocationInput ¶
LocationInput renders the shared location text field (search and new-ad forms).
func LocationSummaryText ¶
func LocationSummaryText(f SearchFilters) string
LocationSummaryText formats the location summary link label.
func NewAdFieldsPartial ¶
NewAdFieldsPartial renders new-ad fields for the given category facets.
func NewAdPriceRow ¶
func NewAdPriceRow(d facet.Def, defaults facet.FormDefaults, view PriceRowView) g.Node
NewAdPriceRow renders the price row for HTMX swaps on the create form.
func SearchFilterModalBody ¶ added in v0.0.27
SearchFilterModalBody is the editable form fields for a facet modal.
func SearchFilterPills ¶ added in v0.0.27
SearchFilterPills renders always-visible filter pills under the search box. categoryControl is the shared icon category picker from package ui.
func SearchLocationBar ¶
func SearchLocationBar(f SearchFilters) g.Node
SearchLocationBar renders the location summary link and hidden form fields.
func SearchLocationOOB ¶
func SearchLocationOOB(f SearchFilters) g.Node
SearchLocationOOB swaps #search-location out-of-band after the modal saves.
func SuggestionsFormName ¶
func SuggestionsFormName() string
SuggestionsFormName is the checkbox name for selected suggestion pills.
func SuggestionsPartial ¶
func SuggestionsPartial(opts []SuggestionOption) g.Node
SuggestionsPartial renders toggleable suggestion pills for HTMX swap.
Types ¶
type AdFormConfig ¶
type AdFormConfig struct {
Mode AdFormMode
AdID int
FormID string
FieldPrefix string
PostURL string
PriceFieldURL string
SuggestionsURL string
SubmitLabel string
Values AdFormValues
Defaults facet.FormDefaults
}
AdFormConfig configures shared create/edit ad form rendering.
func EditFormConfig ¶
func EditFormConfig(adID int, values AdFormValues, defaults facet.FormDefaults) AdFormConfig
EditFormConfig returns config for the edit-ad form.
func NewFormConfig ¶
func NewFormConfig(defaults facet.FormDefaults) AdFormConfig
NewFormConfig returns config for the create-ad form.
func NewFormConfigWithValues ¶
func NewFormConfigWithValues(defaults facet.FormDefaults, values AdFormValues) AdFormConfig
NewFormConfigWithValues returns create-ad config with prefilled values (e.g. copy-from-ad). Images are not prefilled.
type AdFormValues ¶
type AdFormValues struct {
Title string
OriginalDescription string
ImageCount int
Location string
Facets map[string]string
FacetFlags map[string]bool
FacetUnits map[string]string
PriceRow PriceRowView
Suggestions []SuggestionOption
}
AdFormValues holds pre-filled field values for edit mode.
type CategoryOption ¶ added in v0.0.22
CategoryOption is a category choice for the search filter select.
type PriceRowView ¶
PriceRowView holds state for the price row (initial render and HTMX swaps).
type SearchFilters ¶
type SearchFilters struct {
CategoryID int
Categories []CategoryOption
Facets map[string]facet.Filter
Location string
LocationDisplay string
Within int
WithinUnit string
WithinOptions []int
}
SearchFilters holds search filter pill state passed from handlers. CategoryID 0 means all categories.
type SuggestionOption ¶
SuggestionOption holds one LLM suggestion pill on the new-ad form.