mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2026-02-09 09:16:41 +08:00
Added a part setting for TermPart so the page size can be adjusted.
This commit is contained in:
@@ -59,6 +59,10 @@ namespace Orchard.Taxonomies.Drivers {
|
||||
var totalItemCount = _taxonomyService.GetContentItemsCount(part);
|
||||
|
||||
var partSettings = part.Settings.GetModel<TermPartSettings>();
|
||||
if (partSettings != null && partSettings.OverrideDefaultPagination) {
|
||||
pager.PageSize = partSettings.PageSize;
|
||||
}
|
||||
|
||||
var childDisplayType = partSettings != null &&
|
||||
!String.IsNullOrWhiteSpace(partSettings.ChildDisplayType)
|
||||
? partSettings.ChildDisplayType
|
||||
@@ -72,7 +76,9 @@ namespace Orchard.Taxonomies.Drivers {
|
||||
|
||||
list.AddRange(termContentItems);
|
||||
|
||||
var pagerShape = shapeHelper.Pager(pager)
|
||||
var pagerShape = pager.PageSize == 0
|
||||
? null
|
||||
: shapeHelper.Pager(pager)
|
||||
.TotalItemCount(totalItemCount)
|
||||
.Taxonomy(taxonomy)
|
||||
.Term(part);
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using Orchard.ContentManagement;
|
||||
using Orchard.ContentManagement.MetaData;
|
||||
using Orchard.ContentManagement.MetaData.Builders;
|
||||
@@ -23,7 +24,9 @@ namespace Orchard.Taxonomies.Settings {
|
||||
|
||||
if (updateModel.TryUpdateModel(model, "TermPartSettings", null, null)) {
|
||||
builder
|
||||
.WithSetting("TermPartSettings.ChildDisplayType", model.ChildDisplayType);
|
||||
.WithSetting("TermPartSettings.ChildDisplayType", model.ChildDisplayType)
|
||||
.WithSetting("TermPartSettings.OverrideDefaultPagination", model.OverrideDefaultPagination.ToString())
|
||||
.WithSetting("TermPartSettings.PageSize", model.PageSize.ToString(CultureInfo.InvariantCulture));
|
||||
}
|
||||
|
||||
yield return DefinitionTemplate(model);
|
||||
|
||||
@@ -4,5 +4,15 @@
|
||||
/// The display type to use for the child items of the term.
|
||||
/// </summary>
|
||||
public string ChildDisplayType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// If true, overrides default pagination settings with the PageSize value.
|
||||
/// </summary>
|
||||
public bool OverrideDefaultPagination { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The page size, if OverrideDefaultPagination is set to true.
|
||||
/// </summary>
|
||||
public int PageSize { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -4,4 +4,16 @@
|
||||
@Html.TextBoxFor(m => m.ChildDisplayType, new { @class = "text medium" })
|
||||
<span class="hint">@T("The display type to apply to child items when displaying the details of this taxonomy term.")</span>
|
||||
@Html.ValidationMessageFor(m => m.ChildDisplayType)
|
||||
</fieldset>
|
||||
</fieldset>
|
||||
<fieldset>
|
||||
<label>@T("Pagination")</label>
|
||||
<div class="content">
|
||||
@Html.CheckBoxFor(m => m.OverrideDefaultPagination)
|
||||
<label class="forcheckbox" for="@Html.FieldIdFor(m => m.OverrideDefaultPagination)">@T("Override the default page size")</label>
|
||||
</div>
|
||||
<div data-controllerid="@Html.FieldIdFor(m => m.OverrideDefaultPagination)">
|
||||
<label for="@Html.FieldIdFor(m => m.PageSize)">@T("Number of items per page")</label>
|
||||
@Html.TextBoxFor(m => m.PageSize, new { @class = "text small" })
|
||||
<span class="hint">@T("Determines the number of items that are shown per page.")</span>
|
||||
</div>
|
||||
</fieldset>
|
||||
|
||||
Reference in New Issue
Block a user