Skip to content

Instantly share code, notes, and snippets.

View KacT9H's full-sized avatar

Kanstantsin Khisamau KacT9H

  • Munich
View GitHub Profile
def testFlow = {
//Any steps
renderView {
render(view: '/views/testView')
on('next-step').to "nextStep"
on('back').to "previousStep"
}
//Any steps
}
.taggd-wrapper {
position: relative;
}
.taggd-wrapper .taggd-button {
background-color: transparent;
cursor: pointer;
border: 5px solid #bde0e1;
opacity: 0.2;
}
@KacT9H
KacT9H / page.html
Last active November 22, 2016 17:43
<!DOCTYPE html>
<html>
<head>
<title>Test</title>
%{--taggd path--}%
<link rel="stylesheet" href="your path/taggd-master/dist/taggd.css"/>
<script src="your path/taggd-master/dist/taggd.js"></script>
%{--custom styles path--}%
<link rel="stylesheet" href="your path/test.css"/>
</head>
class User {
String email
String password
Locale locale
// other fields
}
class CustomLocaleResolver extends SessionLocaleResolver {
def springSecurityService = Holders.grailsApplication.mainContext.getBean('springSecurityService')
Locale resolveLocale(HttpServletRequest request) {
//getting locale from session
Locale locale = (Locale) WebUtils.getSessionAttribute(request, LOCALE_SESSION_ATTRIBUTE_NAME)
if (!locale) {
if (springSecurityService.isLoggedIn()) {
def user = springSecurityService.getCurrentUser() as User
locale = user.locale ?: determineDefaultLocale(request)
class HomeController {
def springSecurityService
//...
def changeLocale(String locale) {
def user = springSecurityService.currentUser as User
user.locale = new Locale(locale)
user.save()
//put locale to lang param
redirect action: 'index', params: [lang: locale]
beans = {
localeResolver(CustomLocaleResolver)
//beans...
}
package net.realizeideas.oauth.bitbucket
import org.scribe.builder.api.DefaultApi10a
import org.scribe.model.Token
/**
* @author: Konstantin Khisamov
*/
class BitbucketApi extends DefaultApi10a {
oauth:
providers:
bitbucket: #provider name
api: net.realizeideas.oauth.bitbucket.BitbucketApi #API path, it will be implemented bellow
key: 'xxxxxF5DfBeK9xxxxx' #API key received in the previous step
secret: 'xxxxxxGZKY8xqNUkjCyY7xxxxxxxxxxx' #API secret received in the previous step
successUri: '/' #App will be redirected there after successful getting Access Token
failureUri: '/' #App will be redirected there after failed getting Access Token
callback: '${grails.serverURL}/oauth/bitbucket/callback' #Oauth Controller is provided by Oauth Plugin, so you need to set a provider name only