[Lift] Re: Ajax error/notice/warning works but no class attribute is specified
Very helpful, Thanks! Ramzi On Thu, Nov 13, 2008 at 1:36 PM, Marius <[EMAIL PROTECTED]> wrote: > > Hi, > > Please see > http://liftweb.net/index.php/HowTo_style_the_error/warning/notice_messages > > " > 3. You can use construct like S.error("msg_id", "Error message") for > both Ajax and non Ajax request however styling the messages differs a > bit: > 3.1 For Non-Ajax the styling is given by as in > the above example. > 3.2. For Ajax we can not use the same information as for Non-Ajax > because that would imply that Lift needs to keep more state on server > side. >Momentarily this is to be avoided. So the alternative is to > provide styling information through three LiftRules variables: >ajaxNoticeMeta/ajaxWarningMeta/ajaxErrorMeta : Can > [AjaxMessageMeta] where AjaxMessageMeta is > >case class AjaxMessageMeta(title: Can[String], cssClass: Can > [String]) > > " > Of course you can use this in order to specify css class names but > youcan also set styles using html ID and you don;t even need to > specify a class in your markup. > > Br's, > Marius > > On Nov 12, 8:22 pm, "Ramzi BEN YAHIA" <[EMAIL PROTECTED]> > wrote: > > Hi, > > the following for example loses the class attribute when rendered > > > > def deleteDialog(video: Video, deleteFun: Video => Boolean) = { > > val yesLink = SHtml.a(Text(S.?("video.do.delete"))){ > > if(deleteFun(video)){ > > S.notice(S.?("video.delete.success")) > > JsDelVideo(video) & ModalClose > > }else{ > > S.error(S.?("video.delete.failed")) > > ModalClose > > } > > } > > val noLink = SHtml.a(Text(S.?("video.dont.delete")),ModalClose) > > BasicModal( > > > > {S.?("video.delete.warn")} > > > > {S.?("video.delete.continue")} > > { yesLink} { noLink } > > > > > > ) > > } > > > > Best regards, > > Ramzi > > > > On Wed, Nov 12, 2008 at 1:56 PM, Marius <[EMAIL PROTECTED]> wrote: > > > > > Hi, > > > > > Can you please provide a code example? > > > > > Br's, > > > Marius > > > > > On Nov 10, 4:21 pm, "Ramzi BEN YAHIA" <[EMAIL PROTECTED]> > > > wrote: > > > > Hi guys, > > > > I use lift:msgs in my template and specify the error_class, > notice_class > > > as > > > > explained somewhere, > > > > it works as expected but not when called within an ajaxCall, the > > > class=".." > > > > disappears. > > > > this happens on 0.9, should I use the snapshot ? > > > > > > Cheers, > > > > Ramzi. > > > > A Lift user from France. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Ajax error/notice/warning works but no class attribute is specified
Hi, Please see http://liftweb.net/index.php/HowTo_style_the_error/warning/notice_messages " 3. You can use construct like S.error("msg_id", "Error message") for both Ajax and non Ajax request however styling the messages differs a bit: 3.1 For Non-Ajax the styling is given by as in the above example. 3.2. For Ajax we can not use the same information as for Non-Ajax because that would imply that Lift needs to keep more state on server side. Momentarily this is to be avoided. So the alternative is to provide styling information through three LiftRules variables: ajaxNoticeMeta/ajaxWarningMeta/ajaxErrorMeta : Can [AjaxMessageMeta] where AjaxMessageMeta is case class AjaxMessageMeta(title: Can[String], cssClass: Can [String]) " Of course you can use this in order to specify css class names but youcan also set styles using html ID and you don;t even need to specify a class in your markup. Br's, Marius On Nov 12, 8:22 pm, "Ramzi BEN YAHIA" <[EMAIL PROTECTED]> wrote: > Hi, > the following for example loses the class attribute when rendered > > def deleteDialog(video: Video, deleteFun: Video => Boolean) = { > val yesLink = SHtml.a(Text(S.?("video.do.delete"))){ > if(deleteFun(video)){ > S.notice(S.?("video.delete.success")) > JsDelVideo(video) & ModalClose > }else{ > S.error(S.?("video.delete.failed")) > ModalClose > } > } > val noLink = SHtml.a(Text(S.?("video.dont.delete")),ModalClose) > BasicModal( > > {S.?("video.delete.warn")} > > {S.?("video.delete.continue")} > { yesLink} { noLink } > > > ) > } > > Best regards, > Ramzi > > On Wed, Nov 12, 2008 at 1:56 PM, Marius <[EMAIL PROTECTED]> wrote: > > > Hi, > > > Can you please provide a code example? > > > Br's, > > Marius > > > On Nov 10, 4:21 pm, "Ramzi BEN YAHIA" <[EMAIL PROTECTED]> > > wrote: > > > Hi guys, > > > I use lift:msgs in my template and specify the error_class, notice_class > > as > > > explained somewhere, > > > it works as expected but not when called within an ajaxCall, the > > class=".." > > > disappears. > > > this happens on 0.9, should I use the snapshot ? > > > > Cheers, > > > Ramzi. > > > A Lift user from France. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Ajax error/notice/warning works but no class attribute is specified
Hi, the following for example loses the class attribute when rendered def deleteDialog(video: Video, deleteFun: Video => Boolean) = { val yesLink = SHtml.a(Text(S.?("video.do.delete"))){ if(deleteFun(video)){ S.notice(S.?("video.delete.success")) JsDelVideo(video) & ModalClose }else{ S.error(S.?("video.delete.failed")) ModalClose } } val noLink = SHtml.a(Text(S.?("video.dont.delete")),ModalClose) BasicModal( {S.?("video.delete.warn")} {S.?("video.delete.continue")} { yesLink} { noLink } ) } Best regards, Ramzi On Wed, Nov 12, 2008 at 1:56 PM, Marius <[EMAIL PROTECTED]> wrote: > > Hi, > > Can you please provide a code example? > > Br's, > Marius > > On Nov 10, 4:21 pm, "Ramzi BEN YAHIA" <[EMAIL PROTECTED]> > wrote: > > Hi guys, > > I use lift:msgs in my template and specify the error_class, notice_class > as > > explained somewhere, > > it works as expected but not when called within an ajaxCall, the > class=".." > > disappears. > > this happens on 0.9, should I use the snapshot ? > > > > Cheers, > > Ramzi. > > A Lift user from France. > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---
[Lift] Re: Ajax error/notice/warning works but no class attribute is specified
Hi, Can you please provide a code example? Br's, Marius On Nov 10, 4:21 pm, "Ramzi BEN YAHIA" <[EMAIL PROTECTED]> wrote: > Hi guys, > I use lift:msgs in my template and specify the error_class, notice_class as > explained somewhere, > it works as expected but not when called within an ajaxCall, the class=".." > disappears. > this happens on 0.9, should I use the snapshot ? > > Cheers, > Ramzi. > A Lift user from France. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Lift" group. To post to this group, send email to liftweb@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/liftweb?hl=en -~--~~~~--~~--~--~---