﻿@model PackageListViewModel
@{
    ViewBag.Title = String.IsNullOrWhiteSpace(Model.SearchTerm) ? "Packages" : "Packages matching " + Model.SearchTerm;
    ViewBag.Tab = "Packages";
}

<div class="search">
    @if (!String.IsNullOrEmpty(Model.SearchTerm))
    {
        <h1>Search for <i>@Model.SearchTerm</i> returned @Model.TotalCount @if (Model.TotalCount == 1)
                                                                      {
                                                                          <text>package</text>
                                                                      }
                                                                      else
                                                                      {
                                                                          <text>packages</text>
                                                                      }</h1>
    }
    else
    {
        <h1>@if (Model.TotalCount == 1)
            {
                <text>There is @Model.TotalCount package</text>
            }
            else
            {
                <text>There are @Model.TotalCount packages</text>
            }</h1>
    }
    @if (@Model.LastResultIndex > 0)
    {
        <h2>Displaying results @Model.FirstResultIndex - @Model.LastResultIndex.</h2>
    }
</div>

<span class="sorted-by">Sorted by Recent Installs</span>

<ul id="searchResults">
    @foreach (var package in Model.Items)
    {
        <li>
            @Html.Partial("_ListPackage", package)
        </li>
    }
</ul>


@ViewHelpers.PreviousNextPager(Model.Pager)


﻿@model PackageListViewModel
@{
    ViewBag.Title = String.IsNullOrWhiteSpace(Model.SearchTerm) ? "Packages" : "Packages matching " + Model.SearchTerm;
    ViewBag.SortText = String.IsNullOrWhiteSpace(Model.SearchTerm) ? "recent installs" : "relevance";
    ViewBag.Tab = "Packages";
}

<div class="search">
    @if (!String.IsNullOrEmpty(Model.SearchTerm))
    {
        <h1>Search for <i>@Model.SearchTerm</i> returned @Model.TotalCount @if (Model.TotalCount == 1)
                                                                      {
                                                                          <text>package</text>
                                                                      }
                                                                      else
                                                                      {
                                                                          <text>packages</text>
                                                                      }</h1>
    }
    else
    {
        <h1>@if (Model.TotalCount == 1)
            {
                <text>There is @Model.TotalCount package</text>
            }
            else
            {
                <text>There are @Model.TotalCount packages</text>
            }</h1>
    }
    @if (@Model.LastResultIndex > 0)
    {
        <h2>Displaying results @Model.FirstResultIndex - @Model.LastResultIndex.</h2>
    }
</div>

<span class="sorted-by">sorted by @ViewBag.SortText</span>

<ul id="searchResults">
    @foreach (var package in Model.Items)
    {
        <li>
            @Html.Partial("_ListPackage", package)
        </li>
    }
</ul>


@ViewHelpers.PreviousNextPager(Model.Pager)


Change the sort text based on if there's a term or not
Change the sort text based on if there's a term or not
