technologist, entrepreneur, vision­ary, programmer

Wysiwyg Editing of Play! Framework Templates with the Aloha Editor


aloha-savesOk, so it is only partial editing, but still this is an interesting step in the “no CMS” direction. What I have done is modified the example code which I posted on github last week for inline editing of HTML5 elements with the Aloha WYSIWYG Editor to actually save the new content back in to the Scala Template.

I find this useful for allowing non-techie colleagues to edit and optimize text and wordings in more content oriented templates. Of course it does directly modify the source, so in the case of a live website you would want to do this in the development environment and then commit, push, deploy the new version – hence “no CMS“.

In my example I have limited the frontend code to a block in the footer template. It is only rendered into the page if the following value is set to true in the application.conf:


One of the non-elegant parts of the code is deciding which template file to look for the HTML to replace. Right now it is hard coded. I supposed the most pragmatic way would be to create a hashtable mapping URL’s to filenames.

Here you can see the changed HTML in the scala template:



The code is in github here: https://github.com/poornerd/play-aloha

If you have read this far, you may as well follow me on Twitter:

Author: poornerd

Tech­nol­o­gist, Entre­pre­neur, Vision­ary, Pro­gram­mer :: Grad­u­ated from USC (Uni­ver­sity of South­ern Cal­i­for­nia) with a degree in Com­puter Sci­ence. After 10+ years of free­lance con­sult­ing and pro­gram­ming, he co-founded Site­Force AG eBusi­ness Solu­tions in 1999 in Munich (München), Ger­many.

Leave a Reply

Required fields are marked *.