mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +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);
|
||||
|
||||
var versionOptions = VersionOptions.Latest;
|
||||
switch (model.Options.ContentsStatus)
|
||||
{
|
||||
switch (model.Options.ContentsStatus) {
|
||||
case ContentsStatus.Published:
|
||||
versionOptions = VersionOptions.Published;
|
||||
break;
|
||||
@@ -112,6 +111,10 @@ namespace Orchard.Core.Contents.Controllers {
|
||||
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.FilterOptions = GetListableTypes(false)
|
||||
.Select(ctd => new KeyValuePair<string, string>(ctd.Name, ctd.DisplayName))
|
||||
|
@@ -49,12 +49,12 @@ namespace Orchard.Core.Contents.ViewModels {
|
||||
Created
|
||||
}
|
||||
|
||||
public enum ContentsStatus
|
||||
{
|
||||
public enum ContentsStatus {
|
||||
Draft,
|
||||
Published,
|
||||
AllVersions,
|
||||
Latest
|
||||
Latest,
|
||||
Owner
|
||||
}
|
||||
|
||||
public enum ContentsBulkAction {
|
||||
|
@@ -54,6 +54,7 @@
|
||||
</select>
|
||||
<label for="contentResults" class="bulk-order">@T("Filter by")</label>
|
||||
<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.Published, T("published").ToString())
|
||||
@Html.SelectOption((ContentsStatus)Model.Options.ContentsStatus, ContentsStatus.Draft, T("unpublished").ToString())
|
||||
|
Reference in New Issue
Block a user