Created
October 28, 2010 03:32
-
-
Save chanwit/650572 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // from: http://adammonsen.com/post/548 | |
| detectMobile (controller:'*', action:'*') { | |
| before = { | |
| if (request.getHeader('user-agent') =~ /(?i)iphone/) { | |
| request['isMobile'] = true | |
| } else { | |
| request['isMobile'] = false | |
| } | |
| return true // keep processing other filters and the action | |
| } | |
| after = { } | |
| afterView = { } | |
| } | |
| def afterInterceptor = { model, modelAndView -> | |
| if (request['isMobile']) { | |
| modelAndView.viewName = modelAndView.viewName + "_m" | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment