Custom Views are a great feature to know about in Episerver for when we as developers want to provide additional information/functionality to the CMS user. This demo shows four Custom Views in hopes of providing some inspiration for how you can leverage Custom Views to enhance the editor experience on your Episerver website.
This solution was built from a blank Episerver solution with the intent of showcasing the Custom Views feature in Episerver. There are quite a few files in the solution to handle basic Episerver CMS stuff, so I would focus on the files highlighted below.
All views are built using standard Episerver CMS and ASP.NET MVC. NO DOJO REQUIRED!
When cloned, you can use the user localadmin ==> Abc123 to access the CMS locally.
To view the Custom Views, navigate to the page titled "The Greatest Play Ever" in Edit Mode.
In order to setup a custom view, here are the general steps:
Create a class to register a new Custom view.
- ~/Business/ViewConfigurations.cs
Since we are using an iFrame and setting a route, we need to make sure the view path routes to something
- ~/Global.asax
Create a Controller to handle the request when a user switches to the new Custom view
- All the files in ~/Controllers/CustomViewControllers
Display what you want the user to see when they switch to the Custom View
- The .cshtml files in the ~/Views root folder
This solution comes with four Custom View examples. Note that the content rendered generally speaking is hard-coded...these are intended just to give you an idea of the types of things you could do. These are not intended to be dropped and used "out of box", as you will be very dissapointed :)
Use a Custom View to provide helpful information to the CMS Editor. This is useful if you have companion documentation paired with your implementation...consider using a Custom View to display that documentation directly with the page itself.
Use a Custom View when certain properties have robust best practice information which you cannot fit into just the Description property. Can also use these for complex validation/analysis of entered properties.
Sometimes relevant information about a particular page lives in an external system. You can use a Custom View to display this information to the CSM Editor.
If you have a complex property and cannot figure out how to make on-page editing work, you can utilize a Custom View instead. This lets you build an editor experience strictly using MVC instead of having to mess with Dojo.
I found the following articles to be helpful while developing this demo.