diff --git a/src/Foundation/Features/Blog/BlogListPage/Index.cshtml b/src/Foundation/Features/Blog/BlogListPage/Index.cshtml index 39b15fc39..a9540d1f5 100644 --- a/src/Foundation/Features/Blog/BlogListPage/Index.cshtml +++ b/src/Foundation/Features/Blog/BlogListPage/Index.cshtml @@ -29,6 +29,7 @@
@Html.Partial("_BlogList", Model) + @Html.Partial("_Paging", Model)
\ No newline at end of file diff --git a/src/Foundation/Features/Blog/BlogListPage/Preview.cshtml b/src/Foundation/Features/Blog/BlogListPage/Preview.cshtml deleted file mode 100644 index 60811cd35..000000000 --- a/src/Foundation/Features/Blog/BlogListPage/Preview.cshtml +++ /dev/null @@ -1,228 +0,0 @@ -@using EPiServer.AddOns.Helpers -@using EPiServer.Core -@using EPiServer.Web.Mvc.Html -@using ImageProcessor.Web.Episerver -@using Foundation.Features.Blog.BlogItemPage -@using Foundation.Features.Shared.SelectionFactories - -@model BlogItemPageViewModel - -@if (string.IsNullOrEmpty(Model.Template) || Model.Template == TemplateSelections.Grid) -{ -
-
- @if (!ContentReference.IsNullOrEmpty(Model.CurrentContent.PageImage)) - { - - } -
-
-
- - @foreach (var tag in Model.Tags) - { - - } - -

- @Model.CurrentContent.MetaTitle -

- @if (Model.ShowPublishDate) - { -

@Model.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy")

- } - @if (Model.ShowIntroduction) - { -

@Html.Raw(Model.PreviewText)

- } -
-
-
-} - -@if (Model.Template == TemplateSelections.ImageLeft) -{ - var imageCol = Model.PreviewOption == PreviewOptions.Full ? 12 : (Model.PreviewOption == PreviewOptions.Half ? 6 : 4); - var textCol = imageCol == 12 ? 12 : 12 - imageCol; -
-
-
- @if (!ContentReference.IsNullOrEmpty(Model.CurrentContent.PageImage)) - { - - } -
-
-
- - @foreach (var tag in Model.Tags) - { - - } - -

- @Model.CurrentContent.MetaTitle -

- @if (Model.ShowPublishDate) - { -

@Model.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy")

- } - @if (Model.ShowIntroduction) - { -
-

@Html.Raw(Model.PreviewText)

- } -
-
-
-} - -@if (Model.Template == TemplateSelections.ImageTop) -{ - var imageCol = Model.PreviewOption == PreviewOptions.Full ? 12 : (Model.PreviewOption == PreviewOptions.Half ? 6 : 4); - -
-
- @if (!ContentReference.IsNullOrEmpty(Model.CurrentContent.PageImage)) - { - - } -
-
- - @foreach (var tag in Model.Tags) - { - - } - - @if (Model.ShowPublishDate) - { -

@Model.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy")

- } -

- @Model.CurrentContent.MetaTitle -

- - @if (Model.ShowIntroduction) - { -
-

@Html.Raw(Model.PreviewText)

- } -
-
-} - -@if (Model.Template == TemplateSelections.NoImage) -{ - var imageCol = Model.PreviewOption == PreviewOptions.Full ? 12 : (Model.PreviewOption == PreviewOptions.Half ? 6 : 4); -
- - @foreach (var tag in Model.Tags) - { - - } - -

- @Model.CurrentContent.MetaTitle -

- @if (Model.ShowPublishDate) - { -

@Model.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy")

- } - @if (Model.ShowIntroduction) - { -
-

@Html.Raw(Model.PreviewText)

- } -
-} - -@if (Model.Template == TemplateSelections.Highlight) -{ - var imageCol = Model.PreviewOption == PreviewOptions.Half ? 6 : 4; - var textCol = imageCol == 12 ? 12 : 12 - imageCol; - var flip = ViewData["Flip"] != null ? ((bool)ViewData["Flip"]) : false; - if (!Model.CurrentContent.Highlight) - { -
- @if (!flip) - { -
-
- @if (!ContentReference.IsNullOrEmpty(Model.CurrentContent.PageImage)) - { - - } -
-
- } -
- - @foreach (var tag in Model.Tags) - { - - } - -

- @Model.CurrentContent.MetaTitle -

- @if (Model.ShowPublishDate) - { -

@Model.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy")

- } - @if (Model.ShowIntroduction) - { -
-

@Html.Raw(Model.PreviewText)

- } -
- @if (flip) - { -
-
- @if (!ContentReference.IsNullOrEmpty(Model.CurrentContent.PageImage)) - { - - } -
-
- } -
- } - else - { -
-
-
-
- @if (!ContentReference.IsNullOrEmpty(Model.CurrentContent.PageImage)) - { - - } -
-
-
- - @foreach (var tag in Model.Tags) - { - - } - -

- @Model.CurrentContent.MetaTitle -

- @if (Model.ShowPublishDate) - { -

@Model.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy")

- } - @if (Model.ShowIntroduction) - { -
-

@Html.Raw(Model.PreviewText)

- } -
-
-
- } -
-} \ No newline at end of file diff --git a/src/Foundation/Features/Blog/BlogListPage/_BlogList.cshtml b/src/Foundation/Features/Blog/BlogListPage/_BlogList.cshtml index 246409a8a..b9d3ac43f 100644 --- a/src/Foundation/Features/Blog/BlogListPage/_BlogList.cshtml +++ b/src/Foundation/Features/Blog/BlogListPage/_BlogList.cshtml @@ -4,88 +4,49 @@ @model BlogListPageViewModel -@if (string.IsNullOrEmpty(Model.CurrentContent.Template) || Model.CurrentContent.Template == TemplateSelections.Grid) +@if (string.IsNullOrEmpty(Model.CurrentContent.Template)) { - @Html.Partial("_GridTemplate", Model) + Model.CurrentContent.Template = TemplateSelections.Grid; } - -@if (Model.CurrentContent.Template == TemplateSelections.Card) + +@switch(Model.CurrentContent.Template) { -
+ case TemplateSelections.Grid: + @Html.Partial("_GridTemplate", Model) + break; + + case TemplateSelections.Card: @Html.Partial("_CardTemplate", Model) -
-} + break; -@if (Model.CurrentContent.Template == TemplateSelections.Insight) -{ -
+ case TemplateSelections.Insight: @Html.Partial("_InsightTemplate", Model) -
-} + break; -@if (Model.CurrentContent.Template == TemplateSelections.ImageLeft) -{ - if (Model.Blogs != null && Model.Blogs.Any()) - { - foreach (var blog in Model.Blogs) - { - @Html.Partial("Preview", blog) - } - } -} + case TemplateSelections.ImageLeft: + @Html.Partial("_ImageLeftTemplate", Model) + break; -@if (Model.CurrentContent.Template == TemplateSelections.ImageTop || Model.CurrentContent.Template == TemplateSelections.NoImage) -{ - if (Model.Blogs != null && Model.Blogs.Any()) - { -
- @foreach (var blog in Model.Blogs) - { - @Html.Partial("Preview", blog) - } -
- } -} + case TemplateSelections.ImageTop: + @Html.Partial("_ImageTopTemplate", Model) + break; -@if (Model.CurrentContent.Template == TemplateSelections.Highlight) -{ - if (Model.Blogs != null && Model.Blogs.Any()) - { - var flip = false; - foreach (var blog in Model.Blogs) + case TemplateSelections.NoImage: + @Html.Partial("_NoImageTemplate", Model) + break; + + case TemplateSelections.Highlight: + if (Model.Blogs != null && Model.Blogs.Any()) { - @Html.Partial("Preview", blog, new ViewDataDictionary { { "Flip", flip } }) - if (!blog.CurrentContent.Highlight) + var flip = false; + foreach (var blog in Model.Blogs) { - flip = !flip; + @Html.Partial("_HighLightTemplate", blog, new ViewDataDictionary { { "Flip", flip } }) + if (!blog.CurrentContent.Highlight) + { + flip = !flip; + } } } - } -} - -@* Paging *@ - -@using (Html.BeginForm("BlogListBlock", "Test", FormMethod.Get, new { id = "jsGetBlogItemListPage" })) -{ - - - - -} - -@if (Model.CurrentContent.Template == TemplateSelections.Card || Model.CurrentContent.Template == TemplateSelections.Insight) -{ -
- -
-} -else -{ - @Html.Partial("_Paging", Model) + break; } \ No newline at end of file diff --git a/src/Foundation/Features/Blog/BlogListPage/_CardTemplate.cshtml b/src/Foundation/Features/Blog/BlogListPage/_CardTemplate.cshtml index 916a38927..c22ecccc8 100644 --- a/src/Foundation/Features/Blog/BlogListPage/_CardTemplate.cshtml +++ b/src/Foundation/Features/Blog/BlogListPage/_CardTemplate.cshtml @@ -8,60 +8,61 @@ int index = 1; int col = 12; } - -
- @foreach (var blog in Model.Blogs) - { - if (index % 6 < 4) { col = 4; } - if (index % 6 >= 4) { col = 6; } - if (index % 6 == 0) { col = 12; } - index++; -
-
-
-
- @if (!ContentReference.IsNullOrEmpty(blog.CurrentContent.PageImage)) - { - - } -
-
-
- - @foreach (var tag in blog.Tags) - { - - } - - +
+
+ @foreach (var blog in Model.Blogs) + { + if (index % 6 < 4) { col = 4; } + if (index % 6 >= 4) { col = 6; } + if (index % 6 == 0) { col = 12; } + index++; +
+
+
+
+ @if (!ContentReference.IsNullOrEmpty(blog.CurrentContent.PageImage)) + { + + }
-
- - - @blog.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy") - - +
+
+ + @foreach (var tag in blog.Tags) + { + + } + + +
+
+ + + @blog.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy") + + +
-
-
-
-
-
-
-
-
-

@Html.Raw(blog.PreviewText)

- - Read more - +
+
+
+
+
+
+
+

@Html.Raw(blog.PreviewText)

+ + Read more + +
-
- } + } +
+
-
\ No newline at end of file diff --git a/src/Foundation/Features/Blog/BlogListPage/_GridTemplate.cshtml b/src/Foundation/Features/Blog/BlogListPage/_GridTemplate.cshtml index e4c882f4b..c07d0296b 100644 --- a/src/Foundation/Features/Blog/BlogListPage/_GridTemplate.cshtml +++ b/src/Foundation/Features/Blog/BlogListPage/_GridTemplate.cshtml @@ -30,7 +30,7 @@ diff --git a/src/Foundation/Features/Blog/BlogListPage/_GridTemplateBlock.cshtml b/src/Foundation/Features/Blog/BlogListPage/_GridTemplateBlock.cshtml new file mode 100644 index 000000000..8b336b1a5 --- /dev/null +++ b/src/Foundation/Features/Blog/BlogListPage/_GridTemplateBlock.cshtml @@ -0,0 +1,34 @@ +@using EPiServer.AddOns.Helpers +@using ImageProcessor.Web.Episerver + +@model Foundation.Features.Blog.BlogItemPage.BlogItemPageViewModel + +
+
+ @if (!ContentReference.IsNullOrEmpty(Model.CurrentContent.PageImage)) + { + + } +
+
+
+ + @foreach (var tag in Model.Tags) + { + + } + +

+ @Model.CurrentContent.MetaTitle +

+ @if (Model.ShowPublishDate) + { +

@Model.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy")

+ } + @if (Model.ShowIntroduction) + { +

@Html.Raw(Model.PreviewText)

+ } +
+
+
\ No newline at end of file diff --git a/src/Foundation/Features/Blog/BlogListPage/_HighLightTemplate.cshtml b/src/Foundation/Features/Blog/BlogListPage/_HighLightTemplate.cshtml new file mode 100644 index 000000000..d29c88387 --- /dev/null +++ b/src/Foundation/Features/Blog/BlogListPage/_HighLightTemplate.cshtml @@ -0,0 +1,98 @@ +@using EPiServer.AddOns.Helpers +@using Foundation.Features.Blog.BlogItemPage +@using Foundation.Features.Shared.SelectionFactories +@using Foundation.Features.Blog.BlogListPage +@using ImageProcessor.Web.Episerver + +@model BlogItemPageViewModel + +@{ + var imageCol = Model.PreviewOption == PreviewOptions.Half ? 6 : 4; + var textCol = imageCol == 12 ? 12 : 12 - imageCol; + var flip = ViewData["Flip"] != null ? ((bool)ViewData["Flip"]) : false; +} + + +@if (!Model.CurrentContent.Highlight) +{ +
+ @if (!flip) + { +
+
+ @if (!ContentReference.IsNullOrEmpty(Model.CurrentContent.PageImage)) + { + + } +
+
+ } +
+ + @foreach (var tag in Model.Tags) + { + + } + +

+ @Model.CurrentContent.MetaTitle +

+ @if (Model.ShowPublishDate) + { +

@Model.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy")

+ } + @if (Model.ShowIntroduction) + { +
+

@Html.Raw(Model.PreviewText)

+ } +
+ @if (flip) + { +
+
+ @if (!ContentReference.IsNullOrEmpty(Model.CurrentContent.PageImage)) + { + + } +
+
+ } +
+} +else +{ +
+
+
+
+ @if (!ContentReference.IsNullOrEmpty(Model.CurrentContent.PageImage)) + { + + } +
+
+
+ + @foreach (var tag in Model.Tags) + { + + } + +

+ @Model.CurrentContent.MetaTitle +

+ @if (Model.ShowPublishDate) + { +

@Model.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy")

+ } + @if (Model.ShowIntroduction) + { +
+

@Html.Raw(Model.PreviewText)

+ } +
+
+
+} +
\ No newline at end of file diff --git a/src/Foundation/Features/Blog/BlogListPage/_ImageLeftTemplate.cshtml b/src/Foundation/Features/Blog/BlogListPage/_ImageLeftTemplate.cshtml new file mode 100644 index 000000000..af6e80422 --- /dev/null +++ b/src/Foundation/Features/Blog/BlogListPage/_ImageLeftTemplate.cshtml @@ -0,0 +1,47 @@ +@using EPiServer.AddOns.Helpers +@using EPiServer.Web.Mvc.Html +@using ImageProcessor.Web.Episerver +@using Foundation.Features.Shared.SelectionFactories +@using Foundation.Features.Blog.BlogListPage + +@model BlogListPageViewModel + +@if (Model.Blogs != null && Model.Blogs.Any()) +{ + foreach (var blog in Model.Blogs) + { + var imageCol = blog.PreviewOption == PreviewOptions.Full ? 12 : (blog.PreviewOption == PreviewOptions.Half ? 6 : 4); + var textCol = imageCol == 12 ? 12 : 12 - imageCol; +
+
+
+ @if (!ContentReference.IsNullOrEmpty(blog.CurrentContent.PageImage)) + { + + } +
+
+
+ + @foreach (var tag in blog.Tags) + { + + } + +

+ @blog.CurrentContent.MetaTitle +

+ @if (blog.ShowPublishDate) + { +

@blog.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy")

+ } + @if (blog.ShowIntroduction) + { +
+

@Html.Raw(blog.PreviewText)

+ } +
+
+
+ } +} diff --git a/src/Foundation/Features/Blog/BlogListPage/_ImageTopTemplate.cshtml b/src/Foundation/Features/Blog/BlogListPage/_ImageTopTemplate.cshtml new file mode 100644 index 000000000..89e57002f --- /dev/null +++ b/src/Foundation/Features/Blog/BlogListPage/_ImageTopTemplate.cshtml @@ -0,0 +1,45 @@ +@using EPiServer.AddOns.Helpers +@using Foundation.Features.Shared.SelectionFactories +@using ImageProcessor.Web.Episerver +@using Foundation.Features.Blog.BlogListPage + + +@model BlogListPageViewModel + +@if (Model.Blogs != null && Model.Blogs.Any()) +{ + foreach (var blog in Model.Blogs) + { + var imageCol = blog.PreviewOption == PreviewOptions.Full ? 12 : (blog.PreviewOption == PreviewOptions.Half ? 6 : 4); +
+
+ @if (!ContentReference.IsNullOrEmpty(blog.CurrentContent.PageImage)) + { + + } +
+
+ + @foreach (var tag in blog.Tags) + { + + } + + @if (blog.ShowPublishDate) + { +

@blog.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy")

+ } +

+ @blog.CurrentContent.MetaTitle +

+ + @if (blog.ShowIntroduction) + { +
+

@Html.Raw(blog.PreviewText)

+ } +
+
+ } +} + diff --git a/src/Foundation/Features/Blog/BlogListPage/_InsightTemplate.cshtml b/src/Foundation/Features/Blog/BlogListPage/_InsightTemplate.cshtml index 11ee2b280..16fb2a34e 100644 --- a/src/Foundation/Features/Blog/BlogListPage/_InsightTemplate.cshtml +++ b/src/Foundation/Features/Blog/BlogListPage/_InsightTemplate.cshtml @@ -8,132 +8,133 @@ var insightBlogs = Model.Blogs.Take(3); var insightReverseBlogs = Model.Blogs.Skip(3).Take(3).Reverse(); } - - -@if (insightBlogs.Any()) -{ - var index = 0; -
- @foreach (var blog in insightBlogs) - { - var typeIndex = index % 3; - var insightClass = "insight__large"; - switch (typeIndex) +
+ + @if (insightBlogs.Any()) + { + var index = 0; +
+ @foreach (var blog in insightBlogs) { - case 1: - insightClass = "insight__small--image"; - break; - case 2: - insightClass = "insight__small--text"; - break; - default: - break; - - } - index++; - -
- @if (typeIndex == 0) + var typeIndex = index % 3; + var insightClass = "insight__large"; + switch (typeIndex) { -
- @if (!ContentReference.IsNullOrEmpty(blog.CurrentContent.PageImage)) - { - - } -
- } - @if (typeIndex == 1) - { -
- @if (!ContentReference.IsNullOrEmpty(blog.CurrentContent.PageImage)) - { - - } -
+ case 1: + insightClass = "insight__small--image"; + break; + case 2: + insightClass = "insight__small--text"; + break; + default: + break; + } -
-
- @foreach (var tag in blog.Tags) - { - #@tag.Title - } -
- -

@blog.CurrentContent.MetaTitle

-
-
- @blog.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy") + index++; + +
+ @if (typeIndex == 0) + { +
+ @if (!ContentReference.IsNullOrEmpty(blog.CurrentContent.PageImage)) + { + + } +
+ } + @if (typeIndex == 1) + { +
+ @if (!ContentReference.IsNullOrEmpty(blog.CurrentContent.PageImage)) + { + + } +
+ } +
+
+ @foreach (var tag in blog.Tags) + { + #@tag.Title + } +
+ +

@blog.CurrentContent.MetaTitle

+
+
+ @blog.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy") +
+
@Html.Raw(blog.PreviewText)
+ + Read more +
-
@Html.Raw(blog.PreviewText)
- - Read more -
-
- } -
-} - - -@if (insightReverseBlogs.Any()) -{ - var index = 0; -
- @foreach (var blog in insightReverseBlogs) - { - var typeIndex = index % 3; - var insightClass = "insight__large"; - switch (typeIndex) - { - case 1: - insightClass = "insight__small--image"; - break; - case 2: - insightClass = "insight__small--text"; - break; - default: - break; } - index++; +
+ } -
- @if (typeIndex == 0) - { -
- @if (!ContentReference.IsNullOrEmpty(blog.CurrentContent.PageImage)) - { - - } -
- } - @if (typeIndex == 1) + + @if (insightReverseBlogs.Any()) + { + var index = 0; +
+ @foreach (var blog in insightReverseBlogs) + { + var typeIndex = index % 3; + var insightClass = "insight__large"; + switch (typeIndex) { -
- @if (!ContentReference.IsNullOrEmpty(blog.CurrentContent.PageImage)) - { - - } -
+ case 1: + insightClass = "insight__small--image"; + break; + case 2: + insightClass = "insight__small--text"; + break; + default: + break; } -
-
- @foreach (var tag in blog.Tags) - { - #@tag.Title - } -
- -

@blog.CurrentContent.MetaTitle

-
-
- @blog.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy") + index++; + +
+ @if (typeIndex == 0) + { +
+ @if (!ContentReference.IsNullOrEmpty(blog.CurrentContent.PageImage)) + { + + } +
+ } + @if (typeIndex == 1) + { +
+ @if (!ContentReference.IsNullOrEmpty(blog.CurrentContent.PageImage)) + { + + } +
+ } +
+
+ @foreach (var tag in blog.Tags) + { + #@tag.Title + } +
+ +

@blog.CurrentContent.MetaTitle

+
+
+ @blog.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy") +
+
@Html.Raw(blog.PreviewText)
+ + Read more +
-
@Html.Raw(blog.PreviewText)
- - Read more -
-
- } -
-} \ No newline at end of file + } +
+ } +
diff --git a/src/Foundation/Features/Blog/BlogListPage/_NoImageTemplate.cshtml b/src/Foundation/Features/Blog/BlogListPage/_NoImageTemplate.cshtml new file mode 100644 index 000000000..ea0041af5 --- /dev/null +++ b/src/Foundation/Features/Blog/BlogListPage/_NoImageTemplate.cshtml @@ -0,0 +1,38 @@ +@using EPiServer.AddOns.Helpers +@using Foundation.Features.Blog.BlogItemPage +@using Foundation.Features.Shared.SelectionFactories +@using Foundation.Features.Blog.BlogListPage + +@model BlogListPageViewModel + +@if (Model.Blogs != null && Model.Blogs.Any()) +{ + foreach (var blog in Model.Blogs) + { + var imageCol = blog.PreviewOption == PreviewOptions.Full ? 12 : (blog.PreviewOption == PreviewOptions.Half ? 6 : 4); + +
+ + @foreach (var tag in blog.Tags) + { + + } + +

+ @blog.CurrentContent.MetaTitle +

+ @if (blog.ShowPublishDate) + { +

@blog.CurrentContent.StartPublish.Value.ToString("dd MMM yyyy")

+ } + @if (blog.ShowIntroduction) + { +
+

@Html.Raw(blog.PreviewText)

+ } +
+ + } +} + + diff --git a/src/Foundation/Features/Blog/BlogListPage/_Paging.cshtml b/src/Foundation/Features/Blog/BlogListPage/_Paging.cshtml index 303a63b7c..00bcb2df5 100644 --- a/src/Foundation/Features/Blog/BlogListPage/_Paging.cshtml +++ b/src/Foundation/Features/Blog/BlogListPage/_Paging.cshtml @@ -1,61 +1,87 @@ @using Foundation.Features.Blog.BlogListPage +@using Foundation.Features.Shared.SelectionFactories @model BlogListPageViewModel -
-
- - @Model.PagingInfo.TotalRecord @Html.TranslateFallback("/Blog/Items", "Items") - +@using (Html.BeginForm("BlogListBlock", "Test", FormMethod.Get, new { id = "jsGetBlogItemListPage" })) +{ + + + + +} + +@if (Model.CurrentContent.Template == TemplateSelections.Card || Model.CurrentContent.Template == TemplateSelections.Insight) +{ +
+
-
- @if (Model.PagingInfo.PageCount > 1) - { - - + } +
+
-
\ No newline at end of file +} + + diff --git a/src/Foundation/Foundation.csproj b/src/Foundation/Foundation.csproj index cc008935c..6a7de5525 100644 --- a/src/Foundation/Foundation.csproj +++ b/src/Foundation/Foundation.csproj @@ -1734,7 +1734,6 @@ - @@ -2263,6 +2262,11 @@ + + + + + Designer