From e55f41a4eedd2c799741eafd96649cfd41c074cf Mon Sep 17 00:00:00 2001 From: Masterjun3 Date: Sat, 26 Aug 2023 18:21:46 +0200 Subject: [PATCH 1/2] add a select-improver tag helper --- .../TagHelpers/SelectImproverTagHelper.cs | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 TASVideos/TagHelpers/SelectImproverTagHelper.cs diff --git a/TASVideos/TagHelpers/SelectImproverTagHelper.cs b/TASVideos/TagHelpers/SelectImproverTagHelper.cs new file mode 100644 index 000000000..c13e26308 --- /dev/null +++ b/TASVideos/TagHelpers/SelectImproverTagHelper.cs @@ -0,0 +1,108 @@ +using Microsoft.AspNetCore.Razor.TagHelpers; + +namespace TASVideos.TagHelpers; + +public class SelectImproverTagHelper : TagHelper +{ + public string SelectId { get; set; } = ""; + public string ListHeight { get; set; } = "250px"; + public override void Process(TagHelperContext context, TagHelperOutput output) + { + output.TagName = "div"; + output.Content.SetHtmlContent(@$" +
+
+ No selection +
+ +
+
+ +"); + } +} From cd52a7119e6584092d242fb83e1e577d49e83a67 Mon Sep 17 00:00:00 2001 From: adelikat Date: Sat, 26 Aug 2023 11:38:56 -0500 Subject: [PATCH 2/2] wire up multiselect to user edit --- TASVideos/Pages/Users/Edit.cshtml | 6 +++++- TASVideos/Pages/Users/Edit.cshtml.cs | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/TASVideos/Pages/Users/Edit.cshtml b/TASVideos/Pages/Users/Edit.cshtml index 4d1fdfbb4..c67ef7769 100644 --- a/TASVideos/Pages/Users/Edit.cshtml +++ b/TASVideos/Pages/Users/Edit.cshtml @@ -185,7 +185,11 @@ - +
+ + +
+ @* *@ @await Component.RenderWiki(SystemWiki.UserEditRole)
diff --git a/TASVideos/Pages/Users/Edit.cshtml.cs b/TASVideos/Pages/Users/Edit.cshtml.cs index f2baee29e..19008c482 100644 --- a/TASVideos/Pages/Users/Edit.cshtml.cs +++ b/TASVideos/Pages/Users/Edit.cshtml.cs @@ -219,6 +219,7 @@ private async Task> GetAllRolesUserCanAssign(int use && assignedRoleList.Any() // EF Core 2.1 issue, needs this or a user with no assigned roles blows up && assignedRoleList.Contains(r.Id) }) + .OrderBy(s => s.Text) .ToListAsync(); }