add help page to layout

This commit is contained in:
RaidMax
2019-12-28 20:44:39 -06:00
parent 32e1af0ffb
commit 344c3613b8
5 changed files with 116 additions and 20 deletions

View File

@ -48,5 +48,24 @@ namespace WebfrontCore.Controllers
{
return View(statusCode);
}
public IActionResult Help()
{
ViewBag.IsFluid = true;
var excludedAssembly = typeof(BaseController).Assembly;
var commands = Manager.GetCommands()
.OrderByDescending(_cmd => _cmd.Permission)
.GroupBy(_cmd =>
{
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;
})
.Select(_grp => (_grp.Key, _grp.AsEnumerable()));
return View(commands);
}
}
}