diff --git a/RequireJsNet.Docs/RequireJsNet.Docs.csproj b/RequireJsNet.Docs/RequireJsNet.Docs.csproj
index 68ba223..6514b84 100644
--- a/RequireJsNet.Docs/RequireJsNet.Docs.csproj
+++ b/RequireJsNet.Docs/RequireJsNet.Docs.csproj
@@ -192,10 +192,9 @@
-
-
-
+
+
diff --git a/RequireJsNet.Docs/Scripts/Controllers/Root/Home/home-contact.js b/RequireJsNet.Docs/Scripts/Controllers/Root/Home/home-contact.js
index bb6b019..d78cdc1 100644
--- a/RequireJsNet.Docs/Scripts/Controllers/Root/Home/home-contact.js
+++ b/RequireJsNet.Docs/Scripts/Controllers/Root/Home/home-contact.js
@@ -1,14 +1,11 @@
/*
- * RequireJS for .NET
- * Version 1.0.2.0
- * Release Date 26/08/2013
+ * RequireJS.NET
* Copyright Stefan Prodan
* http://stefanprodan.eu
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
-
require([
'Mods/myPublicModule',
'jquery',
diff --git a/RequireJsNet.Docs/Scripts/Controllers/Root/Home/home-inbox.js b/RequireJsNet.Docs/Scripts/Controllers/Root/Home/inbox.js
similarity index 96%
rename from RequireJsNet.Docs/Scripts/Controllers/Root/Home/home-inbox.js
rename to RequireJsNet.Docs/Scripts/Controllers/Root/Home/inbox.js
index 6ca7688..0249f49 100644
--- a/RequireJsNet.Docs/Scripts/Controllers/Root/Home/home-inbox.js
+++ b/RequireJsNet.Docs/Scripts/Controllers/Root/Home/inbox.js
@@ -1,17 +1,13 @@
/*
- * RequireJS for .NET
- * Version 1.0.2.0
- * Release Date 26/08/2013
+ * RequireJS.NET
* Copyright Stefan Prodan
* http://stefanprodan.eu
* Dual licensed under the MIT and GPL licenses:
* http://www.opensource.org/licenses/mit-license.php
* http://www.gnu.org/licenses/gpl.html
*/
-
require([
'keepalive-service', //add dependency
- 'jquery',
'app-global'
], function (keepalive) {
diff --git a/RequireJsNet.Docs/Scripts/Controllers/Root/Home/home-index.js b/RequireJsNet.Docs/Scripts/Controllers/Root/Home/index.js
similarity index 98%
rename from RequireJsNet.Docs/Scripts/Controllers/Root/Home/home-index.js
rename to RequireJsNet.Docs/Scripts/Controllers/Root/Home/index.js
index a5f1cff..eaf4382 100644
--- a/RequireJsNet.Docs/Scripts/Controllers/Root/Home/home-index.js
+++ b/RequireJsNet.Docs/Scripts/Controllers/Root/Home/index.js
@@ -1,7 +1,5 @@
/*
- * RequireJS for .NET
- * Version 1.0.2.0
- * Release Date 26/08/2013
+ * RequireJS.NET
* Copyright Stefan Prodan
* http://stefanprodan.eu
* Dual licensed under the MIT and GPL licenses:
diff --git a/RequireJsNet.Docs/Views/Home/Index.cshtml b/RequireJsNet.Docs/Views/Home/Index.cshtml
index 9f4df4c..f881d02 100644
--- a/RequireJsNet.Docs/Views/Home/Index.cshtml
+++ b/RequireJsNet.Docs/Views/Home/Index.cshtml
@@ -39,7 +39,7 @@
Object instantiation
- app-global.js & home-index.js
+ app-global.js & root/home/index.js
diff --git a/RequireJsNet/RequireJsHtmlHelpers.cs b/RequireJsNet/RequireJsHtmlHelpers.cs
index ad61aea..f7990b7 100644
--- a/RequireJsNet/RequireJsHtmlHelpers.cs
+++ b/RequireJsNet/RequireJsHtmlHelpers.cs
@@ -124,18 +124,49 @@ public static MvcHtmlString RequireJsEntryPoint(this HtmlHelper html)
var area = html.ViewContext.RouteData.DataTokens["area"] != null
? html.ViewContext.RouteData.DataTokens["area"].ToString()
: "Root";
+
var controller = html.ViewContext.Controller.ValueProvider.GetValue("controller").RawValue as string;
var action = html.ViewContext.Controller.ValueProvider.GetValue("action").RawValue as string;
- var entryPointTmpl = "Controllers/{0}/" + controller + "/" + controller + "-" + action;
+
+ //search for controller/action.js in current area
+ var entryPointTmpl = "Controllers/{0}/" + controller + "/" + action;
var entryPoint = string.Format(entryPointTmpl, area);
var filePath = html.ViewContext.HttpContext.Server.MapPath("~/Scripts/" + entryPoint + ".js");
+
if (File.Exists(filePath))
{
return new MvcHtmlString(entryPoint);
}
+
+ //search for controller/action.js in common area
entryPoint = string.Format(entryPointTmpl, "Common");
- var fallbackFile = html.ViewContext.HttpContext.Server.MapPath("~/Scripts/" + entryPoint + ".js");
- return File.Exists(fallbackFile) ? new MvcHtmlString(entryPoint) : null;
+ filePath = html.ViewContext.HttpContext.Server.MapPath("~/Scripts/" + entryPoint + ".js");
+
+ if (File.Exists(filePath))
+ {
+ return new MvcHtmlString(entryPoint);
+ }
+
+ //search for controller/controller-action.js in current area
+ entryPointTmpl = "Controllers/{0}/" + controller + "/" + controller + "-" + action;
+ entryPoint = string.Format(entryPointTmpl, area);
+ filePath = html.ViewContext.HttpContext.Server.MapPath("~/Scripts/" + entryPoint + ".js");
+
+ if (File.Exists(filePath))
+ {
+ return new MvcHtmlString(entryPoint);
+ }
+
+ //search for controller/controller-action.js in common area
+ entryPoint = string.Format(entryPointTmpl, "Common");
+ filePath = html.ViewContext.HttpContext.Server.MapPath("~/Scripts/" + entryPoint + ".js");
+
+ if (File.Exists(filePath))
+ {
+ return new MvcHtmlString(entryPoint);
+ }
+
+ return null;
}
public static MvcHtmlString GetRequireJsPaths(this HtmlHelper html, string configPath = "")