finish help layout and show only on permission level

This commit is contained in:
RaidMax 2019-12-29 11:32:36 -06:00
parent 344c3613b8
commit 902cd9953e
2 changed files with 10 additions and 7 deletions

View File

@ -52,16 +52,20 @@ namespace WebfrontCore.Controllers
public IActionResult Help()
{
ViewBag.IsFluid = true;
ViewBag.Title = Localization["WEBFRONT_NAV_HELP"];
// we don't need to the name of the shared library assembly
var excludedAssembly = typeof(BaseController).Assembly;
var commands = Manager.GetCommands()
.Where(_cmd => _cmd.Permission <= Client.Level)
.OrderByDescending(_cmd => _cmd.Permission)
.GroupBy(_cmd =>
{
// we need the plugin type the command is defined in
var pluginType = _cmd.GetType().Assembly.GetTypes().FirstOrDefault(_type => _type.Assembly != excludedAssembly && typeof(IPlugin).IsAssignableFrom(_type));
return pluginType == null ?
Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_HELP_COMMAND_NATIVE"] :
SharedLibraryCore.Plugins.PluginImporter.ActivePlugins.First(_plugin => _plugin.GetType() == pluginType).Name;
Utilities.CurrentLocalization.LocalizationIndex["WEBFRONT_HELP_COMMAND_NATIVE"] :
SharedLibraryCore.Plugins.PluginImporter.ActivePlugins.First(_plugin => _plugin.GetType() == pluginType).Name; // for now we're just returning the name of the plugin, maybe later we'll include more info
})
.Select(_grp => (_grp.Key, _grp.AsEnumerable()));

View File

@ -4,12 +4,12 @@
}
@foreach ((var pluginName, var commandList) in Model)
{
<h4 class="text-center">@pluginName</h4>
<h4 class="text-center pb-0 pb-xl-3 pt-3 pt-xl-0">@pluginName</h4>
<!-- desktop -->
<table class="table table-striped border-bottom col-12 ml-auto mr-auto d-none d-lg-table">
<table class="table table-striped border-bottom col-10 ml-auto mr-auto d-none d-lg-table mb-4 text-light">
<thead>
<tr class="bg-primary">
<tr class="bg-primary text-white">
<th scope="col">@loc["WEBFRONT_HELP_COMMAND_DESC_NAME"]</th>
<th scope="col">@loc["WEBFRONT_HELP_COMMAND_DESC_ALIAS"]</th>
<th scope="col">@loc["WEBFRONT_HELP_COMMAND_DESC_DESCRIPTION"]</th>
@ -72,4 +72,3 @@
</tbody>
</table>
}
}