Built-in VIEW Templates
A VIEW binds an HTML template to the leaves of an interface so that a value is
rendered by a dedicated widget instead of the default atomic template. The VIEW
syntax itself (VIEW … HTML TEMPLATE "View-X.html" ENDVIEW, and the LINKTO
form) is part of the Ampersand language; see
Interfaces and
Creating Custom VIEW Templates for
how to build your own.
This page documents the built-in VIEW templates the framework ships.
LINKTO
LINKTO turns a field into a navigation link to another interface. It is written
directly in the interface (no separate VIEW declaration needed):
"label" : expr LINKTO INTERFACE "InterfaceName"
expris any Ampersand expression."InterfaceName"must be an existing interface whose source concept matches the target concept ofexpr.
The target atom is rendered by the object widget (app-atomic-object,
View-LINKTO.html) and clicking it navigates to the named interface.
PROPERTY
PROPERTY renders a boolean (a [PROP] relation) as an on/off switch rather than
as text. Attach it as a DEFAULT view on a property concept, or reference it from
an interface field.
VIEW SomeProp : SomeConcept DEFAULT { … } HTML TEMPLATE "View-PROPERTY.html" ENDVIEW
The value is shown with a PrimeNG input switch (app-atomic-boolean,
View-PROPERTY.html); it is read-only when the field's CRUD does not allow
Update. For a click-to-toggle button (instead of a switch) use
BOX <PROPBUTTON> instead.
FILEOBJECT
FILEOBJECT is meant to let users upload and download files. The scripter sets it
up with an identity, two relations and a DEFAULT view:
IDENT FileObjectName: FileObject (filePath)
RELATION filePath[FileObject*FilePath] [UNI,TOT]
RELATION originalFileName[FileObject*FileName] [UNI,TOT]
REPRESENT FilePath, FileName TYPE ALPHANUMERIC
VIEW FileObject: FileObject DEFAULT
{ apiPath : TXT "api/v1/file"
, filePath : filePath
, fileName : originalFileName
} HTML TEMPLATE "View-FILEOBJECT.html" ENDVIEW
Known gap (Angular framework).
View-FILEOBJECT.htmlreferences anapp-atomic-fileobjectAngular component that is not present in the current frontend (frontend/src/app/shared/atomic-components/has noatomic-fileobject). Like the BOX annotations, this widget was not carried over in the AngularJS → Angular migration, so aFILEOBJECTfield does not render yet. Restoring it means adding theapp-atomic-fileobjectcomponent (upload/download against theapiPath). Tracked separately from the BOX-annotation work.