Files
BeWoPlaner/BeWoPlanerMobil/Views/Main/TextModulePartial.cshtml

45 lines
1.3 KiB
Plaintext
Raw Normal View History

@using BeWoPlanerMobil.Util
@model BeWoPlanerMobil.Models.MainModel
@helper BuildTextModuleTree(TextbausteinDisplayItem textModule)
{
if(textModule.IsParent)
{
<a href="#" class="list-group-item list-group-item-action mx-0 px-1" onclick="textCategoryOnClick('@textModule.Oid')">
<span id="@textModule.Oid-icon-span" class="fas fa-angle-up mr-1"></span>
@textModule.Name
</a>
<div id="@textModule.Oid-children-container" style="display: none;" class="list-group list-group-item mx-0 px-1">
@foreach(var childTextModule in textModule.Children)
{
@BuildTextModuleTree(childTextModule)
}
</div>
}
else
{
<a href="#" id="@textModule.Oid" class="list-group-item list-group-item-action mx-0 px-1" onclick="textModuleOnClick('@textModule.Oid')">
@textModule.Name
</a>
}
}
@if(Model?.TextModules?.Any() ?? false)
{
<script>
$("#textmodule-container").show();
</script>
<div class="list-group">
@foreach(var textModule in Model.TextModules)
{
@BuildTextModuleTree(textModule)
}
</div>
}
else
{
<script>
$("#textmodule-container").hide();
</script>
}