6 votes

Razor Scaffold

Razor Scaffold provides an analog of XSLT apply-templates in Razor by dynamic binding in a developer conscious manner. It aims to provide a better way of structuring presentation logic on your Umbraco projects. 

Razor Scaffold enables you to write your templates in a modular way. Imagine you have an Event document type, a template for rendering this nodes would be:

@helper Event(dynamic eventNode){
     <span>@eventNode.title</span>
     <cite>@eventNode.date</cite>     <a href="@eventNode.Url">read more</a>}

You should have this helper definition inside in any Razor script file in the ~/macroScripts/Scaffold/ dir.

Then anywhere in your code you want to render an Event node you will just need to do:

@RazorScaffold.Render(eventNode);

This is basically what it does, what it enables you to do is much more interesting. I've extended Cultiv's razor examples and implemented XSLT's guru Chriztian Steinmeier use case of the multi-node tree picker (http://pimpmyxslt.com/articles/multipicker/). You can download it as WebMatrix site from here. Details about that example in this wiki page.

You can find the complete reference and details on the project wiki Usage page.

Screenshots

Archived files

Documentation

Source code

Package owner

MK

MK

MK has 55 karma points

Package Compatibility

This package is compatible with the following versions as reported by community members who have downloaded this package:
Untested or doesn't work on Umbraco Cloud
Version 8.18.x (untested)

You must login before you can report on package compatibility.

Previously reported to work on versions:

Package Information

  • Package owner: MK
  • Created: 01/02/2012
  • Current version 0.01a
  • License MIT
  • Downloads on Our: 904