Portable components of logic?

2 views
Skip to first unread message

Tim Perrett

unread,
Mar 23, 2009, 2:03:03 PM3/23/09
to Lift
Guys,

Has anyone got a good strategy for packaging up components of logic
within lift?

At our company we have a particular application that im writing some
really nice logic for inside lift and im wondering how I can package
that up and re-use it (short of copy and paste snippet files and the
various css / js files)?

I know we have a snippet search path, and thats cool as we can just
bundle a bunch of logic into seperate JARs, but what about view / UI
content? Perhaps some specially formated JAR layout with some kind of
extension to LiftRules that says "also look here for stuff"?

Thanks

Tim

David Pollak

unread,
Mar 23, 2009, 2:08:46 PM3/23/09
to lif...@googlegroups.com
Tim,

Look in LiftRules for SnippetDispatchPF

Yes, you can dispatch snippets to objects defined in other JARs.

Thanks,

David
--
Lift, the simply functional web framework http://liftweb.net
Beginning Scala http://www.apress.com/book/view/1430219890
Follow me: http://twitter.com/dpp
Git some: http://github.com/dpp

Timothy Perrett

unread,
Mar 23, 2009, 2:12:38 PM3/23/09
to lif...@googlegroups.com

Sure, I know this :)

But what about CSS etc, how can they then become resolvable / includable in html (and/or scala view) code?

Thanks

Tim


On 23/03/2009 18:08, "David Pollak" <feeder.of...@gmail.com> wrote:

David Pollak

unread,
Mar 23, 2009, 2:17:53 PM3/23/09
to lif...@googlegroups.com
On Mon, Mar 23, 2009 at 11:12 AM, Timothy Perrett <tim...@getintheloop.eu> wrote:

Sure, I know this :)

But what about CSS etc, how can they then become resolvable / includable in html (and/or scala view) code?

You could have the CSS reference generated in the Snippet.

You can also have views in code (see ViewDispatchPF) and do <lift:embed /> in your code to refer to the Scala-based view code.
 


Thanks

Tim


On 23/03/2009 18:08, "David Pollak" <feeder.of...@gmail.com> wrote:

Tim,

Look in LiftRules for SnippetDispatchPF

Yes, you can dispatch snippets to objects defined in other JARs.

Thanks,

David

On Mon, Mar 23, 2009 at 11:03 AM, Tim Perrett <tim...@getintheloop.eu> wrote:

Guys,

Has anyone got a good strategy for packaging up components of logic
within lift?

At our company we have a particular application that im writing some
really nice logic for inside lift and im wondering how I can package
that up and re-use it (short of copy and paste snippet files and the
various css / js files)?

I know we have a snippet search path, and thats cool as we can just
bundle a bunch of logic into seperate JARs, but what about view / UI
content? Perhaps some specially formated JAR layout with some kind of
extension to LiftRules that says "also look here for stuff"?

Thanks

Tim





Timothy Perrett

unread,
Mar 23, 2009, 2:57:00 PM3/23/09
to Lift

> You could have the CSS reference generated in the Snippet.

When you say "reference", are you referring to a style-sheet link or
the *actual* CSS itself?

> You can also have views in code (see ViewDispatchPF) and do <lift:embed />
> in your code to refer to the Scala-based view code.

I've seen ViewDispatchPF before - it is still somewhat mystical to me
i'm afraid! I understand that its possible to create new views etc -
any chance you can just give a quick example of how to use
ViewDispatchPF? Something like:

LiftRules.viewDispatch.append {
case "some" :: "path" :: Nil => ???
}

Cheers, Tim

David Pollak

unread,
Mar 23, 2009, 2:59:08 PM3/23/09
to lif...@googlegroups.com
On Mon, Mar 23, 2009 at 11:57 AM, Timothy Perrett <tim...@getintheloop.eu> wrote:


> You could have the CSS reference generated in the Snippet.

When you say "reference", are you referring to a style-sheet link or
the *actual* CSS itself?

Either.
 


> You can also have views in code (see ViewDispatchPF) and do <lift:embed />
> in your code to refer to the Scala-based view code.

I've seen ViewDispatchPF before - it is still somewhat mystical to me
i'm afraid! I understand that its possible to create new views etc -
any chance you can just give a quick example of how to use
ViewDispatchPF? Something like:

LiftRules.viewDispatch.append {
 case "some" :: "path" :: Nil => ???
}

Perhaps tomorrow.  I will be whipped into a mass of jello if I don't get Ch08D2 done today... along with the front matter.

:-)

 


Cheers, Tim

Timothy Perrett

unread,
Mar 23, 2009, 5:59:29 PM3/23/09
to Lift

> Perhaps tomorrow.  I will be whipped into a mass of jello if I don't get
> Ch08D2 done today... along with the front matter.

lol! No worries at all David. Tomorrow would be great :-)

Thanks, Tim
Reply all
Reply to author
Forward
0 new messages