Fixed the markdown preview on Edit.cshtml, added apply pretty print butt... #23
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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<Action/View>.js
Scripts for the views inside an area are located in ~\Areas\Scripts\Views<Action/View>.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())
}