Skip to content

Instantly share code, notes, and snippets.

@raymyers
Created May 16, 2010 02:26
Show Gist options
  • Save raymyers/402590 to your computer and use it in GitHub Desktop.
Save raymyers/402590 to your computer and use it in GitHub Desktop.
%html
%head
%title Welcome to Grails
%meta(name="layout" content="main")
:css
#nav {
margin-top:20px;
margin-left:30px;
width:228px;
float:left;
}
.homePagePanel * {
margin:0px;
}
.homePagePanel .panelBody ul {
list-style-type:none;
margin-bottom:10px;
}
.homePagePanel .panelBody h1 {
text-transform:uppercase;
font-size:1.1em;
margin-bottom:10px;
}
.homePagePanel .panelBody {
background: url(images/leftnav_midstretch.png) repeat-y top;
margin:0px;
padding:15px;
}
.homePagePanel .panelBtm {
background: url(images/leftnav_btm.png) no-repeat top;
height:20px;
margin:0px;
}
.homePagePanel .panelTop {
background: url(images/leftnav_top.png) no-repeat top;
height:11px;
margin:0px;
}
h2 {
margin-top:15px;
margin-bottom:15px;
font-size:1.2em;
}
#pageBody {
margin-left:280px;
margin-right:20px;
}
%body
#nav
.homePagePanel
.panelTop
.panelBody
%h1 Application Status
%ul
%li
App version:
%g:meta(name="app.version")
%li
Grails version:
%g:meta(name="app.grails.version")
%li
JVM version:
${System.getProperty('java.version')}
%li
Controllers:
${grailsApplication.controllerClasses.size()}
%li
Domains:
${grailsApplication.domainClasses.size()}
%li
Services:
${grailsApplication.serviceClasses.size()}
%li
Tag Libraries:
${grailsApplication.tagLibClasses.size()}
%h1 Installed Plugins
%ul
%g:set(var="pluginManager" value="${applicationContext.getBean('pluginManager')}")
%g:each(var="plugin" in="${pluginManager.allPlugins}")
%li ${plugin.name} - ${plugin.version}
.panelBtm
#pageBody
%h1 Welcome to Grails
%p
Congratulations, you have successfully started your first Grails application! At the moment
this is the default page, feel free to modify it to either redirect to a controller or display whatever
content you may choose. Below is a list of controllers that are currently deployed in this application,
click on each to execute its default action:
#controllerList.dialog
%h2 Available Controllers:
%ul
%g:each(var="c" in="${grailsApplication.controllerClasses}")
%li.controller
%g:link(controller="${c.logicalPropertyName}") ${c.fullName}
%html
%head
%title
%g:layoutTitle(default="Grails")
%link(rel="stylesheet" href="${resource(dir:'css',file:'main.css')}")
%link(rel="shortcut icon" href="${resource(dir:'images',file:'favicon.ico')}" type="image/x-icon")
%g:layoutHead/
%g:javascript(library="application")/
%body
#spinner.spinner(style="display:none;")
%img(src="${resource(dir:'images',file:'spinner.gif')}" alt="Spinner")
#grailsLogo.logo
%a(href="http://grails.org")
%img(src="${resource(dir:'images',file:'grails_logo.png')}" alt="Grails" border="0")/
%g:layoutBody/
@pledbrook
Copy link

Do you have an example with embedded Javascript? I think that's the only main thing missing. Got to say, with syntax highlighting that does look pretty tidy.

@edvinasbartkus
Copy link

If you need to attach a linked file: %script(type="text/javascript",src="javascripts/bla.js")

But if you need to have inline javascript, you can do the same like it is done with css -
javascript:
alert("In love with HAML");

@pledbrook
Copy link

Thanks. It was the inline javascript I was after. I take it the colon should be in front of 'javascript' like so:

:javascript
alert("In love with HAML")

@lessallan
Copy link

Is there a textmate bundle for jhaml?

@raymyers
Copy link
Author

Any of the Haml bundles should work, since the syntax is the same.

http://haml-lang.com/editors.html

@tjad
Copy link

tjad commented Nov 7, 2011

How would I go about doing the following?

<%@ page import="net.MyImport" %>

@raymyers
Copy link
Author

raymyers commented Nov 8, 2011

Lines beginning with '<' go through as is, so you can do that with:
<%@ page import="net.MyImport" %>

This all assumes JHaml is operating as a preprocessor for GSPs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment