I had a problem when I deployed my war on Tomcat in OpenShift cloud.
It always takes OpenShift's ROOT.war and not the ROOT.war I had copy in the webapps directory.
It's because when you make git push, it runs a mvn command or in my case, I don't want to build my project but only deploy a single war file.
To solve this problem :
- Delete src/ directory
- Delete pom.xml
Thursday, December 26, 2013
Thursday, December 19, 2013
Bootstrap add active class to li
In the following example, we use a classic Bootstrap menu.Note that, none li had a class active.We will use after.
<div class="navbar navbar-default span12" role="navigation">
<...>
<div class="navbar-collapse collapse">
<ul class="nav navbar-nav">
<li><a href="/fjLearning/"><g:message code="menu.home" /></a></li>
<li><a href="/fjLearning/page/training"><g:message code="menu.training" /></a></li>
<li class="dropdown">
<a href="#" class="dropdown-toggle" data-toggle="dropdown"><g:message code="menu.about" /> <b class="caret"></b></a>
<ul class="dropdown-menu">
<li><a href="/fjLearning/page/about"><g:message code="menu.about.perso" /></a></li>
<li class="divider"></li>
<li class="dropdown-header"><g:message code="menu.about.site" /></li>
<li><a href="/fjLearning/page/under"><g:message code="menu.underTheHood" /></a></li>
<li><a href="#">FAQ</a></li>
</ul>
</li>
</ul>
</div>
</div>
To make it works you have in each page to add :
<body>
<script>
$(document).ready(function() {
$('a[href="' + this.location.pathname + '"]').parent().addClass('active');
});
</script>
...
Now, when I clicked on the menu, the link active changes automatically. If you want to see an example, go on my GittHub project : https://github.com/drieu/fjLearning
Here is the usefull files :
https://github.com/drieu/fjLearning/blob/master/grails-app/views/layouts/_menu.gsp
https://github.com/drieu/fjLearning/blob/master/grails-app/views/page/training.gsp
Sunday, December 15, 2013
Bootstrap : span doesn't work
I tried this simple Bootstrap row without success :
In fact, it's simple.I used Bootstrap 3.x and not Bootstrap 2.x which contains some change in class names.
For example, span-* became col-md-*.
So the solution, for this example above :
See following link for details :
http://getbootstrap.com/getting-started/#migration
http://stackoverflow.com/questions/18527466/twitter-bootstrap-span-columns-not-displaying-correctly/18527554#18527554
<div class="row" style="border: 1px solid green">
<div class="span2" style="border: 1px solid red">Foo!</div>
<div class="span2" style="border: 1px solid red">Bar!</div>
<div class="span2" style="border: 1px solid red">Baz!</div>
<div class="span2" style="border: 1px solid red">Foo!</div>
<div class="span2" style="border: 1px solid red">Bar!</div>
<div class="span2" style="border: 1px solid red">Baz!</div>
</div>
In fact, it's simple.I used Bootstrap 3.x and not Bootstrap 2.x which contains some change in class names.
For example, span-* became col-md-*.
So the solution, for this example above :
<div class="row" style="border: 1px solid green">
<div class="col-md-2" style="border: 1px solid red">Foo!</div>
<div class="col-md-2" style="border: 1px solid red">Bar!</div>
<div class="col-md-2" style="border: 1px solid red">Baz!</div>
<div class="col-md-2" style="border: 1px solid red">Foo!</div>
<div class="col-md-2" style="border: 1px solid red">Bar!</div>
<div class="col-md-2" style="border: 1px solid red">Baz!</div>
</div>
See following link for details :
http://getbootstrap.com/getting-started/#migration
http://stackoverflow.com/questions/18527466/twitter-bootstrap-span-columns-not-displaying-correctly/18527554#18527554
Thursday, December 12, 2013
Add social buttons with Grails
Here is a simple way to add social button without time'sloading problems.
Example :
In this example, we used <g:createLink action="${params.action}" absolute="true"/> to generate full url of your gsp web page.
params.action variable contains current action.
If you want other example (Facebook, Google + ...), you can see that link : http://korben.info/bouton-partage-twitter-facebook-sans-tracking.html
Example :
<a target="_blank" title="Twitter" href="https://twitter.com/share?url=<g:createLink action="${params.action}" absolute="true"/>&text=<g:message code="training.title" /> sur <g:createLink action="${params.action}" absolute="true"/>" class="tweet-button" rel="nofollow" onclick="javascript:window.open(this.href, '', 'menubar=no,toolbar=no,resizable=yes,scrollbars=yes,height=400,width=700');return false;"><img src="/fjLearning/images/twitter_icon.png" width="32" height="32"/></a>
In this example, we used <g:createLink action="${params.action}" absolute="true"/> to generate full url of your gsp web page.
params.action variable contains current action.
If you want other example (Facebook, Google + ...), you can see that link : http://korben.info/bouton-partage-twitter-facebook-sans-tracking.html
Wednesday, December 11, 2013
Road to Grails 3.0
An interesting video on InfoQ about Grails 2.3 and future Grails 3.0 feature :
Road to Grails 3.0
Road to Grails 3.0
Friday, December 6, 2013
Grails : full URL of a gsp.
If you need the full URL of a gsp, you can use tag createLink :
The params.action variable give us the current action.In our case it's training.
More details about tag createLink on http://grails.org/doc/latest/ref/Tags/createLink.html
<g:createLink action="${params.action}" absolute="true"/>It will generate something like taht : http://localhost:8080/fjLearning/training
The params.action variable give us the current action.In our case it's training.
More details about tag createLink on http://grails.org/doc/latest/ref/Tags/createLink.html
Subscribe to:
Posts (Atom)