@inherits UmbracoTemplatePage
@{
    Layout = "~/Views/Master.cshtml";
}

<div class="page-content">
    <div class="sidebar-area">
        <div class="sidebar-content">
            <div class="content-wrapper">
                <nav>
                    <ul class="level-1">
                        <li class="filter-orderBy">
                            <h3>Projects</h3>
                            <ul class="level-2">
                                <li><h4><a href="?orderBy=updateDate">Updated projects</a></h4></li>
                                <li><h4><a href="?orderBy=popularity">Popular projects</a></h4></li>
                            </ul>
                        </li>
                        <li class="filter-version">
                            <h3>By Version</h3>
                            <ul class="level-2">
                                <li><h4><a href="?version=7">Version 7</a></h4></li>
                                <li><h4><a href="?version=6">Version 6</a></h4></li>
                                <li><h4><a href="?version=4">Version 4</a></h4></li>
                            </ul>
                        </li>
                        <li class="filter-category">
                            <h3>By Category</h3>
                            @Html.Partial("~/Views/Partials/Projects/ListCategories.cshtml")
                        </li>
                    </ul>
                </nav>

            </div><!-- .content-wrapper -->
        </div><!-- .sidebar-content -->
    </div><!-- .sidebar-area -->

    <div class="main-area">
        <div class="main-content">
            <div class="content-wrapper">
                <div>
                    @Html.Action("Render", "Breadcrumb", new { linkToCurrent = true })
                </div>
                <div class="packages-content">
                    @Html.Partial("~/Views/Partials/Projects/ListProjects.cshtml")
                </div>

            </div><!-- .content-wrapper -->
        </div><!-- .main-content -->
    </div><!-- .main-area -->

</div><!-- .page-content -->

@section EndScripts
{
    <script type="text/javascript">
        function getUrlVars() {
            var vars = [], hash;
            var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
            for (var i = 0; i < hashes.length; i++) {
                hash = hashes[i].split('=');
                vars.push(hash[0]);
                vars[hash[0]] = hash[1];
            }
            return vars;
        }
        var query = getUrlVars();
        var filter = '.filter-' + query[0];
        $(filter).addClass('open');

        $('.level-1>li').on('click', function () {
            $('.level-1>li').removeClass('open');
            $(this).addClass('open');
        });
    </script>
}