To be able to run project locally, some additional packages are required to be present on target machine.
- java 8 should be installed and ready under $HOME. More info can be found here.
- sbt, docker should be installed. On debian based linux distros:
apt-get install sbt docker
Also, ports 9000 and 3306 should not be occupied by other applications, as they would be used for demo app and DB, respectively.
As first step, let's install and run play-cms demo, using it as a starting point for our application.
1. Create new folder for our project:
git clone ssh://email@example.com:10022/open-source/play-cms/play-cms.git
git clone ssh://firstname.lastname@example.org:10022/open-source/play-cms/demo.git -b 2.7.x
3. Create .sbtops file, this will ensure, that local play-cms would be used.
cp cp .sbtopts-example .sbtopts
4. Run application
5. Wait for (Server started, use Enter to stop and go back to the console...) message to appear in console, and then go to http://localhost:9000/reset to initialize demo data.
Now setup is finished and project is available at http://localhost:9000/
Application backend can be accessed at http://localhost:9000/admin.
To login, default admin credentials should be used:
First, let's create a new Role. For this, we should go to Settings > Roles, and Press "+New" button. Lets name our new role Cat lover. We can also set specific permissions here, but for now, this is not needed. Pressing "Save" will create our new role Cat lover, and will get us back to Settings > Roles.
Now, let's start by creating new user. For this, let's visit User management > New, and fill the form with out new user data. Let's name her Kate Dou, email@example.com, and enter temp123 password in both input fields. Pressing "Save" will create our new user Kate, and will get us back to User management.
What is left for us here, is to assign a role for our new user. To execute this, when on User management page, select our Kate Dou from the list, by pressing on her name - this will get us to her profile page. Now, we can go to Roles tab, unselect her User role and select Cat lover instead. Do not forget to Save your changes !
Now, that we are done with our new user, let's create a page for her. Go to Navigation management , here, under Site: site1.ch > Website, we can modify our current frontend navigation. Let's press "+" button over the Website subsection here, and select PageBlock, to add our new page - this will take us to PageBlock edit form.
- First, let's make our page visible, by flipping Visible switch into ON position.
- Then, let's set both Title and Navigation title - "We love cats" looks as exactly what we want to see here.
- After entering Title, we can also see, that Virtual path was also automatically generated for us - it will be used to access our new page. so we can leave it like it is.
Our new page should appear under Site: site1.ch > Website section, and we can open it, by pressing the "eye" icon, which we should do right now. As we are currently logged in as admin, we would be able to open this new page, and see it in the header navigation.
Page works fine, but, unfortunately it is empty, so, let's add some content here. At the top of the page we can see PageBlock header, which is visible only to the with MODIFY permissions. Inside the page body, we can see empty Colection block, which was added automatically, when page was created, and that is exactly the place, where we should start.
Press "+" button to the right of the Collection, and select HorizontalCollection, to add a new block here. HorizontalCollection edit form will open, but we do not really need to change anything there, we could just immediately Save it.
Now, HorizontalCollection block will be added, right inside Collection block. Let's press "+" button to the right of the HorizontalCollection, and now we can add ContentBlock. ContentBlock edit form will open, and that's where we can add our custom content.
- Let's use Content field to express our feelings here and specify why exactly we love cats so much - which is, essentially because They are fluffy.
- Under modify permission, let's enable it for our new Cat lover role.
- Under the read permissions - let's disable Everybody, and enable Cat lover, so page would be hidden from guests and ordinary users.
Now let's Save it - and we are back at the page, only it's not as empty now.
First, let's log out, by pressing Logout link in the header. We love cats would remain available to us, but if we open it - we would not be able to edit anything as we are here as a guest.
Now, it's time for Kate to get on a scene. We can use Kate's credentials (firstname.lastname@example.org / temp123) to login as a user of Cat lover role. When visiting We love cats page, we can see, that we actually have access to edit ContentBlock block, which we definitely should use, by pressing "pencil" icon to the right of it, and the edit form will open. Let's add some more reasons why we are loving cats and Save our block.
Create your own block and use it on some pages (https://play-cms.com/doc/cms/create-your-own-cms-block)
Create a new page layout (https://play-cms.com/doc/cms/create-a-multi-template-page-and-add-collections)
Add navigation entries to front- and backend (partially https://play-cms.com/doc/cms/create-a-multi-template-page-and-add-collections)