fix: relocate AD Details panel under device assignment on user page

UIExtension content renders at the bottom of _Layout.cshtml by design.
Added wrapper div with ID and jQuery script to move the panel after
#User_Show_AssignedDevices on the user page, falling back to after
#User_Show_Subjects if the assignment section isn't present.
This commit is contained in:
2026-04-29 14:24:55 +10:00
parent ea1b3d5942
commit 2da2b257a5
+16 -1
View File
@@ -24,6 +24,9 @@ namespace Disco.Plugins.ADCompare.Features
return Nothing(); return Nothing();
var html = new StringBuilder(); var html = new StringBuilder();
// Wrapper div with unique ID for relocation
html.Append("<div id='adcompare-user-panel'>");
html.Append("<div class='form-group' style='margin-top:15px;'>"); html.Append("<div class='form-group' style='margin-top:15px;'>");
html.Append("<h4 style='border-bottom:1px solid #ddd;padding-bottom:5px;'>"); html.Append("<h4 style='border-bottom:1px solid #ddd;padding-bottom:5px;'>");
html.Append("<i class='fa fa-exchange'></i> AD Details</h4>"); html.Append("<i class='fa fa-exchange'></i> AD Details</h4>");
@@ -104,7 +107,19 @@ namespace Disco.Plugins.ADCompare.Features
html.Append("</div>"); html.Append("</div>");
} }
html.Append("</div>"); html.Append("</div>"); // form-group
html.Append("</div>"); // wrapper
// Script to relocate panel under the device assignment section
html.Append("<script type='text/javascript'>");
html.Append("$(function(){");
html.Append("var p=$('#adcompare-user-panel');");
html.Append("var t=$('#User_Show_AssignedDevices');");
html.Append("if(t.length){p.insertAfter(t);}");
html.Append("else{var s=$('#User_Show_Subjects');if(s.length){p.insertAfter(s);}}");
html.Append("});");
html.Append("</script>");
return Literal(html.ToString()); return Literal(html.ToString());
} }