Mark Goldenstein
Mark Goldenstein

Reputation: 482

Scala / Lift: CSS Selector Transforms and DispatchSnippet

Is it possible to use Lift's CSS Selector Transforms together with DispatchSnippet? It does not seem to work for me.

Upvotes: 4

Views: 707

Answers (1)

Mark Goldenstein
Mark Goldenstein

Reputation: 482

Answering my own question... yeah, it is possible! My problem was the following: Snippet methods have to be of the type NodeSeq => NodeSeq but CSS Transformations return a () => CSSSel. A CSSSel is itself NodeSeq => NodeSeq, so the CSS Transformation is () => (NodeSeq => NodeSeq).

That means, in order to use it with DispatchSnippet it must be referenced like this in the dispatcher:

def dispatch: DispatchIt = {
  case "method1" => normalSnippetMethod _
  case "method2" => cssTransform // no _ !
}

Basically, I just had an extra _ sign at the end.

Upvotes: 4

Related Questions