@using OurUmbraco.Our
@model OurUmbraco.Our.Models.SearchResultContentModel

<div class="plain">
    <!-- search OVERVIEW START -->
    <section class="search-results">
        <div>
            <!-- FORUM HEADER START -->
            <div class="utilities">
                <ul id="breadcrumb">
                    <li><a href="/" rel="nofollow">Our Umbraco</a></li>
                    <li><a href="#" rel="nofollow">Search</a></li>
                    <li><a href="#" rel="nofollow">@Model.Results.SearchTerm</a></li>
                </ul>
            </div>

            @if (Context.IsDebuggingEnabled)
            {
                <div style="border: 1px solid orange;">
                    <p>
                        <strong>Debugging output</strong><br />
                        <strong>Query:</strong> @Model.Results.LuceneQuery<br />
                        <strong>Order by:</strong> @Model.Results.OrderBy<br />
                        <strong>Time elapsed:</strong> @Model.Results.Totalmilliseconds
                    </p>

                </div>
            }

            <div class="search-big">
                <asp:TextBox runat="server" ID="SearchText"></asp:TextBox>
                <label for="SearchText">Search</label>
            </div>
            
            @if(Request.QueryString["cat"] == "forum") {
                <div id="search-options" class="search-options">
                    <label>Sort by</label>
                    <div class="options">

                        <label class="checkbox">
                            <input type="checkbox" name="solved" />
                            <span></span>
                            <small>show only solved topics</small>
                        </label>

                        <label class="checkbox">
                            <input type="checkbox" name="replies" />
                            <span></span>
                            <small>show only topics with replies</small>
                        </label>

                        <label class="checkbox">
                            <input type="checkbox" name="order" value="updateDate" />
                            <span></span>
                            <small>show last updated first</small>
                        </label>

                    </div>
                </div>
            }

            @if(Model.Results.SearchResults.Any() == false) {
                <p class="message">No results</p>
            }

            <section>
                @if(string.IsNullOrWhiteSpace(Model.Results.Category) == false) {
                    <h2 class="search-in">Results from category: @Model.Results.Category</h2>
                }

                <ul class="search-all-results docs-search-listing">
                    @foreach(var result in Model.Results.SearchResults) { 
                        <li class="@result.SolvedClass()">
                            <a href="@result.FullUrl()">
                                <div class="type-icon">
                                    <i class="<%=result.GetIcon() %>"></i>
                                </div>

                                <div class="type-context">
                                    <div class="type-name">@result.GetTitle()</div>
                                    <span class="type-datetime">@result.GetDate()</span>
                                    <div class="type-description">@result.GenerateBlurb(300)</div>
                                </div>
                            </a>
                        </li>
                    }
                </ul>


            </section>
        </div>
    </section>
    <!-- search OVERVIEW END -->
</div>