A simple CMS to be able to edit pages, page fragments and images using a WYSIWYG editor
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


A simple CMS for Play! applications

Ever had the requirement to quickly do a simple textual change to one of the static pages of your app? – Here comes the solution: Embed a simple CMS!

  • Create static pages with editable content
  • Declare parts of dynamic pages to be editable via the CMS
  • Use tinymce with an image uploader to edit pages and fragments!

To dig deeper into this module, take a look at documentation/manual/home.textile.


Add the dependency in dependency.yml

       - play -> cms 1.0

Add routes:

GET   /page     module:cms

Of course only connected users can edit pages, and (by default) they must have the admin profile, so check against that profile in your controllers.Security.java, e.g.:

        static boolean check(String profile) {
                String username = connected();
                if (username == null)
                        return false;
                User user = User.findByName(username);
                if (user == null)
                        return false;
                if ("admin".equals(profile))
                        return user.admin;
                return false;

You can change the required cms profile by adding a configuration property named cms.profile.

Now navigate to /page/admin and create and edit pages using the Tiny MCE HTML editor. After your have created a page of name, say, page1, eventually use the following URL to display it: /page/page1.

Optionally create the following templates to make the pages look more like being part of your app:

  • cms/default.html, which will be used to render your pages.
  • cms/cms.html, which will be used to render the cms admin pages.

Congratulations! You just added a CMS to your Play! App!

You could also use this CMS to edit parts of your pages. Simply put parts, say the footer, of your template into a cms display tag:

<div id="footer">
#{cms.display 'footer' }
    <a href="/page/terms.html">Terms</a>

After having rendered the changed template once, there exists a CMS page ‘footer’. Since this page is not active, you will not notice any differences in your app – yet! But if you start editing the new page and activate it, its content will be displayed instead of the content from your template.

Simple remove the page or inactivate it to re-establish the old content.