package sihl

  1. Overview
  2. Docs
The Sihl web framework

Install

dune-project
 Dependency

Authors

Maintainers

Sources

2.0.1.tar.gz
md5=52b28d3faac0a2243735285aa3f962aa
sha512=e7ff89bdba9f1afa3b115a056ae3d403f602685187a968485ea64a7cd1a18791f66b7480b682bf66acd3564dd89139162779d58a43c2389d785c98e246094a18

doc/sihl/Sihl/Web/Rest/module-type-VIEW/index.html

Module type Rest.VIEWSource

The VIEW interface needs to be implemented by a module that renders HTML.

Sourcetype t

t is the type of the resource.

Sourceval skip_index_fetch : bool

skip_index_fetch can be set to true if you want to take care of fetching the collection yourself. This is useful when the search function of the service is not powerful enough and you need to implement your own collection fetching.

Sourceval index : Rock.Request.t -> string -> (t list * int) -> query -> [> Html_types.html ] Tyxml.Html.elt Lwt.t

index request csrf resources returns a list of resource instances as HTML.

You can access the original request directly if needed.

The csrf token has to be included as hidden input element in the form.

Sourceval new' : Rock.Request.t -> string -> form -> [> Html_types.html ] Tyxml.Html.elt Lwt.t

new' request csrf form returns a form to create new instances of the resource as HTML.

You can access the original request directly if needed.

csrf token has to be included as hidden input element in the form.

form is the decoded and validated form from a previous request. It contains input names, submitted values and error messages. This is useful to display error messages on input elements or to populate the form with invalid input from the failed create request, so the user can fix it.

Sourceval show : Rock.Request.t -> t -> [> Html_types.html ] Tyxml.Html.elt Lwt.t

show request resource returns the resource instance as HTML. This is the detail view of an instance of the resource.

Sourceval edit : Rock.Request.t -> string -> form -> t -> [> Html_types.html ] Tyxml.Html.elt Lwt.t

edit request csrf form returns a form to edit an instance of the resource instance as HTML.

You can access the original request directly if needed.

csrf token has to be included as hidden input element in the form.

form is the decoded and validated form from a previous request. It contains input names, submitted values and error messages. This is useful to display error messages on input elements or to populate the form with invalid input from the failed create request, so the user can fix it.