This file contains 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
import com.grailsrocks.functionaltest.* | |
class GrailsSiteTests extends BrowserTestCase { | |
void testSearch() { | |
get('http://grails.org') | |
assertStatus 200 | |
assertContentContains "download" | |
} | |
} |
This file contains 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
class MyController { | |
def doSignup = { | |
// Don't allow signup/use of service unless their invite | |
// has been approved | |
if (!invitationService.isUserApproved(params.email, '1.0-beta')) { | |
redirect( action: 'sorryBetaUsersOnly' ) | |
} | |
} |
This file contains 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
class DashboardController { | |
static navigation = [ | |
group:'tabs', | |
order:10, | |
title:'Your Inbox', | |
action:'inbox' | |
] | |
def index = { } |
This file contains 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
class BookController { | |
def updateBook = { | |
// set up the one time data for a future request, using a manual "conversation" key | |
def otID = book.isbn | |
oneTimeData(otID) { | |
customerName = customer.name | |
statusMessage = "Update to book saved!" | |
} | |
This file contains 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
<html> | |
<head> | |
<meta name="layout" content="main"/> | |
<r:require modules="jquery-ui, blueprint"/> | |
<r:script> | |
$(function() { | |
$('#form').dialog('open'); | |
}); | |
</r:script> | |
</head> |
This file contains 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
def book1 = Book.get(1) | |
def book2 = Book.get(2) | |
book1.addToTaxonomy(['Non-fiction', 'Autobiography']) | |
book1.addToTaxonomy(['Discounted', '10%'], 'pricing') // Pricing taxonomy, separate tree | |
book2.addToTaxonomy(['Non-fiction', 'Popular science']) | |
book2.addToTaxonomy(['Discounted', '20%'], 'pricing') // Pricing taxonomy, separate tree | |
// Find all books under Non-fiction | |
def nonFictionBooks = Book.findAllByTaxonomyFamily('Non-fiction') |
This file contains 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
package com.mycompany.security | |
import org.codehaus.groovy.grails.plugins.springsecurity.SpringSecurityUtils | |
import org.grails.plugin.platform.security.SecurityBridge | |
import org.apache.commons.logging.LogFactory | |
class MySecurityProvider implements SecurityBridge { | |
def log = LogFactory.getLog(MySecurityProvider) | |
def springSecurityService |
This file contains 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
grailsSecurityBridge(com.mycompany.security.MySecurityProvider) { | |
springSecurityService = ref('springSecurityService') | |
grailsApplication = ref('grailsApplication') | |
} |
This file contains 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
def doWithConfigOptions = { | |
'guest.roles'(defaultValue:['ROLE_GUEST'], validator: { v -> | |
(v == null || !(v instanceof List)) ? 'A role list is required' : null | |
}) | |
'signup.allowed'(defaultValue:true) | |
'post.login.url'(defaultValue:[uri:'/']) | |
} |
This file contains 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
<img src="clear-placeholder.png" width="100" height="50" data-2x-src="[email protected]"/> |