funnelweblog/FunnelWeb — pull request #23 by martijnburgers (2012-11-16 18:23:32+00:00)
Title: Fixed the markdown preview on Edit.cshtml, added apply pretty print butt...

- updated the showdown library to 0.3.1 (source: https://github.com/coreyti/showdown)

- added apply pretty print button to Edit (post) view. I would prefer to do this near real-time like on Stack Overflow but don't have the time at the moment, will check this out later.

- In order to get the apply pretty print button to work I needed to include a JavaScript resource in the view. I wanted to regulate this in some way for all the views. I ended up in the following choices:

Scripts for the views are located in ~\Scripts\Views\\.js
Scripts for the views inside an area are located in ~\Areas\\Scripts\Views\\.js (i.e ~\Areas\Admin\Scripts\Views\WikiAdmin\Edit.js)
Scripts inside the above location are automatically added during Application_Start
Via App_Start > BundleConfig > ViewBundleRegistrar.RegisterViewBundles(bundles);
Via AreaRegistration.RegisterAllAreas() > AdminAreaRegistration.RegisterArea(AreaRegistrationContext context) > BundleConfig.RegisterBundles(BundleTable.Bundles , context)
So each area has it's own BundleConfig and RouteConfig.
Created extension method string GetViewBundlePath(this WebViewPage view). This can be used inside the view to render the view specific script like so:

(example Edit.cshtml):

@section Scripts{
@Scripts.Render(this.GetViewBundlePath())
}