-
Notifications
You must be signed in to change notification settings - Fork 33
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
SFBuild
committed
Oct 28, 2022
1 parent
1092547
commit 6695250
Showing
33 changed files
with
586 additions
and
264 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
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,73 @@ | ||
@model Telerik.Sitefinity.Frontend.Search.Mvc.Models.FacetsWidgetViewModel | ||
@using System; | ||
@using System.Globalization; | ||
@using Telerik.Sitefinity; | ||
@using Telerik.Sitefinity.Frontend.Mvc.Helpers; | ||
@using Telerik.Sitefinity.Publishing.PublishingPoints; | ||
|
||
@{ | ||
const int defaultFacetsCollapseCount = 10; | ||
} | ||
|
||
<div id="facetContainer"> | ||
@if (ViewBag.HasAnyFacetElements) | ||
{ | ||
<h3 class="h6 mb-3 font-weight-normal">@Model.FilterResultsLabel</h3> | ||
|
||
<div class="d-flex align-items-center justify-content-between"> | ||
<label class="form-label">@Model.AppliedFiltersLabel</label> | ||
<button id="sf-facet-clear-all-btn" class="btn btn-link px-0 py-0 mb-2" hidden>@Model.ClearAllLabel</button> | ||
</div> | ||
<ul id="applied-filters" class="list-unstyled list-inline" data-sf-applied-filter-html-tag="li" data-sf-filter-label-css-class="sf-facets-filter-label list-inline-item bg-secondary rounded-pill pl-2 pr-4 pb-1 mr-1 mb-1 mw-100 position-relative overflow-hidden text-truncate text-nowrap" data-sf-remove-filter-css-class="sf-facets-remove-filter px-2 position-absolute"> | ||
</ul> | ||
} | ||
|
||
<div id="facetContent" class="mb-3"> | ||
@foreach (var facet in Model.SearchFacets) | ||
{ | ||
var value = 0; | ||
if (facet.FacetElements.Any()) | ||
{ | ||
<h4 class="h6 font-weight-normal mt-3">@facet.FacetTitle</h4> | ||
|
||
<ul class="list-unstyled mb-0" id="[email protected]"> | ||
@foreach (var facetElement in facet.FacetElements) | ||
{ | ||
string facetElementLabel = facetElement.FacetValue; | ||
|
||
if (facetElement.FacetFieldType == SearchIndexAdditonalFieldType.DateAndTime) | ||
{ | ||
DateTime facetDateValue = DateTime.Parse(facetElementLabel); | ||
facetElementLabel = facetDateValue.ToSitefinityUITime().ToString("MMM dd, yyyy"); | ||
} | ||
|
||
value++; | ||
bool hideElement = (value > defaultFacetsCollapseCount) && Model.IsShowMoreLessButtonActive; | ||
<li class="form-check" @(hideElement ? "hidden" : string.Empty)> | ||
<input type="checkbox" | ||
id="[email protected]@facetElement.FacetValue" | ||
class="form-check-input" | ||
data-facet-key="@facet.FacetFieldName" | ||
data-facet-value="@facetElement.FacetValue" /> | ||
<label for="[email protected]@facetElement.FacetValue" id="[email protected]" class="form-check-label">@facetElementLabel</label> | ||
@if (Model.DisplayItemCount) | ||
{ | ||
<span class="small text-muted">(@facetElement.FacetCount)</span> | ||
} | ||
</li> | ||
} | ||
</ul> | ||
if (facet.FacetElements.Count > defaultFacetsCollapseCount && Model.IsShowMoreLessButtonActive) | ||
{ | ||
<button type="button" class="btn btn-link p-0" show-more="@Model.ShowMoreLabel" show-less="@Model.ShowLessLabel" data-facet-type="@facet.FacetFieldName" id="[email protected]">@Model.ShowMoreLabel</button> | ||
} | ||
} | ||
} | ||
</div> | ||
|
||
</div> | ||
|
||
<input type="hidden" id="sf-currentPageUrl" value="@(ViewBag.CurrentPageUrl ?? string.Empty)" /> | ||
|
||
@Html.Script(Url.WidgetContent("Mvc/Scripts/Facets/query-string-utils.js"), "bottom", throwException: false) | ||
@Html.Script(Url.WidgetContent("Mvc/Scripts/Facets/facets-widget.js"), "bottom", throwException: false) |
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
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
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
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
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
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
Oops, something went wrong.