1 December 2015

Part 1: Page History: Create a content Editor Tab running a SPEAK App

As per the previous Blog Post: http://sitecorepromenade.blogspot.com.au/2015/12/viewing-history-of-page-and-components.html, We will first see how to create a Content Editor Tab in Sitecore and link a new SPEAK App that will run in the Tab.


So the first thing we will look is where do we create the content editor. Well as you can imagine it will be in the Core database. So if you open sitecore desktop and switch the context to Core DB, you can then navigate to the following location: /sitecore/content/Applications/Content Editor/Editors


You can create a new folder for your editor item. This will be from the Common/Folder template.
You can also create a new item from the template /sitecore/templates/Sitecore Client/Content editor/Editor
This item will be the Tab Item you want to add to your templates...


When filling in the fields you will notice the URL field. This field is where you specify which application you would like to run. Sitecore will embbed this resources to run in an iframe inside the Tab. You could easily run a normal aspx page there which will be quite simple to create but for the purpose of the PoC, we will select to go for a SPEAK app... The URL for you App will be similar to: /Sitecore/Client/Your Apps/YourAppName


So let's create a new SPEAK App. There are awesome tutorials around on how to create a SPEAK App. One of my favourite is written by Vikram (Thanks for your hard work.):  https://cmsview.wordpress.com/2015/10/07/sitecore-8-for-beginners-creating-speak-application/ 
It explain quite in details how to create a simple app but also how to create a custom one and how to get data from a custom component... This blog post is not intended to be atutorial to show you how to create the SPEAK app so I will not go over all the steps to create the App itself. But in the nutshell you will create a custom SPEAK Component using Sitecore ROCKS:


This will create you the three files: cshtml, and 2 js  files:

Now in sitecore you will have created the application items which will be as per the following:

On the Application presentation, you will have your rendering added:

Now your Speak App is set. Make sure your updating the Content editor item as per the above to point the URL field to the new SPEAK APP:


Now , the last missing link is to make it appear on a page or on the template standard value. To do that, Switch to the Master Database and locate either the page you want your content editor tab and/or your template standard values item where you want to add your tab to. On the Appearance section, locate the "Editors" Field:

Add the new editor item we have created:

This will now bring the new tab as per the following:


The next steps will be looking into the code that will read the item and retrieve all the presentation and history information....

No comments:

Post a Comment