Skip to main content

View action

Buttons on views that open pre-filled forms: result and entry actions, visibility, mappings, fill modes and fill queries.

What an action is​

An action is a button on a view that opens a publish form, pre-filled from where it was clicked. "Add member…" on a member list, "edit…" on a paragraph, "approve" on a pending term are all actions. An action names the template to open, which field of that template receives the page's resource, and who may see the button.

Actions are what make a page editable rather than merely readable: every change a visitor can make from a page goes through one, and each results in a new nanopublication.

Nanopublication · Open in Nanodash

Two places for a button​

A result action belongs to the view as a whole and sits in its header: "add paragraph…", "ask a question…". An entry action belongs to each row and sits in the row's menu: "edit…", "retract", "approve". A view can have any number of each.

A header view, having no rows, can carry result actions only, which makes it a way to give a section of a page a heading with buttons.

Nanopublication · Open in Nanodash

Who sees a button​

Each action says which visitors see it: everyone, or holders of a role tier in the page's space — admin, maintainer, member or observer, each including the tiers above it — or holders of one specific role. On a person's own page, the person counts as admin.

This decides only what is offered. Whether a published nanopublication takes effect is judged separately, by the roles its signer actually holds, so hiding a button is a convenience for visitors rather than a lock.

Nanopublication · Open in Nanodash

Filling the form from the row​

An entry action can carry values from its row into the form, by mapping result columns to template fields: the row's term URI into a "term" field, its title into a "title" field. A mapping can also lock the field it fills, for values the action decides rather than proposes. Columns used this way are hidden from the table, so a column that should stay visible is duplicated in the query under a second name for the mapping.

A row's button disappears when a mapped value the template requires is empty for that row — which is how a query hides "retract" on rows the visitor did not publish, by leaving the value blank for everyone else.

Nanopublication · Open in Nanodash

Editing existing nanopublications​

Instead of a field, a mapping can name how the form is opened on the row's nanopublication: to supersede it, making a new version; to derive from it, making a new thing; or to override it, re-editing the same thing under a different key. The form opens filled with the nanopublication's content.

Override is what lets a member correct another member's contribution in place; it works when the row's nanopublication is the one that introduced the thing being edited.

Nanopublication · Open in Nanodash

Filling the form from the page​

A result action can carry its own small query, run against the page's resource when the form opens, whose first row pre-fills fields: a new presentation's date from the event's date, a question's context from the space's description. The values are defaults, not locks, unless the mapping locks them.

Because the query, not the visitor, decides what is suggested, it should read only from sources the page's community controls — the resource's own current definition, its space's members — and never from anything anyone on the network could have published about the resource.

Nanopublication · Open in Nanodash

This page is a copy of the topic View action of the Nanopublication Docs. Each paragraph is a nanopublication. In Nanodash you also find their examples, related paragraphs, and version history, and members of the nanopub space can edit them there.