Announcement Announcement Module
Collapse
No announcement yet.
Include jQuery js. Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Include jQuery js.

    Hi,

    I'm looking into the jQuery plugin: http://www.grails.org/plugin/jquery
    and as described in docs I have added:
    Code:
    <g:javascript library="jquery" plugin="jquery"/>
    to the layout.

    but this tag is rendered as:
    Code:
    <script type="text/javascript" src="/timeorg/plugins/jquery-1.4.4/js/jquery/jquery-1.4.3.js"></script>
    instead of something like:
    Code:
    <script type="text/javascript" src="/timeorg/js/jquery/jquery-1.4.3.min.js"></script>
    What am I missing?

  • #2
    OK I've got it to the point that the tag renders as:
    Code:
    <script type="text/javascript" src="/timeorg/plugins/jquery-1.4.4/js/jquery/jquery-1.4.4.js"></script>
    But where is this file is coming from?
    I don't have jQuery-1.4.4 in my project, just 1.4.3

    and why it's not pulling the minified version?

    Comment


    • #3
      There's a bug in the plugin; I described a workaround on the User mailing list here: http://grails.1312388.n4.nabble.com/...td3095815.html

      The User mailing list has a lot more subscribers than this forum, so you might want to ask questions there. The Dev list is for discussion of Grails development though, so usage questions aren't relevant there.

      Comment


      • #4
        Thanks, but when I'm trying to install jQuery by running this:
        Code:
        grails installJQuery
        it still installs 1.4.3 ???

        Comment


        • #5
          Probably, I haven't used that script. The plugin comes with the jQuery javascript file, so you can use that directly as shown in the docs, e.g.

          Code:
          <g:javascript library='jquery' plugin='jquery' />

          Comment


          • #6
            Where is this file located?

            Comment


            • #7
              $HOME/.grails/<grailsversion>/projects/<projectname>/plugins/jquery-1.4.4/web-app/js/jquery

              The <g:javascript> tag figures that out though. You just need to make the Config.groovy change I posted.

              Comment


              • #8
                I did, but my problem now is where is the file coming from. Because I don't have 1.4.4 in my project path.

                Who can I forse to use my file in 'js/jquery' folder?

                Comment


                • #9
                  It's not in your project path, it's where I said it is - in the plugin source under the .grails folder. The primary purpose of the plugin is to reduce duplication.

                  Comment


                  • #10
                    OK, another question then:
                    What happens when the application is deployed? Will the app create the same structure on the server on deploy?

                    Comment


                    • #11
                      Yes. This is easy to test - run "grails prod run-war" or just run "grails war" and unpack the war file from the target folder to examine its contents.

                      Comment


                      • #12
                        Originally posted by burtbeckwith View Post
                        Yes. This is easy to test - run "grails prod run-war" or just run "grails war" and unpack the war file from the target folder to examine its contents.
                        hmmm.... nice!
                        Thank you!

                        Comment


                        • #13
                          this would be a great instance to make use of the jQuery library.
                          Struts2 Jquery
                          In this there are codes of jquery and you will get to know how to make best use of it. Also provided a video for better understanding.

                          Comment

                          Working...
                          X