include a simple page preview and undo

Jun 2, 2012 at 5:34 AM
Edited Jun 2, 2012 at 5:38 AM

I am using the RazorC concept/engine for a non profit site (http://stmmparishschool.org) although I have probably extended in ways that may make it no longer make it all that compatible with future releases.

But I wanted share one some of the concepts I added for consideration in future releases. The first is a page preview capability. Without diving into all the changes needed conceptually what did was clone the page table and on edit of a page in the admin pages I clone the selected rercord to the clone table and save the users changes there initially.  I also added a preview button and a publish button. The preview button displays the editted record to a new window using a preview page that isessentially a clone of the default page.  When the user is done making changes they hit the publish button which takes the new values and updates the original record in the page table.  I felt this was necessary because the editor is quite powerful and does not adhere to the styles of the page to be published.  It's too easy for an end user not schooled in html and css to get carried away and spoil the whole look of the page. I also created an archive clone of page table that gets a copy of the record as well so if things really go bad I can use it to get back to a last good copy.  I did not put an admin interface on that table as it is my safety net and as the developer designer i can always get to it

Thought I would share this simple workflow design change for yiur cosideration.

If you look at the site some Other additions I created on the site are a database driven News Items, a data/date driven announcements widget, and a data/date driven events list.  The last feature I added is a very basic file upload that keeps meta data in the database to create down load links for PDFs the school wants to publish.  All of these features are only exposed thru the admin pages

Jun 2, 2012 at 9:47 PM

razorC4me,

I love preview/publish and archive/backup ideas.

About week ago one of my customers did BIG (for him) changes to one of the widgets and had to call me because he was unable to go back to original look, so I thought that we may need some kind of backup…

On editpage.cshtml I want to add drop down menu that will list previous version of the page you work on, so users will be able to go back simply by selecting date/time from that menu, in addition to that if you have more than X backups of the page, you will see some message or icon allowing you to delete the oldest backups – that way if everything is working just fine you can simply delete old copies. Maybe on edipage.cshtml page I will put 2 buttons Update and 2nd Update & Backup - that way you can create backup only when you really need one

To be honest with you, if users will be able to go back to previous versions I don’t think we will need preview/publish option but I like it and have to think about it.

 Let me know what you think

 BTW i like your site

Jun 3, 2012 at 4:26 AM
Edited Jun 3, 2012 at 5:55 PM

I thought about using an approach like yours to undo as well but opted for preview so that it could be proof read and repeated without having to manage multiple undo options to get back to the base record - there are advantages to both approaches. I also chose the preview approach so they get to see the changes before committing them to a live site. If I get really ambitious this was to evolve into an edit/approval workflow but time pressures kept me from doing that. Maybe the best solution is to do both. The biggest downside to the preview my current way is having to keep the preview.cshtml in synch with any changes to the RC default framework of the site, especially if you have custom layouts that need to support preview

To get around that I thought about building in a key parm to indicate a preview request. That way when say /pre was in the request, the page would retrieve its data from the preview table instead of the page table thus allowing all the components of the page to be rendered just like the real thing. I am new to C# and razor web pages and I broke it so badly the first try that I had to start over and never got back to that approach.