Liking cljdoc? Tell your friends :D

wagoe.admin.core.ui.base

Shared admin UI primitives used across multiple ui.* sections.

Leaf namespace: URL helpers, field-value rendering, list-column width heuristics, and small formatting/label utilities. Must NOT require any other wagoe.admin.core.ui.* implementation namespace — it is the dependency root that the focused sections build on.

Shared admin UI primitives used across multiple ui.* sections.

Leaf namespace: URL helpers, field-value rendering, list-column width
heuristics, and small formatting/label utilities. Must NOT require any
other wagoe.admin.core.ui.* implementation namespace — it is the
dependency root that the focused sections build on.
raw docstring

current-list-urlclj

(current-list-url entity-name table-query filters)

Build the current admin list URL with filters/pagination applied.

Used to seed return-to on links that navigate away from a list view (notably the delegated create flow), so the user lands back on the same filtered/paginated page after cancel or success. Returns the plain /web/admin/<entity> when no meaningful query params exist.

Build the current admin list URL with filters/pagination applied.

Used to seed `return-to` on links that navigate away from a list view
(notably the delegated create flow), so the user lands back on the
same filtered/paginated page after cancel or success. Returns the
plain `/web/admin/<entity>` when no meaningful query params exist.
sourceraw docstring

datetime-input-offsetclj

(datetime-input-offset value input-zone server-zone)

The UTC offset value has when shown in input-zone, e.g. -05:00, or nil. The form sends it back beside the wall time so parse-datetime-input can tell the two occurrences of a repeated local time apart.

The UTC offset `value` has when shown in `input-zone`, e.g. `-05:00`, or nil.
The form sends it back beside the wall time so `parse-datetime-input` can
tell the two occurrences of a repeated local time apart.
sourceraw docstring

datetime-input-stepclj

(datetime-input-step formatted)

The step a datetime-local needs for formatted, the output of format-for-datetime-input: nil on the minute, "1" with seconds, "0.001" with milliseconds.

The default step is 60 seconds. A value with seconds is then a step mismatch and the browser refuses to submit the form — keeping the seconds without this would turn silent truncation into a form that cannot be saved.

The `step` a datetime-local needs for `formatted`, the output of
`format-for-datetime-input`: nil on the minute, "1" with seconds,
"0.001" with milliseconds.

The default step is 60 seconds. A value with seconds is then a step
mismatch and the browser refuses to submit the form — keeping the seconds
without this would turn silent truncation into a form that cannot be saved.
sourceraw docstring

default-date-formatclj

source

default-instant-formatclj

source

entity-create-urlclj

(entity-create-url entity-name entity-config)
(entity-create-url entity-name entity-config caller-url)

Resolve the URL used for the 'New' button on an entity.

Entities may expose a dedicated create flow via :create-redirect-url (e.g. split-table entities that cannot be created via the generic admin CRUD path). Falls back to /web/admin/<entity>/new when no override is configured.

When caller-url is provided AND the entity delegates via :create-redirect-url, the caller URL is threaded through as a return-to query parameter so the delegated flow (e.g. the user module's /web/users/new page) can bring the admin back to their current filtered/paginated list view on cancel or success. The value is URL-encoded to survive embedded &/= characters from filters and pagination.

caller-url is ignored for the non-delegated path because the generic admin create handler re-renders the default list view directly and does not honor return-to.

Resolve the URL used for the 'New' button on an entity.

Entities may expose a dedicated create flow via `:create-redirect-url`
(e.g. split-table entities that cannot be created via the generic admin
CRUD path). Falls back to `/web/admin/<entity>/new` when no override is
configured.

When `caller-url` is provided AND the entity delegates via
`:create-redirect-url`, the caller URL is threaded through as a
`return-to` query parameter so the delegated flow (e.g. the user
module's `/web/users/new` page) can bring the admin back to their
current filtered/paginated list view on cancel or success. The value
is URL-encoded to survive embedded `&`/`=` characters from filters
and pagination.

`caller-url` is ignored for the non-delegated path because the generic
admin create handler re-renders the default list view directly and
does not honor `return-to`.
sourceraw docstring

form-zonesclj

(form-zones display)

The zones a form renders and parses :instant fields in, from display: :input-zone (the client's, else the configured, else the server's — chosen by the shell) and :server-zone. Both come from the same map, so a form can never show in one zone and save in another (BOU-523).

The zones a form renders and parses :instant fields in, from `display`:
`:input-zone` (the client's, else the configured, else the server's — chosen
by the shell) and `:server-zone`. Both come from the same map, so a form can
never show in one zone and save in another (BOU-523).
sourceraw docstring

format-dateclj

(format-date value display)

Render a stored date for display. Same passthrough rule as format-instant.

Render a stored date for display. Same passthrough rule as `format-instant`.
sourceraw docstring

format-field-labelclj

(format-field-label field-name)

Format field name as human-readable label.

Args: field-name: Keyword field name

Returns: Capitalized string label

Format field name as human-readable label.

Args:
  field-name: Keyword field name

Returns:
  Capitalized string label
sourceraw docstring

format-for-date-inputclj

(format-for-date-input value)

Coerce a stored value to the YYYY-MM-DD an <input type="date"> accepts.

Returns nil when the value cannot be read as a date, so the caller can leave the input empty rather than feed it something the browser will drop.

Coerce a stored value to the `YYYY-MM-DD` an `<input type="date">` accepts.

Returns nil when the value cannot be read as a date, so the caller can leave
the input empty rather than feed it something the browser will drop.
sourceraw docstring

format-for-datetime-inputclj

(format-for-datetime-input value input-zone server-zone)

Coerce a stored timestamp to what an <input type="datetime-local"> accepts, as wall time in input-zone, at the precision the value has: YYYY-MM-DDTHH:mm on the minute, …:ss with seconds, …:ss.SSS with milliseconds.

The value is read as the instant it denotes (see ->instant) and shown in input-zone — the zone the form is also parsed back in, which is what makes an edit to another field leave it unchanged (BOU-519, BOU-523). Seconds are kept because the form submits every editable field; finer than milliseconds cannot survive the widget. Pair with datetime-input-step.

Coerce a stored timestamp to what an `<input type="datetime-local">`
accepts, as wall time in `input-zone`, at the precision the value has:
`YYYY-MM-DDTHH:mm` on the minute, `…:ss` with seconds, `…:ss.SSS` with
milliseconds.

The value is read as the instant it denotes (see `->instant`) and shown in
`input-zone` — the zone the form is also parsed back in, which is what makes
an edit to another field leave it unchanged (BOU-519, BOU-523). Seconds are
kept because the form submits every editable field; finer than
milliseconds cannot survive the widget. Pair with `datetime-input-step`.
sourceraw docstring

format-instantclj

(format-instant value display)

Render a stored timestamp for display, in display's zone and pattern.

The value is whatever JDBC produced — list-entities does no read-side coercion, so it is a String, java.sql.Timestamp, OffsetDateTime or LocalDateTime depending on the driver. Anything unparseable is passed through as-is rather than swallowed, so a format nobody anticipated stays visible.

Render a stored timestamp for display, in `display`'s zone and pattern.

The value is whatever JDBC produced — `list-entities` does no read-side
coercion, so it is a String, java.sql.Timestamp, OffsetDateTime or
LocalDateTime depending on the driver. Anything unparseable is passed
through as-is rather than swallowed, so a format nobody anticipated stays
visible.
sourceraw docstring

get-field-errorsclj

(get-field-errors errors field-name)

Extract errors for a specific field from validation result.

Args: errors: Validation errors map or vector field-name: Keyword field name

Returns: Vector of error messages for the field

Extract errors for a specific field from validation result.

Args:
  errors: Validation errors map or vector
  field-name: Keyword field name

Returns:
  Vector of error messages for the field
sourceraw docstring

list-column-stylesclj

(list-column-styles list-fields entity-config)

Given the ordered list-fields and the entity config, return a seq of Hiccup [:col {:style ...}] elements with proportional width:N% for the data columns. The select/actions framing columns are sized via CSS classes elsewhere, so widths here sum to 100% of the remaining data area.

Returns a seq (not a vector) so Hiccup splices the elements into the surrounding :colgroup rather than treating them as a single element.

Pure helper — no I/O.

Given the ordered list-fields and the entity config, return a seq of
Hiccup `[:col {:style ...}]` elements with proportional `width:N%` for the
data columns. The select/actions framing columns are sized via CSS classes
elsewhere, so widths here sum to 100% of the remaining data area.

Returns a seq (not a vector) so Hiccup splices the elements into the
surrounding `:colgroup` rather than treating them as a single element.

Pure helper — no I/O.
sourceraw docstring

list-column-weightclj

(list-column-weight field field-config)

Relative width weight for a list column, used to distribute table width proportionally instead of evenly.

Resolution order:

  1. Explicit :width in the field config (interpreted as a weight) wins.
  2. Otherwise derived from :type, with a name-based heuristic for strings (e.g. "description" gets more room than "status").

Pure: takes a field keyword + its config map, returns a positive number.

Relative width weight for a list column, used to distribute table width
proportionally instead of evenly.

Resolution order:
1. Explicit `:width` in the field config (interpreted as a weight) wins.
2. Otherwise derived from `:type`, with a name-based heuristic for strings
   (e.g. "description" gets more room than "status").

Pure: takes a field keyword + its config map, returns a positive number.
sourceraw docstring

parse-datetime-inputclj

(parse-datetime-input s input-zone server-zone)
(parse-datetime-input s input-zone server-zone preferred-offset)

Read what a datetime-local submitted — wall time in input-zone — and return the instant as an ISO string carrying server-zone's offset, or nil when it is not a date-time.

The offset is the server's, not UTC's, on purpose. Measured: PostgreSQL drops the zone of a value written into a TIMESTAMP column without one and keeps the wall time, so …10:00:50Z read back as 08:00:50Z on an Amsterdam server. With the server's offset the wall time is the server's own, which is right for a zone-less column; zone-aware columns and SQLite read the offset and get the exact instant either way (BOU-523).

Read what a datetime-local submitted — wall time in `input-zone` — and return
the instant as an ISO string carrying `server-zone`'s offset, or nil when it
is not a date-time.

The offset is the server's, not UTC's, on purpose. Measured: PostgreSQL
drops the zone of a value written into a TIMESTAMP column without one and
keeps the wall time, so `…10:00:50Z` read back as 08:00:50Z on an Amsterdam
server. With the server's offset the wall time is the server's own, which
is right for a zone-less column; zone-aware columns and SQLite read the
offset and get the exact instant either way (BOU-523).
sourceraw docstring

render-field-valueclj

(render-field-value field-name value field-config)
(render-field-value _field-name value field-config display)

Render field value for display in table or detail view.

Args: field-name: Keyword field name value: Field value to render field-config: Field configuration map display: Optional {:zone-id :date-time-format :date-format} from the shell. Absent, timestamps render at UTC in the default patterns — core may not read the machine's clock or zone.

Returns: Hiccup structure or string for display

Render field value for display in table or detail view.

Args:
  field-name: Keyword field name
  value: Field value to render
  field-config: Field configuration map
  display: Optional {:zone-id :date-time-format :date-format} from the shell.
           Absent, timestamps render at UTC in the default patterns — core
           may not read the machine's clock or zone.

 Returns:
   Hiccup structure or string for display
sourceraw docstring

url-encodeclj

(url-encode s)

URL-encode a string for use as a query-string value.

Required when threading return_to (or any contextual URL containing its own ?/& characters) through query parameters — otherwise the embedded & splits into a second top-level parameter and the receiving handler sees a truncated value.

URL-encode a string for use as a query-string value.

Required when threading `return_to` (or any contextual URL containing
its own `?`/`&` characters) through query parameters — otherwise the
embedded `&` splits into a second top-level parameter and the receiving
handler sees a truncated value.
sourceraw docstring

(workflow-state-link workflow)

An entity's workflow state, linking to its instance page, or a dash when it has no instance (BOU-563). workflow is {:instance-id :state}.

An entity's workflow state, linking to its instance page, or a dash when
it has no instance (BOU-563). `workflow` is {:instance-id :state}.
sourceraw docstring

cljdoc builds & hosts documentation for Clojure/Script libraries

Keyboard shortcuts
Ctrl+kJump to recent docs
←Move to previous article
→Move to next article
Ctrl+/Jump to the search field
× close