cleans up a bit of code relating to U4-1412

This commit is contained in:
Shannon Deminick
2013-01-10 05:55:55 +03:00
parent 08859c3b32
commit 8ed1d76bc7
3 changed files with 10 additions and 7 deletions

View File

@@ -15,7 +15,7 @@
Umbraco.Dialogs.EditMacro.getInstance().init({
useAspNetMasterPages: <%=umbraco.UmbracoSettings.UseAspNetMasterPages.ToString().ToLower() %>,
codeEditorElementId: "<%=Request.GetItemAsString("objectId")%>",
renderingEngine: "<%=Request.GetItemAsString("renderingEngine")%>",
renderingEngine: "<%=Request.GetItemAsString("renderingEngine", "Mvc")%>",
macroAlias: '<%= _macroAlias %>'
});
});

View File

@@ -130,8 +130,9 @@
/// <summary>Initializes the class and any UI bindings</summary>
// Merge options with default
this._opts = $.extend({
this._opts = $.extend({
// Default options go here
renderingEngine: "Mvc"
}, opts);
var self = this;
@@ -152,8 +153,8 @@
updateMacro: function () {
var macroSyntax = null;
//if it is Mvc or empty, then use Mvc
if (this._opts.renderingEngine == "Mvc" || this._opts.renderingEngine == "") {
if (this._opts.renderingEngine == "Mvc") {
macroSyntax = this._getMacroSyntaxMvc();
}
else {

View File

@@ -16,8 +16,9 @@ namespace Umbraco.Web
/// </summary>
/// <param name="request"></param>
/// <param name="key"></param>
/// <param name="valueIfNotFound">The value to return if the key is not found in the collection</param>
/// <returns></returns>
public static string GetItemAsString(this HttpRequest request, string key)
public static string GetItemAsString(this HttpRequest request, string key, string valueIfNotFound = "")
{
return new HttpRequestWrapper(request).GetItemAsString(key);
}
@@ -27,11 +28,12 @@ namespace Umbraco.Web
/// </summary>
/// <param name="request"></param>
/// <param name="key"></param>
/// <param name="valueIfNotFound">The value to return if the key is not found in the collection</param>
/// <returns></returns>
public static string GetItemAsString(this HttpRequestBase request, string key)
public static string GetItemAsString(this HttpRequestBase request, string key, string valueIfNotFound = "")
{
var val = HttpContext.Current.Request[key];
return !val.IsNullOrWhiteSpace() ? val : string.Empty;
return !val.IsNullOrWhiteSpace() ? val : valueIfNotFound;
}
/// <summary>