Note that there are some explanatory texts on larger screens.

plurals
  1. POLift (Scala) nested snippets (multiple items per day)
    primarykey
    data
    text
    <p>Trying to get started with Scala by playing around with the Lift framework and I'm having trouble creating what I imagined would be typify a common scenario: I have a list of days and for each day a list of items for that day (nested lists).</p> <p>My thought was to take this approach:</p> <pre><code>&lt;div class="lift:DaySnippet"&gt; &lt;h1 class="day"&gt;Name of Day&lt;/h1&gt; &lt;ul class="day-items"&gt; &lt;!-- wanted to have a separate snippet but haven't made it work --&gt; &lt;!-- &lt;li class="lift:DayItemSnippet"&gt;Item content&lt;/li&gt; --&gt; &lt;li class="item"&gt; &lt;span class="name"&gt;Name&lt;/span&gt; &lt;span class="desc"&gt;Description&lt;/span&gt; &lt;/li&gt; &lt;/ul&gt; &lt;/div&gt; </code></pre> <p>Originally I wasn't going to have the inner snippet but thought that made sense.</p> <p>So I can define a snippet like this:</p> <pre><code>class DaySnippet { // Ignoring that this is a stupid way to define the data val days = ("Monday", ("Item 1", "Item 1 Description") :: Nil) :: ("Tuesday", ("Item 2", "Item 2 Description") :: ("Item 3", "Item 3 Description") :: Nil) :: Nil; def render = { // EDIT: Original code was broken, this is what I was trying to show "* *" #&gt; days.map { case (day, items) =&gt; ".day *" #&gt; day } } } </code></pre> <p>At any rate, I'm looking for some documents or examples of either nesting snippets and/or how to iterate over nested collections and use CssSels to modify the whole NodeSeq as we go.</p> <p>I'd be happy to add any additional information that might clarify.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload