Picon

[Lift] Question on Javascript calls

HI all,

first of all, I should present myself, as it's my first post in the
group: I'm Pere Villega, a Java developer living in Dublin and
learning Scala and Lift in my spare time.

As a good newbie, I'll start with an obvious question: I've been
reading the Lift book, and I got confused on the javascript section.
It seems Lift allows you to create javascript code on the server side,
but as far as I understand this code is only to be used when reacting
to events that go to the server? Or I'm mistaken?

So, to say it in another way, if I have a page that has javascript,
the lift way is to keep in the template all the javascript that
modifies the UI (like a button that hides a div but doesn't send any
data to the server) and keep on the snippets the code that will
eventually relate to calls to the server (like an onclick validation
on submit or an ajax call). Is that correct?

I know it might seem obvious, but I would hate to start doing it that
way and then discover I could have saved effort using the lift
calls... :)

Best regards,
Pere Villega

--

-- 
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to liftweb@...
To unsubscribe from this group, send email to liftweb+unsubscribe@...
(Continue reading)

Jarod Liu | 1 Feb 04:04 2010
Picon

[Lift] Re: should use getColumnLabel insead of getColumnName in DB.resultSetToXXX

david,
sorry, i closed the ticket. do you accept my proposal

On Feb 1, 5:06 am, David Pollak <feeder.of.the.be...@...> wrote:
> Please do not open tickets without a discussion on this list first.
>
> Please close the ticket and start a discussion.
>
>
>
>
>
> On Sun, Jan 31, 2010 at 5:12 AM, Jarod Liu <liuyuan...@...> wrote:
> >http://github.com/dpp/liftweb/issues/issue/316
>
> > by using getColumnLabel I can chose between a real column name or a
> > alias name by the AS clause in SQL. with the getColumnName method I
> > don't have a choice
>
> > I wrap the DB.performQuery result to a map list in my app, and this
> > really hurt me.
>
> > --
> > You received this message because you are subscribed to the Google Groups
> > "Lift" group.
> > To post to this group, send email to liftweb@...
> > To unsubscribe from this group, send email to
> >
liftweb+unsubscribe@...<liftweb%2Bunsubscribe <at> googlegroups.com >
> > .
(Continue reading)

Adam Warski | 1 Feb 08:35 2010

Re: [Lift] Re: Passing attributes to bound elements

Hello,

> > This was considered later on a defect, and not a feature. To preserve
> > markup attributes in your bind use -%> instead of ->
> 
> thanks, although the -%> is missing support for the .toForm, as it returns a Box[NodeSeq]. And for % you
need an Elem. Any ideas how to deal with that? :)
> 
> What are you applying toForm to?

In this case it is a MappedDate.
But I've worked around the problem using jquery (all I wanted to do is add the datepicker anyway): I can wrap
the bound element using a <span class="datePicker">...</span>, and then lookup all elements with that
class, and for each get the child and apply the datepicker creation.

-- 
Adam Warski
http://www.warski.org
http://www.softwaremill.eu

--

-- 
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to liftweb@...
To unsubscribe from this group, send email to liftweb+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

Marius | 1 Feb 08:47 2010
Picon

[Lift] Re: Question on Javascript calls

Yes Lift's JavaScript stuff is mostly used when returning Ajax
response. You can also use it to serve fictive *.js files and instead
of returning a js file content you can serve the request (using
LiftRules.dispatch) and the actual JS returns is produced by
composition of JsCmd-s. We actually do that when serving the
"primordial" lift-ajax/comet script.

You can also use them for js events just to do some client stuff
without invoking ajax. This is pretty handy as where you compute your
button content from a snippet you can easily attach JS behavior as
well.

Br's,
Marius

On Feb 1, 2:27 am, "pere.vill...@..." <araco...@...>
wrote:
> HI all,
>
> first of all, I should present myself, as it's my first post in the
> group: I'm Pere Villega, a Java developer living in Dublin and
> learning Scala and Lift in my spare time.
>
> As a good newbie, I'll start with an obvious question: I've been
> reading the Lift book, and I got confused on the javascript section.
> It seems Lift allows you to create javascript code on the server side,
> but as far as I understand this code is only to be used when reacting
> to events that go to the server? Or I'm mistaken?
>
> So, to say it in another way, if I have a page that has javascript,
(Continue reading)

Jarod Liu | 1 Feb 09:25 2010
Picon

[Lift] [widgets][flot] how to make the .js and .css accessable?

I found flot generated the following code:
      <script type="text/javascript" src="/classpath/flot/
jquery.flot.js"></script>
    <!--[if IE]><script language="javascript" type="text/javascript"
src="/classpath/flot/excanvas.pack.js"></script><![endif]-->
      <link href="/classpath/flot/jquery.flot.css" type="text/css"
rel="stylesheet" />

but the these files not exists after jetty:run.

I can access the /classpath/jquery.js.(and other .js in the webkit
jar)

now, to make flot work, I have to copy these .js files to /static and
link to these copy on the page

--

-- 
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to liftweb@...
To unsubscribe from this group, send email to liftweb+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

Jeppe Nejsum Madsen | 1 Feb 10:37 2010
Picon

Re: [Lift] CRUDify Date picker

The Trav <the.trav@...> writes:

> Hi All,
>
> I've been chasing this one for a while and found a few posts dancing
> around the edge, but so far I haven't seen any solid answer on it.
>
> Most MappedTypeField's have auto generated form fields, including
> Select elements if you override the correct method.
>
> I was hoping MappedDateTime would have an auto generated field that
> included a JQuery DatePicker, given that if it's a required field, you
> need it to do your crud editing.
>
>
> Is there anything at all like that in the framework? Or do I have to
> figure out how to implement it myself?

You can use this as a starting point:

class FancyMappedDate[T<:Mapper[T]](fieldOwner: T) extends MappedDate[T](fieldOwner) {

  override def fieldId = Some(Text(name))
  override def setFromAny(f : Any): Date = f match {
    case v :: vs =>  tryo({java.text.DateFormat.getDateInstance(java.text.DateFormat.MEDIUM,
S.locale).parse(v.toString)}).map(d => this.set(d)).openOr(this.is)
    case d:Date => this.set(d)
    case _ => super.setFromAny(f)
  }

(Continue reading)

Jeppe Nejsum Madsen | 1 Feb 10:41 2010
Picon

Re: [Lift] [widgets][flot] how to make the .js and .css accessable?

Jarod Liu <liuyuanzhi@...> writes:

> I found flot generated the following code:
>       <script type="text/javascript" src="/classpath/flot/
> jquery.flot.js"></script>
>     <!--[if IE]><script language="javascript" type="text/javascript"
> src="/classpath/flot/excanvas.pack.js"></script><![endif]-->
>       <link href="/classpath/flot/jquery.flot.css" type="text/css"
> rel="stylesheet" />
>
> but the these files not exists after jetty:run.
>
> I can access the /classpath/jquery.js.(and other .js in the webkit
> jar)
>
> now, to make flot work, I have to copy these .js files to /static and
> link to these copy on the page

You need to add a call to Flot.init in Boot to make the classpath
resources available...

/Jeppe

--

-- 
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to liftweb@...
To unsubscribe from this group, send email to liftweb+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.

(Continue reading)

Timothy Perrett | 1 Feb 11:21 2010
Picon

Re: [Lift] Single log in for three contexts

Chas,

I've done exactly this using a cookie with a 192bit encrypted value. I cant share the code, but i would advise
you to make a LocParam subtype and use that as the authenticator as it is evaluated much before anything
else. 

Cheers, Tim

On 29 Jan 2010, at 23:02, chas@... wrote:

> I have three lift sites at different domain names (different apps) but all
> pulling data from the same database (using the same JPA persistence jar).
> 
> I'd like my users to be able to log in on one site, and have it apply to
> all three sites.
> 
> Clearly, I need some way to share the lift session across three servlet
> contexts.
> 
> What is the simplest way to do this in lift? Avoiding installing some
> external app that I have to learn is a priority.
> 
> All three sites are running in one instance of Tomcat 6 (as virtual
> domains)... something like example.com, this.example.com, and
> that.example.com.
> 
> Any and all suggestions welcome!
> 
> Chas.
> 
(Continue reading)

Jarod Liu | 1 Feb 13:12 2010
Picon

Re: [Lift] [widgets][flot] how to make the .js and .css accessable?

Jeppe,
Thanks

Jeppe Nejsum Madsen wrote:
> Jarod Liu <liuyuanzhi@...> writes:
>
> > I found flot generated the following code:
> >       <script type="text/javascript" src="/classpath/flot/
> > jquery.flot.js"></script>
> >     <!--[if IE]><script language="javascript" type="text/javascript"
> > src="/classpath/flot/excanvas.pack.js"></script><![endif]-->
> >       <link href="/classpath/flot/jquery.flot.css" type="text/css"
> > rel="stylesheet" />
> >
> > but the these files not exists after jetty:run.
> >
> > I can access the /classpath/jquery.js.(and other .js in the webkit
> > jar)
> >
> > now, to make flot work, I have to copy these .js files to /static and
> > link to these copy on the page
>
> You need to add a call to Flot.init in Boot to make the classpath
> resources available...
>
> /Jeppe

--

-- 
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to liftweb@...
(Continue reading)

ced | 1 Feb 16:57 2010

[Lift] Snippet attribute pass through

I want to set a node attribute in the template markup exactly like it
is done in example 7.13 from the Lift Book. I'll paste it here:

// the markup
<lift:Ledger.balance> <ledger:time ledger:id="myId"/>
</lift:Ledger.balance>

// The snippet class
class Ledger { def balance (content : NodeSeq ) : NodeSeq = {
bind ("ledger", content, "time" -> <span>{(new
java.util.Date).toString}</span>)
}
}

Unfortunately I can't get it to work. Is there something I have to set/
enable to get this feature working? I'm using Lift 1.1-M8

Thanks,
Chris

--

-- 
You received this message because you are subscribed to the Google Groups "Lift" group.
To post to this group, send email to liftweb@...
To unsubscribe from this group, send email to liftweb+unsubscribe@...
For more options, visit this group at http://groups.google.com/group/liftweb?hl=en.


Gmane