From 64c0e92ba04b2ea3f5c22e4012a829cc14c99490 Mon Sep 17 00:00:00 2001 From: Tommy Parnell Date: Thu, 8 Oct 2015 21:30:03 -0400 Subject: [PATCH] continuous scroll --- src/DotNetMashup.Web/.bowerrc | 3 + .../Controllers/HomeController.cs | 13 +- src/DotNetMashup.Web/Views/Home/Index.cshtml | 54 +++- src/DotNetMashup.Web/Views/Home/Tiles.cshtml | 18 +- .../BlogPostExternalData.cshtml | 7 +- .../GithubAnnouncement.cshtml | 6 +- .../Views/Shared/_Layout.cshtml | 2 +- src/DotNetMashup.Web/bower.json | 6 + src/DotNetMashup.Web/project.json | 2 +- src/DotNetMashup.Web/wwwroot/_references.js | 242 ++++++++++++++++++ src/DotNetMashup.Web/wwwroot/css/site.css | 2 - src/DotNetMashup.Web/wwwroot/img/spin.svg | 1 + 12 files changed, 329 insertions(+), 27 deletions(-) create mode 100644 src/DotNetMashup.Web/.bowerrc create mode 100644 src/DotNetMashup.Web/bower.json create mode 100644 src/DotNetMashup.Web/wwwroot/img/spin.svg diff --git a/src/DotNetMashup.Web/.bowerrc b/src/DotNetMashup.Web/.bowerrc new file mode 100644 index 0000000..eae1131 --- /dev/null +++ b/src/DotNetMashup.Web/.bowerrc @@ -0,0 +1,3 @@ +{ + "directory": "wwwroot/lib" +} \ No newline at end of file diff --git a/src/DotNetMashup.Web/Controllers/HomeController.cs b/src/DotNetMashup.Web/Controllers/HomeController.cs index dcc7769..980ff05 100644 --- a/src/DotNetMashup.Web/Controllers/HomeController.cs +++ b/src/DotNetMashup.Web/Controllers/HomeController.cs @@ -36,7 +36,18 @@ namespace DotNetMashup.Web.Controllers { return new HttpStatusCodeResult(404); } - return View(new MashupViewModel { CurrentPage = 1, NextPage = data.Count > setting.AmountPerPage ? (int?)page + 1: null, Header = "DotNet Mashups", Posts = data.Take(setting.AmountPerPage)}); + return View(new MashupViewModel { CurrentPage = page, NextPage = data.Count > setting.AmountPerPage ? (int?)page + 1 : null, Header = "DotNet Mashups", Posts = data.Take(setting.AmountPerPage) }); + } + + public async Task Tiles(int page = 1) + { + var factoryData = (await factory.GetData()); + var data = factoryData.OrderByDescending(a => a.PublishedDate).Skip((page - 1) * setting.AmountPerPage).Take(setting.AmountPerPage * 2).ToList(); + if(data.Count < 1) + { + return new HttpStatusCodeResult(404); + } + return PartialView("Tiles", data); } public IActionResult Error() diff --git a/src/DotNetMashup.Web/Views/Home/Index.cshtml b/src/DotNetMashup.Web/Views/Home/Index.cshtml index c66fda9..ebd2201 100644 --- a/src/DotNetMashup.Web/Views/Home/Index.cshtml +++ b/src/DotNetMashup.Web/Views/Home/Index.cshtml @@ -3,15 +3,55 @@ @{ ViewData["Title"] = "Dot Net Mashups!"; } +
+ @await Html.PartialAsync("Tiles", Model.Posts) +
+ -@await Html.PartialAsync("Tiles", Model.Posts) - -
-
-@if(Model.NextPage.HasValue) +@if(Model.NextPage.HasValue || Model.CurrentPage > 1) { -
- Next Page + var page = Model.CurrentPage - 1; + +
+ @if(Model.CurrentPage > 1) + { + Previous Page + } +   + @if(Model.NextPage.HasValue) + { + Next page + + }
+} + +@section scripts{ + } \ No newline at end of file diff --git a/src/DotNetMashup.Web/Views/Home/Tiles.cshtml b/src/DotNetMashup.Web/Views/Home/Tiles.cshtml index 18ccb08..15db40c 100644 --- a/src/DotNetMashup.Web/Views/Home/Tiles.cshtml +++ b/src/DotNetMashup.Web/Views/Home/Tiles.cshtml @@ -1,14 +1,8 @@ @model IEnumerable -@{ - ViewData["Title"] = "Dot Net Mashups!"; -} -
- - @foreach(var x in Model) - { -
- @(await Html.PartialAsync("ExternalData", x)) -
- } -
\ No newline at end of file +@foreach(var x in Model) +{ +
+ @(await Html.PartialAsync("ExternalData", x)) +
+} \ No newline at end of file diff --git a/src/DotNetMashup.Web/Views/Shared/DisplayTemplates/BlogPostExternalData.cshtml b/src/DotNetMashup.Web/Views/Shared/DisplayTemplates/BlogPostExternalData.cshtml index cb4f9f9..d24f74f 100644 --- a/src/DotNetMashup.Web/Views/Shared/DisplayTemplates/BlogPostExternalData.cshtml +++ b/src/DotNetMashup.Web/Views/Shared/DisplayTemplates/BlogPostExternalData.cshtml @@ -4,11 +4,14 @@
-

@Model.Author.Name

+
+

@Model.Author.Name

+

@Model.Title

+
+
-

@Model.Title

@Html.Raw(Model.Content) Read Further diff --git a/src/DotNetMashup.Web/Views/Shared/DisplayTemplates/GithubAnnouncement.cshtml b/src/DotNetMashup.Web/Views/Shared/DisplayTemplates/GithubAnnouncement.cshtml index 1245ddf..9afa454 100644 --- a/src/DotNetMashup.Web/Views/Shared/DisplayTemplates/GithubAnnouncement.cshtml +++ b/src/DotNetMashup.Web/Views/Shared/DisplayTemplates/GithubAnnouncement.cshtml @@ -4,8 +4,12 @@
-

@Model.Author.Name #@Model.IssueNumber

+
+

@Model.Author.Name

+

#@Model.IssueNumber @Model.Title

+
+
@Html.Raw(Model.Content)
diff --git a/src/DotNetMashup.Web/Views/Shared/_Layout.cshtml b/src/DotNetMashup.Web/Views/Shared/_Layout.cshtml index 15b2b05..d76dffd 100644 --- a/src/DotNetMashup.Web/Views/Shared/_Layout.cshtml +++ b/src/DotNetMashup.Web/Views/Shared/_Layout.cshtml @@ -26,7 +26,7 @@ - + @RenderSection("scripts", required: false) diff --git a/src/DotNetMashup.Web/bower.json b/src/DotNetMashup.Web/bower.json new file mode 100644 index 0000000..4a41761 --- /dev/null +++ b/src/DotNetMashup.Web/bower.json @@ -0,0 +1,6 @@ +{ + "name": "ASP.NET", + "private": true, + "dependencies": { + } +} \ No newline at end of file diff --git a/src/DotNetMashup.Web/project.json b/src/DotNetMashup.Web/project.json index 6fe88f9..cc6461a 100644 --- a/src/DotNetMashup.Web/project.json +++ b/src/DotNetMashup.Web/project.json @@ -46,6 +46,6 @@ "**.vspscc" ], "scripts": { - "prepublish": [ "npm install", "gulp clean", "gulp min" ] + "prepublish": [ "npm install", "bower install", "gulp clean", "gulp min" ] } } \ No newline at end of file diff --git a/src/DotNetMashup.Web/wwwroot/_references.js b/src/DotNetMashup.Web/wwwroot/_references.js index ad7d373..21e8929 100644 --- a/src/DotNetMashup.Web/wwwroot/_references.js +++ b/src/DotNetMashup.Web/wwwroot/_references.js @@ -1,3 +1,245 @@ /// /// /// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// +/// diff --git a/src/DotNetMashup.Web/wwwroot/css/site.css b/src/DotNetMashup.Web/wwwroot/css/site.css index 902074a..e24e53c 100644 --- a/src/DotNetMashup.Web/wwwroot/css/site.css +++ b/src/DotNetMashup.Web/wwwroot/css/site.css @@ -17,8 +17,6 @@ footer { width: 100%; padding: 10px; background-color: #ffffff; - position: fixed; - bottom: 0; } .img { diff --git a/src/DotNetMashup.Web/wwwroot/img/spin.svg b/src/DotNetMashup.Web/wwwroot/img/spin.svg new file mode 100644 index 0000000..b94e796 --- /dev/null +++ b/src/DotNetMashup.Web/wwwroot/img/spin.svg @@ -0,0 +1 @@ + \ No newline at end of file