@model bool

@{
    var pages = (IEnumerable<ControlPage>)ViewBag.Pages;
    var sufUrl = Model ? "" : "?collapsed=true";
    var currentPageIndex = (int)ViewBag.CurrentPageIndex;
    var index = 0;
}
<ul class="page-nav">
    @foreach (var controlPage in pages)
    {
        var selected = index++ == currentPageIndex;
        var selectedCSS = selected ? " nav-selected" : "";
        selectedCSS = "nav-item" + selectedCSS;
        var attrHref = !selected ? "href=" + controlPage.Path + sufUrl : "";

        <li class="@selectedCSS">
            <a @attrHref>
                <img src="@Url.Content(controlPage.Icon)" />
                @if (Model)
                {
                    <span style="padding-left:10px;">@controlPage.Text</span>
                }
            </a>
        </li>
    }
</ul>
