mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-15 11:44:58 +08:00
Adding filter for own content
This commit is contained in:
@@ -65,8 +65,7 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
|
Pager pager = new Pager(_siteService.GetSiteSettings(), pagerParameters);
|
||||||
|
|
||||||
var versionOptions = VersionOptions.Latest;
|
var versionOptions = VersionOptions.Latest;
|
||||||
switch (model.Options.ContentsStatus)
|
switch (model.Options.ContentsStatus) {
|
||||||
{
|
|
||||||
case ContentsStatus.Published:
|
case ContentsStatus.Published:
|
||||||
versionOptions = VersionOptions.Published;
|
versionOptions = VersionOptions.Published;
|
||||||
break;
|
break;
|
||||||
@@ -112,6 +111,10 @@ namespace Orchard.Core.Contents.Controllers {
|
|||||||
query = _cultureFilter.FilterCulture(query, model.Options.SelectedCulture);
|
query = _cultureFilter.FilterCulture(query, model.Options.SelectedCulture);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if(model.Options.ContentsStatus == ContentsStatus.Owner) {
|
||||||
|
query = query.Where<CommonPartRecord>(cr => cr.OwnerId == Services.WorkContext.CurrentUser.Id);
|
||||||
|
}
|
||||||
|
|
||||||
model.Options.SelectedFilter = model.TypeName;
|
model.Options.SelectedFilter = model.TypeName;
|
||||||
model.Options.FilterOptions = GetListableTypes(false)
|
model.Options.FilterOptions = GetListableTypes(false)
|
||||||
.Select(ctd => new KeyValuePair<string, string>(ctd.Name, ctd.DisplayName))
|
.Select(ctd => new KeyValuePair<string, string>(ctd.Name, ctd.DisplayName))
|
||||||
|
@@ -49,12 +49,12 @@ namespace Orchard.Core.Contents.ViewModels {
|
|||||||
Created
|
Created
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ContentsStatus
|
public enum ContentsStatus {
|
||||||
{
|
|
||||||
Draft,
|
Draft,
|
||||||
Published,
|
Published,
|
||||||
AllVersions,
|
AllVersions,
|
||||||
Latest
|
Latest,
|
||||||
|
Owner
|
||||||
}
|
}
|
||||||
|
|
||||||
public enum ContentsBulkAction {
|
public enum ContentsBulkAction {
|
||||||
|
@@ -54,6 +54,7 @@
|
|||||||
</select>
|
</select>
|
||||||
<label for="contentResults" class="bulk-order">@T("Filter by")</label>
|
<label for="contentResults" class="bulk-order">@T("Filter by")</label>
|
||||||
<select id="contentResults" name="Options.ContentsStatus">
|
<select id="contentResults" name="Options.ContentsStatus">
|
||||||
|
@Html.SelectOption((ContentsStatus)Model.Options.ContentsStatus, ContentsStatus.Owner, T("owned by me").ToString())
|
||||||
@Html.SelectOption((ContentsStatus)Model.Options.ContentsStatus, ContentsStatus.Latest, T("latest").ToString())
|
@Html.SelectOption((ContentsStatus)Model.Options.ContentsStatus, ContentsStatus.Latest, T("latest").ToString())
|
||||||
@Html.SelectOption((ContentsStatus)Model.Options.ContentsStatus, ContentsStatus.Published, T("published").ToString())
|
@Html.SelectOption((ContentsStatus)Model.Options.ContentsStatus, ContentsStatus.Published, T("published").ToString())
|
||||||
@Html.SelectOption((ContentsStatus)Model.Options.ContentsStatus, ContentsStatus.Draft, T("unpublished").ToString())
|
@Html.SelectOption((ContentsStatus)Model.Options.ContentsStatus, ContentsStatus.Draft, T("unpublished").ToString())
|
||||||
|
Reference in New Issue
Block a user