Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Fixes for Razor partials and html file location

  • Loading branch information...
commit efcff4b7867f924b585c6e1e3a3940a92f518771 1 parent 5f52736
@grumpydev grumpydev authored
View
2  src/Nancy.Demo.Hosting.Aspnet/DemoBootstrapper.cs
@@ -28,6 +28,8 @@ protected override void InitialiseInternal(TinyIoC.TinyIoCContainer container)
{
base.InitialiseInternal(container);
+ StaticConfiguration.DisableErrorTraces = false;
+
this.Conventions.StaticContentsConventions.Add(StaticContentConventionBuilder.AddDirectory("moo", "Content"));
CookieBasedSessions.Enable(this);
View
2  src/Nancy.Demo.Hosting.Aspnet/MainModule.cs
@@ -38,7 +38,7 @@ public MainModule(IRouteCacheProvider routeCacheProvider)
};
Get["/static"] = x => {
- return View["static.htm"];
+ return View["static"];
};
Get["/razor"] = x => {
View
2  src/Nancy.Demo.Hosting.Aspnet/Nancy.Demo.Hosting.Aspnet.csproj
@@ -101,7 +101,7 @@
<Content Include="Content\main.css" />
<Content Include="Content\scripts.js" />
<Content Include="Views\javascript.html" />
- <Content Include="Views\static.htm" />
+ <Content Include="Views\static.html" />
<Content Include="Web.config">
<SubType>Designer</SubType>
</Content>
View
0  src/Nancy.Demo.Hosting.Aspnet/Views/static.htm → src/Nancy.Demo.Hosting.Aspnet/Views/static.html
File renamed without changes
View
14 src/Nancy/ViewEngines/DefaultFileSystemReader.cs
@@ -19,17 +19,15 @@ public class DefaultFileSystemReader : IFileSystemReader
public IEnumerable<Tuple<string, Func<StreamReader>>> GetViewsWithSupportedExtensions(string path, IEnumerable<string> supportedViewExtensions)
{
return supportedViewExtensions
- .SelectMany(extension => GetFileInformation(path, extension))
- .Distinct().ToList();
+ .SelectMany(extension => GetFilenames(path, extension))
+ .Distinct()
+ .Select(file => new Tuple<string, Func<StreamReader>>(file, () => new StreamReader(new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))))
+ .ToList();
}
- private static IEnumerable<Tuple<string, Func<StreamReader>>> GetFileInformation(string path, string extension)
+ private static IEnumerable<string> GetFilenames(string path, string extension)
{
- var files = Directory
- .GetFiles(path, string.Concat("*.", extension), SearchOption.AllDirectories)
- .Distinct();
-
- return files.Select(file => new Tuple<string, Func<StreamReader>>(file, () => new StreamReader(new FileStream(file, FileMode.Open, FileAccess.Read, FileShare.ReadWrite))));
+ return Directory.GetFiles(path, string.Concat("*.", extension), SearchOption.AllDirectories);
}
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.