PK Ĵ5Ki-p# # manifestversion=2.5 frameworkVersions=1.5+ PK Ĵ5KI I CHANGELOG== Changelog ### 2.5 (2017-09-21) * use newer api of play-rebel 1.2 === 2.4 (30.06.2017) * upgrade to play-rebel 1.1 * bugfix: sometimes `Tags` created the same `CMSPage` twice === 2.3 (14.02.2017) * upgrade to play-rebel 1.0 and play 1.5.+ === 2.2 (13.02.2017) * use play-secure 0.5 instead of Play! built-in module "secure" === 2.1 (21.01.2017) * use play-rebel 0.6, extend RebelController === 2.0 (03.01.2017) * use render methods that work without play enhancer * use DB methods that work without play enhancer * remove prefix "/cms" - it seems that prefix was added in another place (like `GET /page module:cms` in application's routes file) === 1.6 (19.12.2016) * redirect to URL instead of action * add prefix "/cms" to all "/admin/..." urls to avoid clash with some other "/admin" pages === 1.5 (4.05.2016) * Use play built-in method Java.invokeChildOrStatic (instead of re-inventing the wheel) === 1.4.1 (15.02.2015) * make play-cms compatible with gt-engine (faster groovy templates) === 1.4 (24.12.2014) * keep flash parameters when showing image (either valid or invalid).PK kJcɳ README.textileh1. 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. h1. Quickstart Add the dependency in dependency.yml
require
- play-cms -> cms 2.0
repositories:
- play-cms:
type: http
artifact: http://repo.codeborne.com/play-cms/[module]-[revision].zip
contains:
- play-cms -> *
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:
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.
PK kJ` ` build.sh#!/bin/bash
MODULE="cms"
VERSION=`grep self conf/dependencies.yml | sed "s/.*$MODULE //"`
TARGET=/var/www/repo/play-$MODULE/$MODULE-$VERSION.zip
rm -fr dist || exit $?
play dependencies --sync || exit $?
play build-module || exit $?
if [ -e $TARGET ]; then
echo "Not publishing, $MODULE-$VERSION already exists"
else
cp dist/*.zip $TARGET
fi
PK kJ4E*C C build.xml