Skip to content

main.gsp example? #2

Closed
chriscantu opened this Issue Jan 17, 2012 · 8 comments

2 participants

@chriscantu

Hello Konstantinos,

I really like the foundation framework by Zurb and am super excited about using it. I was just wondering if you had an example of a 'main.gsp'. To illustrate how to pull in all the resources. I have it partly working but can not seem to get the JS files to import in the body section of the gsp. I am sure it something I am missing something in the resource plugin documentation. Can you please advise?

Here is what I have in my main.gsp:

    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <r:require modules="foundation" />
        <title><g:layoutTitle default="Grails"/></title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <g:layoutHead/>
        <r:layoutResources />
    </head>
    <body>
        <g:layoutBody/>
        <r:layoutResources />
        <r:require modules="foundation" />
    </body>
@delight
Owner
delight commented Jan 17, 2012

Thats more of a question for the mailing list. Nevertheless your main.gsp has just a few flaws, which should not stop it from working thou. I tried your main.gsp with resources plugin 1.1.6 and it worked fine for me.

2 things you should fix:

1) the <r:require> tags need to be positioned before the <r:layoutResources> -> common pitfall, but it is not affecting your main.gsp as the <r:require> in the head section is absolute sufficient -> I would simply get rid of the 2nd <r:require> in the body section

2) you are missing the surrounding html section

you main.gsp could look similar to this:

<!doctype html>
<!--[if lt IE 7 ]> <html lang="en" class="no-js ie6"> <![endif]-->
<!--[if IE 7 ]>    <html lang="en" class="no-js ie7"> <![endif]-->
<!--[if IE 8 ]>    <html lang="en" class="no-js ie8"> <![endif]-->
<!--[if IE 9 ]>    <html lang="en" class="no-js ie9"> <![endif]-->
<!--[if (gt IE 9)|!(IE)]><!--> <html lang="en" class="no-js"><!--<![endif]-->
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
        <title><g:layoutTitle default="Grails"/></title>
        <meta name="viewport" content="width=device-width, initial-scale=1.0">
        <r:require modules="foundation" />
        <g:layoutHead/>
        <r:layoutResources />
    </head>
    <body>
        <g:layoutBody/>
        <r:layoutResources />
    </body>
</html>

the result in your generated html should have in the head section something similar to:

<script src="/foun/static/plugins/jquery-1.7.1/js/jquery/jquery-1.7.1.min.js" type="text/javascript" ></script>
<script src="/foun/static/bundle-bundle_foundation_head.js" type="text/javascript" ></script>
<link href="/foun/static/bundle-bundle_foundation_head.css" type="text/css" rel="stylesheet" media="screen, projection" />

Where foun is the context-name of my app.

Hope that helps,
Good luck,
Cheers,
Kosta

@delight delight closed this Jan 17, 2012
@chriscantu

Hello Kosta,

First, thank you for getting back to me so quickly. I really appreciate it.

I am sorry I wasn't more clear, I had the html tags and IE tags in my main.gsp. I cut them out from my insert for brevity.

Also, I got the jQuery, head.js and head.css files rendering so that is good. I tried rendering the content from "https://github.com/zurb/foundation/blob/master/index.html" to validate I had everything setup correctly. In my attempt, I only included the content in the body tag minus the Javascript references. I noticed only some of the content renders correctly (buttons aren't completely styled and headings are not styled) and the tabs don't work. I have included my content below.

If you would me to forward this to the mailing list, just let me know.

<body>

    <!-- container -->
    <div class="container">

        <div class="row">
            <div class="twelve columns">
                <h2>Welcome to Foundation</h2>
                <p>This is version 2.1.4 released on December 19, 2011</p>
                <hr />
            </div>
        </div>

        <div class="row">
            <div class="eight columns">
                <h3>The Grid</h3>

                <!-- Grid Example -->
                <div class="row">
                    <div class="twelve columns">
                        <div class="panel">
                            <p>This is a twelve column section in a row. Each of these includes a div.panel element so you can see where the columns are - it's not required at all for the grid.</p>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="six columns">
                        <div class="panel">
                            <p>Six columns</p>
                        </div>
                    </div>
                    <div class="six columns">
                        <div class="panel">
                            <p>Six columns</p>
                        </div>
                    </div>
                </div>
                <div class="row">
                    <div class="four columns">
                        <div class="panel">
                            <p>Four columns</p>
                        </div>
                    </div>
                    <div class="four columns">
                        <div class="panel">
                            <p>Four columns</p>
                        </div>
                    </div>
                    <div class="four columns">
                        <div class="panel">
                            <p>Four columns</p>
                        </div>
                    </div>
                </div>

                <h3>Tabs</h3>
                <dl class="tabs">
                    <dd><a href="#simple1" class="active">Simple Tab 1</a></dd>
                    <dd><a href="#simple2">Simple Tab 2</a></dd>
                    <dd><a href="#simple3">Simple Tab 3</a></dd>
                </dl>

                <ul class="tabs-content">
                    <li class="active" id="simple1Tab">This is simple tab 1's content. Pretty neat, huh?</li>
                    <li id="simple2Tab">This is simple tab 2's content. Now you see it!</li>
                    <li id="simple3Tab">This is simple tab 3's content. It's, you know...okay.</li>
                </ul>

                <h3>Buttons</h3>

                <p><a href="#" class="small blue button">Small Blue Button</a></p>
                <p><a href="#" class="blue button">Medium Blue Button</a></p>
                <p><a href="#" class="large blue button">Large Blue Button</a></p>

                <p><a href="#" class="nice radius small blue button">Nice Blue Button</a></p>
                <p><a href="#" class="nice radius blue button">Nice Blue Button</a></p>
                <p><a href="#" class="nice radius large blue button">Nice Blue Button</a></p>

            </div>

            <div class="four columns">          
                <h4>Getting Started</h4>
                <p>We're stoked you want to try Foundation! To get going, this file (index.html) includes some basic styles you can modify, play around with, or totally destroy to get going.</p>

                <h4>Other Resources</h4>
                <p>Once you've exhausted the fun in this document, you should check out:</p>
                <ul class="disc">
                    <li><a href="http://foundation.zurb.com/docs">Foundation Documentation</a><br />Everything you need to know about using the framework.</li>
                    <li><a href="http://github.com/zurb/foundation">Foundation on Github</a><br />Latest code, issue reports, feature requests and more.</li>
                    <li><a href="http://twitter.com/foundationzurb">@foundationzurb</a><br />Ping us on Twitter if you have questions. If you build something with this we'd love to see it (and send you a totally boss sticker).</li>
                </ul>
            </div>
        </div>

    </div>
    <!-- container -->
</body>  
@delight
Owner
delight commented Jan 17, 2012

Hi Chris,

thanks for making this clear. I will look into it. I was very busy lately so contrary to my other plugins I had almost no time to give the plugin a real test-app spin. I'll look into the problem and certainly fix it.

Thnx for letting me know,
Kosta

@delight delight reopened this Jan 17, 2012
@chriscantu

Kosta,

I completely understand. I just appreciate your efforts. If I can assist in anyway, please let m know. Also, I wanted to mention I am running Grails 2.0.

Have a great day!

Chris

@delight
Owner
delight commented Jan 17, 2012

Thnx Chris,

I checked by using this page http://foundation.zurb.com/docs/index.php

so far I found 3 things:

  • ie.css is in a conditional wrapper <!--[if lt IE 9]> ---> fixed.
  • the page ^^^ includes a presentation.css which is not part of foundation distribution ... don't know if i should include it optional in the plugin
  • the order of my css bundling has a problem. Seems like reset.css is overwriting parts of typography.css. I will have a look into it ... fixing the order of the css parts in the bundling.

Have a nice day too ... I guess I'll get this fixed tomorrow ... no time left today :-/
Kosta

@delight
Owner
delight commented Jan 22, 2012

Hi Chris,

took me a little longer till I could find some time to get a hand on it.
I fixed the problems I had mentioned and released a new version of the plugin.

runtime ":foundation:2.1.4.3"

What I didn't do is to include the presentations.css http://foundation.zurb.com/docs/presentation.css in the plugin. Because its not included in the downloadable distribution either. So you will need to include it yourself if you need it.

If you think I should include it in the plugin, please let me know (hopefully this would not be a licence problem, because i could not spot the license for that css file)

Please let me know if the new version of the plugin fixes your problem as I tested it only with the content of Docs index page http://foundation.zurb.com/docs/index.php

Cheers,
Kosta

@chriscantu

Hello Kosta,

I am sorry its taken me so long to respond. I had a child in the hospital. He's better now but of course I have been focused on that. I will take a look once things slow down a bit. I appreciate all your hard work on this plugn.

Cheers,

Chris

@delight
Owner
delight commented Jan 29, 2012

Hi Chris,

I completely understand. I hope your beloved will be well soon.
Your certainly didn't need to tell me your reasoning (No matter what the reason would be).
I appreciate your response and will appreciate your feedback - whenever this will be. No stressing.

Best wishes for your family,

Kosta

@delight delight closed this Dec 20, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.