ads

package
v0.0.32 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2026 License: MIT Imports: 10 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

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(text string) g.Node

DescriptionTextWithLinks renders description text with https URLs linked.

func FilterModalName added in v0.0.27

func FilterModalName(key string) string

FilterModalName is the modal id prefix for a facet editor.

func LocationInput

func LocationInput(id, name, value, placeholder string,
	inputClass ...string) g.Node

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

func NewAdFieldsPartial(facets []facet.Def, defaults facet.FormDefaults) g.Node

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

func SearchFilterModalBody(d facet.Def, filter facet.Filter) g.Node

SearchFilterModalBody is the editable form fields for a facet modal.

func SearchFilterPills added in v0.0.27

func SearchFilterPills(facets []facet.Def, f SearchFilters,
	categoryControl g.Node) g.Node

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.

func WithinSelect

func WithinSelect(id string, selected int, options []int, suffix string,
	inputClass ...string) g.Node

WithinSelect renders the within-distance dropdown.

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 AdFormMode

type AdFormMode int
const (
	AdFormCreate AdFormMode = iota
	AdFormEdit
)

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

type CategoryOption struct {
	ID        int
	Name      string
	ImageFile string
}

CategoryOption is a category choice for the search filter select.

type PriceRowView

type PriceRowView struct {
	IsFree   bool
	IsWanted bool
	Amount   string
	Currency string
}

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

type SuggestionOption struct {
	Label    string
	Value    string
	Selected bool
}

SuggestionOption holds one LLM suggestion pill on the new-ad form.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL