Permalink
Browse files

Re-add controller for switching features which went missing...

  • Loading branch information...
Jonny Knocker
Jonny Knocker committed Dec 12, 2012
1 parent 053255c commit d37749656c0baecad7ddb818c4f164b51312c03c
View
@@ -1,4 +1,5 @@
#Grails Metadata file
-#Tue Aug 21 17:33:07 BST 2012
+#Wed Dec 12 15:14:26 GMT 2012
app.grails.version=2.0.3
app.name=feature-switch
+plugins.rest-client-builder=1.0.2
@@ -41,7 +41,7 @@ grails.project.dependency.resolution = {
build(":tomcat:$grailsVersion",
":release:2.0.4") {
- excludes 'http-builder', 'httpcore', 'httpclient'
+ excludes 'http-builder', 'httpcore', 'httpclient', 'rest-client-builder'
export = false
}
@@ -0,0 +1,23 @@
+package uk.co.desirableobjects.featureswitch
+
+class FeatureSwitchAdminController {
+
+ def switches() {
+
+ Map<String, Boolean> model = [:]
+
+ grailsApplication.config.features.each { String name, Map<String, Boolean> details ->
+ model.put(name, details.enabled)
+ }
+
+ render view: 'switches', model: [features: model]
+
+ }
+
+ def toggle(String feature) {
+
+ grailsApplication.config.features[feature].enabled = !grailsApplication.config.features[feature].enabled
+ redirect action: 'switches'
+
+ }
+}
@@ -2,6 +2,8 @@ package uk.co.desirableobjects.featureswitch
class FeatureSwitchTestingService {
+ static transactional = false
+
Boolean withFeature() {
withFeature("alwaysOn") {
@@ -0,0 +1,32 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-2.5.xsd">
+
+ <bean id="grailsApplication" class="org.codehaus.groovy.grails.commons.GrailsApplicationFactoryBean">
+ <description>Grails application factory bean</description>
+ <property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
+ <property name="grailsResourceLoader" ref="grailsResourceLoader" />
+ </bean>
+
+ <bean id="pluginManager" class="org.codehaus.groovy.grails.plugins.GrailsPluginManagerFactoryBean">
+ <description>A bean that manages Grails plugins</description>
+ <property name="grailsDescriptor" value="/WEB-INF/grails.xml" />
+ <property name="application" ref="grailsApplication" />
+ </bean>
+
+ <bean id="grailsConfigurator" class="org.codehaus.groovy.grails.commons.spring.GrailsRuntimeConfigurator">
+ <constructor-arg>
+ <ref bean="grailsApplication" />
+ </constructor-arg>
+ <property name="pluginManager" ref="pluginManager" />
+ </bean>
+
+ <bean id="grailsResourceLoader" class="org.codehaus.groovy.grails.commons.GrailsResourceLoaderFactoryBean" />
+
+ <bean id="characterEncodingFilter" class="org.springframework.web.filter.CharacterEncodingFilter">
+ <property name="encoding">
+ <value>utf-8</value>
+ </property>
+ </bean>
+</beans>
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<sitemesh-excludes>
+ <excludes>
+ <pattern>/responsivePOC/*</pattern>
+ </excludes>
+</sitemesh-excludes>
@@ -0,0 +1,17 @@
+<sitemesh>
+
+ <excludes file="/WEB-INF/sitemesh-excludes.xml" />
+
+ <page-parsers>
+ <parser content-type="text/html"
+ class="org.codehaus.groovy.grails.web.sitemesh.GrailsHTMLPageParser" />
+ <parser content-type="text/html;charset=ISO-8859-1"
+ class="org.codehaus.groovy.grails.web.sitemesh.GrailsHTMLPageParser" />
+ <parser content-type="text/html;charset=UTF-8"
+ class="org.codehaus.groovy.grails.web.sitemesh.GrailsHTMLPageParser" />
+ </page-parsers>
+
+ <decorator-mappers>
+ <mapper class="org.codehaus.groovy.grails.web.sitemesh.GrailsLayoutDecoratorMapper" />
+ </decorator-mappers>
+</sitemesh>
Oops, something went wrong.

0 comments on commit d377496

Please sign in to comment.