Allows creation of a listing page that uses an interpreted subjourney in place of the implicit single-page form used for adding and editing.
Allows creation of a listing page that uses an interpreted subjourney in place of the implicit single-page form used for adding and editing.
case class MyClass(a: Boolean, b: String) type SubjourneyTell = NilTypes type SubjourneyAsk = Boolean :: String :: NilTypes def myclassSubjourney[F[_]: cats.Monad]( existing: List[MyClass], editIndex: Option[Int], messages: UniformMessages[Html] )( int: Language[F, SubjourneyTell, SubjourneyAsk] ): F[MyClass] = ??? implicit def myClassListing( implicit request: Request[AnyContent] ) = { interpreter.listingPageWM[MyClass]( subjourney[interpreter.WM](_,_,_)( create[SubjourneyTell, SubjourneyAsk](interpreter.messages(request)) ) ) }
the interpreted journey used for adding and editing. Accepts the existing list of entries, an index for editing (None if adding), and messages.
an optional journey to be invoked when deleting, must return a boolean
allows the entries to be ordered differently in the listing. By default they will be in the order added.
Produces pages for
List[A]
where a user can enter multiple items of a given datatype via a central page that enumerates the items already, allows them to add new items and edit or delete existing ones.There are two ways you can produce a listing - the first works by infering the page for
A
automatically. To use this approach simply use anask[List[A]]
in your journey and it will pick up and use the add/edit part from inference, falling back toInferFormField
if necessary.The second approach works by explicitly supplying a subjourney and interpreting this into a WebMonadConstructor, by using the
listingPageWM
method.