Skip to content

Commit

Permalink
replaced internal Scaffold class with Datasilk/Scaffold github submodule
Browse files Browse the repository at this point in the history
  • Loading branch information
markentingh committed Jan 5, 2018
1 parent dc571be commit 3963d03
Show file tree
Hide file tree
Showing 7 changed files with 415 additions and 279 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
@@ -0,0 +1,3 @@
[submodule "Utility/Scaffold"]
path = Utility/Scaffold
url = http://github.com/Datasilk/Scaffold
2 changes: 1 addition & 1 deletion README.md
Expand Up @@ -41,7 +41,7 @@ namespace MyProject.Pages
public override string Render(string[] path, string body = "", object metadata = null)
{
//render page
var scaffold = new Scaffold(S, "/Pages/Home/home.html");
var scaffold = new Scaffold(S.Server.MapPath("/Pages/Home/home.html");
scaffold.Data["title"] = "Welcome!";
return base.Render(path, scaffold.Render(), metadata);
}
Expand Down
4 changes: 2 additions & 2 deletions Request/Page.cs
Expand Up @@ -18,7 +18,7 @@ public Page(Core DatasilkCore): base (DatasilkCore)
public virtual string Render(string[] path, string body = "", object metadata = null)
{
//renders HTML layout
var scaffold = new Scaffold(S, "/layout.html");
var scaffold = new Scaffold(S.Server.MapPath("/layout.html"), "", S.Server.Scaffold);
scaffold.Data["title"] = title;
scaffold.Data["description"] = description;
scaffold.Data["head-css"] = headCss;
Expand All @@ -40,7 +40,7 @@ public string AccessDenied(bool htmlOutput = true, Page login = null)
{
return login.Render(new string[] { });
}
var scaffold = new Scaffold(S, "/access-denied.html");
var scaffold = new Scaffold(S.Server.MapPath("/access-denied.html"), "", S.Server.Scaffold);
return scaffold.Render();
}
return "Access Denied";
Expand Down
2 changes: 1 addition & 1 deletion Server.cs
Expand Up @@ -42,7 +42,7 @@ public enum enumEnvironment
//Value for key/value pair is an array of HTML (scaffold["key"][x].htm),
// separated by scaffold variable name (scaffold["key"][x].name),
// where data is injected in between each array item.
public Dictionary<string, structScaffold> Scaffold = new Dictionary<string, structScaffold>();
public Dictionary<string, SerializedScaffold> Scaffold = new Dictionary<string, SerializedScaffold>();

#region "System.UI.Web.Page.Server methods"
public string MapPath(string strPath = "") {
Expand Down
5 changes: 4 additions & 1 deletion Startup.cs
Expand Up @@ -111,6 +111,9 @@ public virtual async void Run(HttpContext context)
{
Console.WriteLine("--------------------------------------------");
Console.WriteLine("{0} GET {1}", DateTime.Now.ToString("hh:mm:ss"), path);

//optionally, wipe Scaffold cache to enable developer updates to html files when server is running
server.Scaffold = new System.Collections.Generic.Dictionary<string, SerializedScaffold>();
}

if (paths.Length > 1)
Expand Down Expand Up @@ -153,7 +156,7 @@ public virtual async void Run(HttpContext context)
requestEnd = DateTime.Now;
tspan = requestEnd - requestStart;
server.requestTime += (tspan.Seconds);
Console.WriteLine("END GET {0} {1} ms {2}", path, tspan.Milliseconds, requestType);
Console.WriteLine("END REQUEST {0} ms, {1} {2}", tspan.Milliseconds, path, requestType);
Console.WriteLine("");
}
}
Expand Down
1 change: 1 addition & 0 deletions Utility/Scaffold
Submodule Scaffold added at 6e024d

0 comments on commit 3963d03

Please sign in to comment.