From 62d341699f52003eb9b83a16cb66f9d5fa33ac1c Mon Sep 17 00:00:00 2001 From: Stefan Prodan Date: Thu, 29 Aug 2013 18:04:27 +0300 Subject: [PATCH] Extended RequireJsOptions - RequireJsOptions can be modified from views - Options serialization moved to _RequireSetup.cshtml --- RequireJsNet.Docs/Views/Home/Index.cshtml | 6 +- .../Views/Shared/_RequireSetup.cshtml | 6 +- RequireJsNet/RequireJsOptions.cs | 67 ++++++++++++++++--- 3 files changed, 68 insertions(+), 11 deletions(-) diff --git a/RequireJsNet.Docs/Views/Home/Index.cshtml b/RequireJsNet.Docs/Views/Home/Index.cshtml index 4d74b1e..9f4df4c 100644 --- a/RequireJsNet.Docs/Views/Home/Index.cshtml +++ b/RequireJsNet.Docs/Views/Home/Index.cshtml @@ -1,5 +1,9 @@ -@{ +@using System.Activities.Expressions +@{ ViewBag.Title = "RequireJS for .NET"; + + //Add RequireJS Page options directly from view via ViewBag + ViewBag.PageOptions.Add("newViewOpt", "test"); } @section featured { diff --git a/RequireJsNet.Docs/Views/Shared/_RequireSetup.cshtml b/RequireJsNet.Docs/Views/Shared/_RequireSetup.cshtml index 4e4244e..80b9dee 100644 --- a/RequireJsNet.Docs/Views/Shared/_RequireSetup.cshtml +++ b/RequireJsNet.Docs/Views/Shared/_RequireSetup.cshtml @@ -1,6 +1,8 @@ @using RequireJS @{ var entryPointPath = Html.RequireJsEntryPoint(); + var pageOptions = new MvcHtmlString(RequireJsOptions.ConvertToJsObject(ViewBag.PageOptions)); + var websiteOptions = new MvcHtmlString(RequireJsOptions.ConvertToJsObject(ViewBag.GlobalOptions)); } @if(entryPointPath != null) @@ -8,8 +10,8 @@