Fixes: U4-3110 Cant create new relationstype - ensures that the legacy action js path references are included

This commit is contained in:
Shannon
2013-10-15 16:18:55 +11:00
parent 35545019a5
commit c42170cf6b
4 changed files with 18 additions and 9 deletions

View File

@@ -17,7 +17,7 @@ angular.module("umbraco.directives")
if (menuAction.length !== 2) {
//if it is not two parts long then this most likely means that it's a legacy action
var js = action.metaData["jsAction"];
var js = action.metaData["jsAction"].replace("javascript:", "");
//there's not really a different way to acheive this except for eval
eval(js);

View File

@@ -5,6 +5,7 @@ using System.Linq;
using System.Text;
using System.Text.RegularExpressions;
using System.Web.Mvc;
using Newtonsoft.Json.Linq;
using Umbraco.Core.Configuration;
using Umbraco.Core.IO;
using Umbraco.Core.Manifest;
@@ -33,7 +34,7 @@ namespace Umbraco.Web.Editors
}
/// <summary>
/// Returns the RequireJS file including all references found in manifests
/// Returns the JavaScript main file including all references found in manifests
/// </summary>
/// <returns></returns>
public JavaScriptResult Application()
@@ -43,8 +44,10 @@ namespace Umbraco.Web.Editors
var initJs = new JsInitialization(parser);
var initCss = new CssInitialization(parser);
//get the legacy ActionJs file references to append as well
var legacyActionJsRef = new JArray(GetLegacyActionJs(LegacyJsActionType.JsUrl));
var result = initJs.GetJavascriptInitialization(JsInitialization.GetDefaultInitialization());
var result = initJs.GetJavascriptInitialization(JsInitialization.GetDefaultInitialization(), legacyActionJsRef);
result += initCss.GetStylesheetInitialization();
return JavaScript(result);
@@ -207,9 +210,9 @@ namespace Umbraco.Web.Editors
}
/// <summary>
/// Renders out all JavaScript blocks that have bee declared in IActions
/// Renders out all JavaScript references that have bee declared in IActions
/// </summary>
private IEnumerable<string> GetLegacyActionJs(LegacyJsActionType type)
private static IEnumerable<string> GetLegacyActionJs(LegacyJsActionType type)
{
var blockList = new List<string>();
var urlList = new List<string>();

View File

@@ -23,7 +23,7 @@ namespace Umbraco.Web.UI.JavaScript
/// </summary>
public string GetStylesheetInitialization()
{
JArray merged = new JArray();
var merged = new JArray();
foreach (var m in _parser.GetManifests())
{
ManifestParser.MergeJArrays(merged, m.StylesheetInitialize);
@@ -36,11 +36,11 @@ namespace Umbraco.Web.UI.JavaScript
/// <summary>
/// Parses the CssResources.Main and returns a yepnop.injectCss format
/// </summary>
/// <param name="replacements"></param>
/// <param name="files"></param>
/// <returns></returns>
internal static string ParseMain(JArray files)
{
StringBuilder sb = new StringBuilder();
var sb = new StringBuilder();
foreach (var file in files)
sb.AppendFormat("{0}yepnope.injectCss('{1}');", Environment.NewLine, file);

View File

@@ -34,13 +34,19 @@ namespace Umbraco.Web.UI.JavaScript
/// <summary>
/// Processes all found manifest files and outputs the main.js file containing all plugin manifests
/// </summary>
public string GetJavascriptInitialization(JArray umbracoInit)
public string GetJavascriptInitialization(JArray umbracoInit, JArray additionalJsFiles = null)
{
foreach (var m in _parser.GetManifests())
{
ManifestParser.MergeJArrays(umbracoInit, m.JavaScriptInitialize);
}
//merge in the additional ones specified if there are any
if (additionalJsFiles != null)
{
ManifestParser.MergeJArrays(umbracoInit, additionalJsFiles);
}
return ParseMain(
umbracoInit.ToString(),
IOHelper.ResolveUrl(SystemDirectories.Umbraco));