diff --git a/SharedLibraryCore/Interfaces/IClientMeta.cs b/SharedLibraryCore/Interfaces/IClientMeta.cs index 1b3ed0a41..479ba70ae 100644 --- a/SharedLibraryCore/Interfaces/IClientMeta.cs +++ b/SharedLibraryCore/Interfaces/IClientMeta.cs @@ -20,6 +20,7 @@ namespace SharedLibraryCore.Interfaces public enum MetaType { + All = -1, Other, Information, AliasUpdate, diff --git a/WebfrontCore/ViewComponents/ProfileMetaListViewComponent.cs b/WebfrontCore/ViewComponents/ProfileMetaListViewComponent.cs index db7fc7c7d..5314960bd 100644 --- a/WebfrontCore/ViewComponents/ProfileMetaListViewComponent.cs +++ b/WebfrontCore/ViewComponents/ProfileMetaListViewComponent.cs @@ -38,11 +38,12 @@ namespace WebfrontCore.ViewComponents return View("_List", meta); } - public static async Task> GetClientMeta(IMetaService metaService, MetaType? metaType, EFClient.Permission level, ClientPaginationRequest request) + public static async Task> GetClientMeta(IMetaService metaService, MetaType? metaType, + EFClient.Permission level, ClientPaginationRequest request) { IEnumerable meta = null; - if (metaType == null) // all types + if (metaType is null or MetaType.All) { meta = await metaService.GetRuntimeMeta(request); } diff --git a/WebfrontCore/Views/Client/Profile/Index.cshtml b/WebfrontCore/Views/Client/Profile/Index.cshtml index 7721ae408..90397bd96 100644 --- a/WebfrontCore/Views/Client/Profile/Index.cshtml +++ b/WebfrontCore/Views/Client/Profile/Index.cshtml @@ -146,23 +146,23 @@ -
-
-
- +
+
+
- - @ViewBag.Localization["META_TYPE_ALL_NAME"] - - @{ var metaTypes = Enum.GetValues(typeof(MetaType)) + @{ + const int defaultTabCount = 5; + var metaTypes = Enum.GetValues(typeof(MetaType)) .Cast() .Where(type => !ignoredMetaTypes.Contains(type)) - .ToList(); } - @foreach (var type in metaTypes.Take(4)) + .OrderByDescending(type => type == MetaType.All) + .ToList(); + var selectedMeta = metaTypes.FirstOrDefault(meta => metaTypes.IndexOf(Model.MetaFilterType ?? MetaType.All) >= defaultTabCount && meta != MetaType.All && meta == Model.MetaFilterType); + } + @foreach (var type in metaTypes.Take(defaultTabCount - 1).Append(selectedMeta == MetaType.Other ? metaTypes[defaultTabCount - 1] : selectedMeta)) { } - ... -
- @foreach (var type in metaTypes.Skip(4)) +
+ @foreach (var type in (selectedMeta == MetaType.Other ? metaTypes.Skip(defaultTabCount) : metaTypes.Skip(defaultTabCount).Append(metaTypes[defaultTabCount - 1])).Where(meta => selectedMeta == MetaType.Other || meta != selectedMeta)) {