fix: relocate AD Compare panel under user assignment on device 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
the user assignment .status div (#Device_Show_User) on the device page.
This commit is contained in:
2026-04-29 10:31:39 +10:00
parent 0057523323
commit ea1b3d5942
+16 -1
View File
@@ -24,6 +24,9 @@ namespace Disco.Plugins.ADCompare.Features
return Nothing();
var html = new StringBuilder();
// Wrapper div with unique ID for relocation
html.Append("<div id='adcompare-device-panel'>");
html.Append("<div class='form-group' style='margin-top:15px;'>");
html.Append("<h4 style='border-bottom:1px solid #ddd;padding-bottom:5px;'>");
html.Append("<i class='fa fa-exchange'></i> AD Compare</h4>");
@@ -152,7 +155,19 @@ namespace Disco.Plugins.ADCompare.Features
html.Append("</div>");
}
html.Append("</div>");
html.Append("</div>"); // form-group
html.Append("</div>"); // wrapper
// Script to relocate panel under the user assignment section
html.Append("<script type='text/javascript'>");
html.Append("$(function(){");
html.Append("var p=$('#adcompare-device-panel');");
html.Append("var t=$('#Device_Show_User').closest('.status');");
html.Append("if(t.length){p.insertAfter(t);}");
html.Append("else{p.prependTo('#Device_Show_Details > div:first');}");
html.Append("});");
html.Append("</script>");
return Literal(html.ToString());
}