Created
July 26, 2013 07:51
-
-
Save rpocklin/6087040 to your computer and use it in GitHub Desktop.
Scala feature toggles
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
@(toggle: String)(enabledContent: Any)(disabledContent: Any) | |
@import play.api._ | |
@defining(Play.current.configuration.getBoolean("toggles." + toggle)) { toggleValue => | |
@toggleValue match { | |
case Some(toggleEnabled) => { | |
@if(toggleEnabled) { | |
@enabledContent | |
} else { | |
@disabledContent | |
} | |
} | |
case None => { | |
<h1> Error invalid toggle specified: @toggle</h1> | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment