[Solved] Rendering a BlockList with an additional class
c
Umb V10.6.1 I need a particular BlockList to render with an extra class on the automatically rendered div. Is there a way to do this? AIUI the Settings Model will only affect the individual list Item and not the outer div. Basically I want to set it as 'display: flex' and a few other atribs in addition to 'umb-block-list'. There doesn't seem to be a blocklist css file like there is for the block grid. Thanks.
j
Hi @Craig100 what do you mean by this?
What do you want to achieve maybe there is a different or better solution? Sounds a bit strange 😛
c
I want these to be in a row, not a column and I want them to wrap if there are more. They're from a BlockList that used to be Nested Content
d
Hey Craig, you could add a conditional in the Block List code:
Copy code
<div class="umb-block-list">
    @foreach (var block in Model)
    {
        if (block?.ContentUdi == null) { continue; }
        var data = block.Content;

        @await Html.PartialAsync("blocklist/Components/" + data.ContentType.Alias, block)
    }
</div>
e.g. add display:flex; then a variable for flex-direction: row or column as required
c
Thanks for that. I changed something else, entirely unrelated (or so I thought), and it's suddenly in a row. But I'll remember your's for next time. 🙂
5 Views