Hey Dave and others,
I spent the night on and off understanding the lift structure and
taking tutorials, I am starting to understand how it works and what
makes it works, I really love this framework so far :) I am very
pleased on top of all the help I am getting, I do appreciate it!
I added in some styling to the code you guys supplied me and it can be
found here:
http://rksdesignstudios.com/files/magnetboard.zip
The next things on my to do list are to:
1. Add in the form at the top right using lift.
- on submit add the word via mysql database and print on page
like others
- add in callbacks so on page add do this jquery effect
2. Create a repositioning effect
- save x/y positions to database and retreive for ALL elements
- doing this so on page refresh they will remain in the same
place
2a. Once reposition is working
- be able to have page push content (comet) to the page,
to keep it updated.
3. Work in delete method.
I am going to start with working on the MySQl database using the
tutorial on the lift site. That is the first thing I should start.
I have a feeling its going to be a tough one, haha. Tim or Dave, I
might have some questions about understanding the code that you
supplied for me, what is the best way for me to do that? Post a new
one or continue here, I want to keep things organized for you guys and
for others who are wondering about LIFT!
Thanks everyone for the help,
Ryan
On Apr 7, 1:11 pm, David Pollak <
d...@athena.com> wrote:
> Ryan,
> lift has these nifty things called CometActors. As the name suggests, they are chunks of code to do comet.
> In your view (lift has a view-first architecture seehttp://
liftweb.net/index.php/Lift_View_First), you'd do something like:<lift:comet type="MagnetBoard" />
> Then you'd create a class that looks like:class MagnetBoard(initInfo: CometActorInitInfo) extends CometActor(initInfo) { def defaultPrefix = "board" private var stuckOnMe: List[Magnet] = Nil def render = <div class="magnet_board">{stuckOnMe.map(_.renderAMagnet)}</div>
> def lowPriority = {
> case AddMagnet(magnet) => stuckOnMe = magnet :: stuckOnMe ; reRender(false)
> case RemoveMagnet(magnet) => stuckOnMe = stuckOnMe.remove(_.id ==
magnet.id); reRender(false)
> case UpdateMagnet(magnet) => stuckOnMe = magnet :: stuckOnMe.remove(_.id ==
magnet.id); reRender(false)
> }}
> case class AddMagnet(magnet: Magnet)case class RemoveMagnet(magnet: Magnet)case class UpdateMagnet(magnet: Magnet)class Magnet(val id: String, val message: String, val xpos: Int, val ypos: Int) {
> def renderAMagnet = <div id={id} class="magnet" style={"top: "+ypos+"; left: "+xpos}>{message}</div>
> }Is this your whole app? Except for the part that updates the Magnets, yes.
> Do you have to do anything fancy to get lift to do all the Comet stuff? No. It's automatically taken care of when you put a CometActor into a view.
> Thanks,
> David
> coughlinsmyalias wrote:Hey, I am new to lift and just started doing some research on it. I am using jQuery to program:
http://rksdesignstudios.com/magnet/I am trying to keep it as live/updated as possible, would lift work for me? And if I am an avid PHP/jQuery user, what kind of transition will it be to lift? Is it similar to Ruby on Rails, I was guessing by the structure while doing my research. Looking at some code examples and kind of confused about lift. Thanks for your help! Ryan