Skip to content

Instantly share code, notes, and snippets.

@freewind
Created November 20, 2011 14:58
Show Gist options
  • Save freewind/1380330 to your computer and use it in GitHub Desktop.
Save freewind/1380330 to your computer and use it in GitHub Desktop.
package ebb
package snippet
import net.liftweb.http._
import net.liftweb.util._
import net.liftweb.common._
import ebb.model.Models._
import ebb.util.FaqReader
import org.squeryl._
import PrimitiveTypeMode._
import net.liftweb.util.Helpers._
import java.util._
import java.text._
object FaqSnippet {
def questionList: CssSel = {
"#faq-contents" #> (for (groupName <- FaqReader.getGroupNames) yield {
"._cat_name" #> groupName &
"ul" #> (for (faq <- FaqReader.getFaqList(groupName)) yield {
"._question_entry" #> <a href={ "/faq.html?id=" + faq.key }>question.question</a>
})
})
}
def show: CssSel = {
"*" #> (S.param("q") match {
case Full(q) => FaqReader.getFaq(q) match {
case Some(faq) => {
"._question_title" #> faq.question &
"._question_answer" #> faq.answer
}
case _ => ""
}
case _ => ""
})
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment