Converted over the SaveTemplate and SavePartialView methods of the codeEditorSave legacy web service to use MVC services and marked them obsolete. Created a generic route to route all controllers found in the namespace Umbraco.Web.WebServices. Added a 'Url' property on the BasePage webforms class to expose a UrlHelper for use in views. Created UrlHelper extensions to easily get the base url path of the REST MVC web services. Converted the EditView page and JavaScript to use the new REST services with jQuery instead of crappy MS ajax.
28 lines
730 B
C#
28 lines
730 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Web.Mvc;
|
|
using Umbraco.Core.Configuration;
|
|
|
|
namespace Umbraco.Core
|
|
{
|
|
/// <summary>
|
|
/// Extension methods for UrlHelper
|
|
/// </summary>
|
|
public static class UrlHelperExtensions
|
|
{
|
|
/// <summary>
|
|
/// Returns the base path (not including the 'action') of the MVC controller "SaveFileController"
|
|
/// </summary>
|
|
/// <param name="url"></param>
|
|
/// <returns></returns>
|
|
public static string GetSaveFileServicePath(this UrlHelper url)
|
|
{
|
|
var result = url.Action("SavePartialView", "SaveFile", new {area = GlobalSettings.UmbracoMvcArea});
|
|
return result.TrimEnd("SavePartialView");
|
|
}
|
|
|
|
}
|
|
}
|