-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
464 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by a tool. | ||
// | ||
// Umbraco.ModelsBuilder.Embedded v12.0.1+20a4e47 | ||
// | ||
// Changes to this file will be lost if the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
using System; | ||
using System.Linq.Expressions; | ||
using Umbraco.Cms.Core.Models.PublishedContent; | ||
using Umbraco.Cms.Core.PublishedCache; | ||
using Umbraco.Cms.Infrastructure.ModelsBuilder; | ||
using Umbraco.Cms.Core; | ||
using Umbraco.Extensions; | ||
|
||
namespace Wmca.Models.Content | ||
{ | ||
/// <summary>App</summary> | ||
[PublishedModel("appGridBlock")] | ||
public partial class AppGridBlock : PublishedElementModel | ||
{ | ||
// helpers | ||
#pragma warning disable 0109 // new is redundant | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
public new const string ModelTypeAlias = "appGridBlock"; | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
public new const PublishedItemType ModelItemType = PublishedItemType.Content; | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[return: global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
public new static IPublishedContentType GetModelContentType(IPublishedSnapshotAccessor publishedSnapshotAccessor) | ||
=> PublishedModelUtility.GetModelContentType(publishedSnapshotAccessor, ModelItemType, ModelTypeAlias); | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[return: global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
public static IPublishedPropertyType GetModelPropertyType<TValue>(IPublishedSnapshotAccessor publishedSnapshotAccessor, Expression<Func<AppGridBlock, TValue>> selector) | ||
=> PublishedModelUtility.GetModelPropertyType(GetModelContentType(publishedSnapshotAccessor), selector); | ||
#pragma warning restore 0109 | ||
|
||
private IPublishedValueFallback _publishedValueFallback; | ||
|
||
// ctor | ||
public AppGridBlock(IPublishedElement content, IPublishedValueFallback publishedValueFallback) | ||
: base(content, publishedValueFallback) | ||
{ | ||
_publishedValueFallback = publishedValueFallback; | ||
} | ||
|
||
// properties | ||
|
||
///<summary> | ||
/// Body scripts: Add your app root div | ||
///</summary> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
[ImplementPropertyType("bodyScripts")] | ||
public virtual global::Umbraco.Cms.Core.Strings.IHtmlEncodedString BodyScripts => this.Value<global::Umbraco.Cms.Core.Strings.IHtmlEncodedString>(_publishedValueFallback, "bodyScripts"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,111 @@ | ||
//------------------------------------------------------------------------------ | ||
// <auto-generated> | ||
// This code was generated by a tool. | ||
// | ||
// Umbraco.ModelsBuilder.Embedded v12.0.1+20a4e47 | ||
// | ||
// Changes to this file will be lost if the code is regenerated. | ||
// </auto-generated> | ||
//------------------------------------------------------------------------------ | ||
|
||
using System; | ||
using System.Linq.Expressions; | ||
using Umbraco.Cms.Core.Models.PublishedContent; | ||
using Umbraco.Cms.Core.PublishedCache; | ||
using Umbraco.Cms.Infrastructure.ModelsBuilder; | ||
using Umbraco.Cms.Core; | ||
using Umbraco.Extensions; | ||
|
||
namespace Wmca.Models.Content | ||
{ | ||
// Mixin Content Type with alias "pageProperties" | ||
/// <summary>Page properties</summary> | ||
public partial interface IPageProperties : IPublishedElement | ||
{ | ||
/// <summary>Custom code - Body</summary> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
string CustomCodeBody { get; } | ||
|
||
/// <summary>Custom code - Head</summary> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
string CustomCodeHead { get; } | ||
|
||
/// <summary>Image</summary> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
global::Umbraco.Cms.Core.Models.MediaWithCrops Image { get; } | ||
} | ||
|
||
/// <summary>Page properties</summary> | ||
[PublishedModel("pageProperties")] | ||
public partial class PageProperties : PublishedElementModel, IPageProperties | ||
{ | ||
// helpers | ||
#pragma warning disable 0109 // new is redundant | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
public new const string ModelTypeAlias = "pageProperties"; | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
public new const PublishedItemType ModelItemType = PublishedItemType.Content; | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[return: global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
public new static IPublishedContentType GetModelContentType(IPublishedSnapshotAccessor publishedSnapshotAccessor) | ||
=> PublishedModelUtility.GetModelContentType(publishedSnapshotAccessor, ModelItemType, ModelTypeAlias); | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[return: global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
public static IPublishedPropertyType GetModelPropertyType<TValue>(IPublishedSnapshotAccessor publishedSnapshotAccessor, Expression<Func<PageProperties, TValue>> selector) | ||
=> PublishedModelUtility.GetModelPropertyType(GetModelContentType(publishedSnapshotAccessor), selector); | ||
#pragma warning restore 0109 | ||
|
||
private IPublishedValueFallback _publishedValueFallback; | ||
|
||
// ctor | ||
public PageProperties(IPublishedElement content, IPublishedValueFallback publishedValueFallback) | ||
: base(content, publishedValueFallback) | ||
{ | ||
_publishedValueFallback = publishedValueFallback; | ||
} | ||
|
||
// properties | ||
|
||
///<summary> | ||
/// Custom code - Body: Custom tracking code placed within the body | ||
///</summary> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
[ImplementPropertyType("customCodeBody")] | ||
public virtual string CustomCodeBody => GetCustomCodeBody(this, _publishedValueFallback); | ||
|
||
/// <summary>Static getter for Custom code - Body</summary> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[return: global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
public static string GetCustomCodeBody(IPageProperties that, IPublishedValueFallback publishedValueFallback) => that.Value<string>(publishedValueFallback, "customCodeBody"); | ||
|
||
///<summary> | ||
/// Custom code - Head: Custom code placed within the head | ||
///</summary> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
[ImplementPropertyType("customCodeHead")] | ||
public virtual string CustomCodeHead => GetCustomCodeHead(this, _publishedValueFallback); | ||
|
||
/// <summary>Static getter for Custom code - Head</summary> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[return: global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
public static string GetCustomCodeHead(IPageProperties that, IPublishedValueFallback publishedValueFallback) => that.Value<string>(publishedValueFallback, "customCodeHead"); | ||
|
||
///<summary> | ||
/// Image: Default image for this page. Will be used for internal page linking and social media sharing | ||
///</summary> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
[ImplementPropertyType("image")] | ||
public virtual global::Umbraco.Cms.Core.Models.MediaWithCrops Image => GetImage(this, _publishedValueFallback); | ||
|
||
/// <summary>Static getter for Image</summary> | ||
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("Umbraco.ModelsBuilder.Embedded", "12.0.1+20a4e47")] | ||
[return: global::System.Diagnostics.CodeAnalysis.MaybeNull] | ||
public static global::Umbraco.Cms.Core.Models.MediaWithCrops GetImage(IPageProperties that, IPublishedValueFallback publishedValueFallback) => that.Value<global::Umbraco.Cms.Core.Models.MediaWithCrops>(publishedValueFallback, "image"); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
@model SiftLibrary.Models.SearchResultNodes | ||
@{ | ||
int numButtons = 7; | ||
int numMiddleButtons = numButtons - 2; | ||
|
||
|
||
int firstMiddlePage = Model.Criteria.PageNumber - (numMiddleButtons / 2); | ||
if (firstMiddlePage < 0) | ||
{ | ||
firstMiddlePage = 0; | ||
} | ||
|
||
int lastMiddlePage = firstMiddlePage + numMiddleButtons; | ||
if (lastMiddlePage > Model.NumberOfPages) | ||
{ | ||
lastMiddlePage = Model.NumberOfPages; | ||
firstMiddlePage = lastMiddlePage - numMiddleButtons; | ||
if (firstMiddlePage < 0) | ||
{ | ||
firstMiddlePage = 0; | ||
} | ||
} | ||
|
||
if (Model.NumberOfPages <= numButtons) | ||
{ | ||
numMiddleButtons = Model.NumberOfPages; | ||
} | ||
} | ||
|
||
@if (firstMiddlePage > 0) | ||
{ | ||
<a id="search-button-page-first" href="#" | ||
class="sift-search btn btn-gray" | ||
data-sift-results-page-number="0"> | ||
1 | ||
</a> | ||
|
||
if (firstMiddlePage > 1) | ||
{ | ||
<span>...</span> | ||
} | ||
} | ||
|
||
@for (int i = firstMiddlePage; i < lastMiddlePage; i++) | ||
{ | ||
var colour = "btn-gray"; | ||
if (i == Model.Criteria.PageNumber) | ||
{ | ||
colour = "btn-blue"; | ||
} | ||
<a id="search-button-page-@i" href="#" | ||
class="sift-search btn @colour" | ||
data-sift-results-page-number="@i"> | ||
@(i + 1) | ||
</a> | ||
} | ||
|
||
@if (lastMiddlePage < Model.NumberOfPages) | ||
{ | ||
if (lastMiddlePage < (Model.NumberOfPages - 1)) | ||
{ | ||
<span>...</span> | ||
} | ||
|
||
<a id="search-button-page-last" href="#" | ||
class="sift-search btn btn-gray" | ||
data-sift-results-page-number="@(Model.NumberOfPages - 1)"> | ||
@Model.NumberOfPages | ||
</a> | ||
} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
@model SiftLibrary.Models.SearchResultNodes | ||
@using Umbraco.Cms.Core.Models.PublishedContent | ||
@* | ||
This partial view provides the default search results for Sift. I recommend that you don't update it directly. | ||
It's best to provide your own partial view and specify it using the "data-sift-result-partial" attribute on the main div. | ||
*@ | ||
|
||
<p> | ||
Number of results: @Model.NumberOfResults<br /> | ||
Page number: @(Model.Criteria.PageNumber + 1)<br /> | ||
Number of pages: @Model.NumberOfPages | ||
</p> | ||
|
||
<ul> | ||
@foreach (var node in Model.Nodes) | ||
{ | ||
if (node.ItemType == PublishedItemType.Content) | ||
{ | ||
<li><a href="@node.Url(Model.Criteria.Culture)">@node.Name(Model.Criteria.Culture)</a></li> | ||
} | ||
else if (node.ItemType == PublishedItemType.Media) | ||
{ | ||
<li><a href="@node.MediaUrl(Model.Criteria.Culture)">@node.Name(Model.Criteria.Culture)</a></li> | ||
} | ||
} | ||
</ul> | ||
|
||
@if (Model.Criteria.ResultsPerPage > 0) | ||
{ | ||
@await Html.PartialAsync("_SiftDefaultPagination", Model) | ||
} | ||
|
10 changes: 10 additions & 0 deletions
10
Wmca.Web/Views/Partials/blockgrid/Components/appGridBlock.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
@using Umbraco.Extensions | ||
@inherits Umbraco.Cms.Web.Common.Views.UmbracoViewPage<Umbraco.Cms.Core.Models.Blocks.BlockGridItem> | ||
|
||
|
||
|
||
@Model.Content.Value("headScripts") | ||
|
||
|
||
@Model.Content.Value("bodyScripts") | ||
|
100 changes: 100 additions & 0 deletions
100
Wmca.Web/Views/Partials/frontend/components/search/searchPagination.cshtml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
<style> | ||
.ds-pagination__item--active:first-child {margin-left: 0!important} | ||
.ds-pagination__item--active:last-child {margin-right: 0!important} | ||
</style> | ||
|
||
@model SiftLibrary.Models.SearchResultNodes | ||
@{ | ||
int numButtons = 7; | ||
int numMiddleButtons = numButtons - 2; | ||
|
||
int current = Model.Criteria.PageNumber; | ||
|
||
int firstMiddlePage = Model.Criteria.PageNumber - (numMiddleButtons / 2); | ||
if (firstMiddlePage < 0) | ||
{ | ||
firstMiddlePage = 0; | ||
} | ||
|
||
int lastMiddlePage = firstMiddlePage + numMiddleButtons; | ||
if (lastMiddlePage > Model.NumberOfPages) | ||
{ | ||
lastMiddlePage = Model.NumberOfPages; | ||
firstMiddlePage = lastMiddlePage - numMiddleButtons; | ||
if (firstMiddlePage < 0) | ||
{ | ||
firstMiddlePage = 0; | ||
} | ||
} | ||
|
||
if (Model.NumberOfPages <= numButtons) | ||
{ | ||
numMiddleButtons = Model.NumberOfPages; | ||
} | ||
} | ||
|
||
@*<h3>@current</h3>*@ | ||
<div class="ds-pagination ds-m-t-lg"> | ||
<ol class="ds-pagination__nav"> | ||
@if (firstMiddlePage > 0) | ||
{ | ||
<li class="ds-pagination__item"> | ||
<a id="search-button-page-first" href="#" | ||
class="sift-search btn btn-gray ds-link" | ||
data-sift-results-page-number="0"> | ||
1 | ||
</a> | ||
</li> | ||
|
||
@*if (firstMiddlePage > 1) | ||
{ | ||
<span>...</span> | ||
}*@ | ||
} | ||
|
||
@for (int i = firstMiddlePage; i < lastMiddlePage; i++) | ||
{ | ||
var colour = "btn-gray"; | ||
if (i == Model.Criteria.PageNumber) | ||
{ | ||
colour = "btn-blue"; | ||
<li class="ds-pagination__item ds-pagination__item--active"> | ||
@(i + 1) | ||
</li> | ||
} | ||
else | ||
{ | ||
<li class="ds-pagination__item"> | ||
<a id="search-button-page-@i" href="#" | ||
class="sift-search btn ds-link @colour" | ||
data-sift-results-page-number="@i"> | ||
@(i + 1) | ||
</a> | ||
</li> | ||
} | ||
|
||
} | ||
|
||
@if (lastMiddlePage < Model.NumberOfPages) | ||
{ | ||
@*if (lastMiddlePage < (Model.NumberOfPages - 1)) | ||
{ | ||
<span>...</span> | ||
}*@ | ||
<li class="ds-pagination__item"> | ||
<a id="search-button-page-last" href="#" | ||
class="sift-search btn btn-gray ds-link" | ||
data-sift-results-page-number="@(Model.NumberOfPages - 1)"> | ||
@Model.NumberOfPages | ||
</a> | ||
</li> | ||
} | ||
</ol> | ||
<div class="ds-pagination__prev"></div> | ||
<div class="ds-pagination__next"></div> | ||
@*<a href="#" target="_self" class="ds-pagination__next ds-link ds-link--with-chevron"> | ||
Next page <svg class="ds-link__chevron ds-link__chevron--right"> | ||
<use href="#ds-general-chevron-right"></use> | ||
</svg> | ||
</a>*@ | ||
</div> |
Oops, something went wrong.