Sunday, November 23, 2014

Bootstrap CSS templating in Grails.

There are three ways of integrating Bootstrap CSS templating to Grails.

1. Using twitter bootstrap plugin       grails.org/plugin/twitter-bootstrap
2. Using kick start bootstrap plugin    grails.org/plugin/kickstart-with-bootstrap
3. Manually downloading boostrap source files from getbootstrap.com and putting the files in grails-app/assets (for Grails 2.4.3 and above) or in web-app/css and web-app/js folders

There is one good blog post about using bootstrap as a default template by Iraklis at foodforcoding.com/2013/05/25/grails-with-twitter-bootstrap/ (althought the blog entry is old)
Another video by Joe Rinehart explains how to integrate Twitter Bootstrap into a Grails application (can be found at www.infoq.com/presentations/grails-twitter-bootstrap/)

The github project of twitter-boostrap plugin at https://github.com/robfletcher/twitter-bootstrap-scaffolding is also a good help.

You can also look at my simple blogging system developed in grails which uses Bootstrap 3 at https://github.com/biniama/mubs

Importing your git repository from bitbucket (or any other VCS) to GitHub

Go to 

 1. https://import.github.com/new and enter the url of the old repository
 2. give it a repository name (or it will import the name automatically)
 3. select public vs private repo
 4. Click import

Good luck!

Friday, November 21, 2014

Edit/Update Page Implementation in JQuery and Grails

I have a page with a form where a user enters first name and last name.

When the 'Edit' button is clicked, I want the button's name to change to 'Update' and the textboxes to become editable.

Then, when the user finishes editing the fields, I want to call a controller method in Grails.

What I want is to call the controller method WHEN 'UPDATE' BUTTON IS CLICKED (NOT WHEN 'EDIT' BUTTON IS CLICKED).

Here is the solution!