[Lift] Re: Can't find Javascript files using LiftRules.resourceServerPath

2009-04-09 Thread marius d.

In your boot try this:

ResourceServer.allow {
  case jquery-tabs.js :: Nil = true
  case jquery-ui-1.7.1.custom.min.js :: Nil = true

}

On Apr 9, 12:17 am, glenn gl...@exmbly.com wrote:
 What am I doing wrong?

 I'm trying to implement tabs using the jquery-tabs.js (the JqueryTabs
 Plugin), but when I run the application, I get the following
 javascript error:

    jQuery.Tabs is undefined  http://localhost:8080/Line 34

 I'm using the following snippet to create the jquery script
 initializing the tabs.

 class HomePage {
 def tabRender(selector: String, height: String, width: String, tabs:
 List[String], ids: List[String]) : NodeSeq = {

     val onLoad = Unparsed(
                  $(document).ready(function() {
                     jQuery.Tabs.initialize('+selector+', '+height
 +', '+width+',
                         + JsArray(tabs.map(Str(_)):_*) + ,  + JsArray
 (ids.map(Str(_)):_*) +  );
                   });
                  )

     head
        script type=text/javascript src={/ +
 LiftRules.resourceServerPath + /jquery-tabs.js}/script
        script type=text/javascript src={/ +
 LiftRules.resourceServerPath + /jquery-ui-1.7.1.custom.min.js}/
 script
        script type=text/javascript charset=utf-8{onLoad}/
 script
      /head
   }

   def renderTabs(xhtml: NodeSeq): NodeSeq = {
      val ids = List(Page1, Page2, Page3)
      val tabs = List(Tab1,Tab2, Tab3)

       tabRender(MyTabbedView,300px, 150px, tabs, ids )
   }

 }

 My index.html is the following:

 lift:surround with=default at=content
    lift:HomePage.renderTabs/
    div id = MyTabbedView/div
    div id = Page1Page 1br/Description of jQuery Tabs plugin/
 div
    div id = Page2Page 2br/How to use this plugin/div
    div id = Page3Page 3br/Download plugin/div
 /lift:surround

 I put the jquery-tabs.js file in src/main/resources/toserve.

 The returned source athttp://localhost:8080contains the following
 html:

 script type=text/javascript src=/classpath/jquery-tabs.js
 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 htmlbodyThe Requested URL /classpath/jquery-tabs.js was not found
 on this server/body/html

 Any help on getting this to run would be appreciated.

 Glenn Silverman
--~--~-~--~~~---~--~~
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 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Can't find Javascript files using LiftRules.resourceServerPath

2009-04-09 Thread glenn

Problem solved. It seems you can't just put your js files in the path
src/main/resources/toserver.
You need to put them in a subfolder of toserve and specify the
subfolder in  ResourceServer.allow
in your Boot class.

I think improved documentation is needed in this area.

Glenn Silverman

On Apr 8, 2:17 pm, glenn gl...@exmbly.com wrote:
 What am I doing wrong?

 I'm trying to implement tabs using the jquery-tabs.js (the JqueryTabs
 Plugin), but when I run the application, I get the following
 javascript error:

    jQuery.Tabs is undefined  http://localhost:8080/Line 34

 I'm using the following snippet to create the jquery script
 initializing the tabs.

 class HomePage {
 def tabRender(selector: String, height: String, width: String, tabs:
 List[String], ids: List[String]) : NodeSeq = {

     val onLoad = Unparsed(
                  $(document).ready(function() {
                     jQuery.Tabs.initialize('+selector+', '+height
 +', '+width+',
                         + JsArray(tabs.map(Str(_)):_*) + ,  + JsArray
 (ids.map(Str(_)):_*) +  );
                   });
                  )

     head
        script type=text/javascript src={/ +
 LiftRules.resourceServerPath + /jquery-tabs.js}/script
        script type=text/javascript src={/ +
 LiftRules.resourceServerPath + /jquery-ui-1.7.1.custom.min.js}/
 script
        script type=text/javascript charset=utf-8{onLoad}/
 script
      /head
   }

   def renderTabs(xhtml: NodeSeq): NodeSeq = {
      val ids = List(Page1, Page2, Page3)
      val tabs = List(Tab1,Tab2, Tab3)

       tabRender(MyTabbedView,300px, 150px, tabs, ids )
   }

 }

 My index.html is the following:

 lift:surround with=default at=content
    lift:HomePage.renderTabs/
    div id = MyTabbedView/div
    div id = Page1Page 1br/Description of jQuery Tabs plugin/
 div
    div id = Page2Page 2br/How to use this plugin/div
    div id = Page3Page 3br/Download plugin/div
 /lift:surround

 I put the jquery-tabs.js file in src/main/resources/toserve.

 The returned source athttp://localhost:8080contains the following
 html:

 script type=text/javascript src=/classpath/jquery-tabs.js
 ?xml version=1.0 encoding=UTF-8?
 !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
 http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
 htmlbodyThe Requested URL /classpath/jquery-tabs.js was not found
 on this server/body/html

 Any help on getting this to run would be appreciated.

 Glenn Silverman

--~--~-~--~~~---~--~~
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 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---



[Lift] Re: Can't find Javascript files using LiftRules.resourceServerPath

2009-04-09 Thread marius d.

that to :) ... the above should also work as well if you leave your
files in toserve. ResourceServer is also discussed in the upcoming
Lift book.

If one understands how ResourceServer works there is no need for
further explanations of sub-folders etc. Relevant examples can be
found in Lift-Widgets project.

Br's,
Marius


On Apr 9, 7:59 am, glenn gl...@exmbly.com wrote:
 Problem solved. It seems you can't just put your js files in the path
 src/main/resources/toserver.
 You need to put them in a subfolder of toserve and specify the
 subfolder in  ResourceServer.allow
 in your Boot class.

 I think improved documentation is needed in this area.

 Glenn Silverman

 On Apr 8, 2:17 pm, glenn gl...@exmbly.com wrote:

  What am I doing wrong?

  I'm trying to implement tabs using the jquery-tabs.js (the JqueryTabs
  Plugin), but when I run the application, I get the following
  javascript error:

     jQuery.Tabs is undefined  http://localhost:8080/Line34

  I'm using the following snippet to create the jquery script
  initializing the tabs.

  class HomePage {
  def tabRender(selector: String, height: String, width: String, tabs:
  List[String], ids: List[String]) : NodeSeq = {

      val onLoad = Unparsed(
                   $(document).ready(function() {
                      jQuery.Tabs.initialize('+selector+', '+height
  +', '+width+',
                          + JsArray(tabs.map(Str(_)):_*) + ,  + 
  JsArray
  (ids.map(Str(_)):_*) +  );
                    });
                   )

      head
         script type=text/javascript src={/ +
  LiftRules.resourceServerPath + /jquery-tabs.js}/script
         script type=text/javascript src={/ +
  LiftRules.resourceServerPath + /jquery-ui-1.7.1.custom.min.js}/
  script
         script type=text/javascript charset=utf-8{onLoad}/
  script
       /head
    }

    def renderTabs(xhtml: NodeSeq): NodeSeq = {
       val ids = List(Page1, Page2, Page3)
       val tabs = List(Tab1,Tab2, Tab3)

        tabRender(MyTabbedView,300px, 150px, tabs, ids )
    }

  }

  My index.html is the following:

  lift:surround with=default at=content
     lift:HomePage.renderTabs/
     div id = MyTabbedView/div
     div id = Page1Page 1br/Description of jQuery Tabs plugin/
  div
     div id = Page2Page 2br/How to use this plugin/div
     div id = Page3Page 3br/Download plugin/div
  /lift:surround

  I put the jquery-tabs.js file in src/main/resources/toserve.

  The returned source athttp://localhost:8080containsthe following
  html:

  script type=text/javascript src=/classpath/jquery-tabs.js
  ?xml version=1.0 encoding=UTF-8?
  !DOCTYPE html PUBLIC -//W3C//DTD XHTML 1.0 Transitional//EN 
  http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd;
  htmlbodyThe Requested URL /classpath/jquery-tabs.js was not found
  on this server/body/html

  Any help on getting this to run would be appreciated.

  Glenn Silverman
--~--~-~--~~~---~--~~
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 
liftweb+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/liftweb?hl=en
-~--~~~~--~~--~--~---