Inline Editing of Play! Framwork 2 Scala Templates in the Browser
To provide tools to be used during the development process to accelerate the frontend finetuning, by not requiring programming skills for editing content and messages.
- Add dependency to project/Build.scala:
val appDependencies = Seq(
"com.poornerd" % "playinline_2.10" % "1.0-SNAPSHOT"
// the rest here
)
and
resolvers += Resolver.url("playinline repository", url("http://poornerd.github.com/releases/"))(Resolver.ivyStylePatterns)
- Create a conf/message file if you do not already have one. (add a comment with # if it is empty)
- Make sure you have JQuery included in you main.scala.html (master templates)
- Add this include to you main.scala.html before the end of the body tag (or in your master templates at the appropriate position):
@playinline.playInlineFooter()
- Add this to your conf/application.conf to make the messages editable in DEVELOP mode:
#playinline config
playinline.admin=true
- Add this to your conf/routes so that the routes from the module are used in your application:
-> /playinline playinline.Routes
Now you can add @Messages("message.key") tags to any template and edit them.
You can edit HTML elements from the templates in the template as well be doing the following:
- Add a key with the filename for the template, so that
@session.put("playinline.filename." + request.uri,"index.scala.html")
- Add a unique ID to the HTML element you want to be editable, and add the class "editable" like this:
<p id="firsttest" class="editable">This is some HTML to edit!</p>
Copyright (c) 2013 Brian Porter - http://www.poornerd.com Twitter:poornerd
Published under Apache Software License 2.0, see LICENSE