@using System.Drawing
@using MrCMS.Helpers
@using MrCMS.Web.Apps.Galleries.Pages
@using MrCMS.Website
@using NHibernate.Criterion
@model GalleryList 
           
@Editable(Model, p=>p.BodyContent, true)

@{
    var category = Request["Category"];

    var query = QueryOver.Of<Gallery>()
                                     .Where(gallery => gallery.Parent == Model && gallery.PublishOn != null && gallery.PublishOn <= CurrentRequestData.Now)
                                     .ThenBy(gallery => gallery.DisplayOrder)
                                     .Desc;

    var pagedList = Model.PagedChildren(pageNum: Request["p"].GetIntValue(1), query: query, pageSize: Model.PageSize);
}


@foreach (var page in pagedList)
{
    <div class="row">
        <div class="col-lg-12">
            <h3 class="margin-top-0"><a href="/@page.LiveUrlSegment" class="margin-top-0">@page.Name </a></h3>
            @page.CreatedOn.Day @page.CreatedOn.ToString("MMMMM") @page.CreatedOn.Year <br />
            @Html.RenderImage(page.ThumbnailImage, new Size{Width = 100, Height = 100})
        </div>
    </div>
    <hr />
}
@if (Model.AllowPaging)
{
    @Html.PageCurrentPage(pagedList, i => new { p = i }, PagedListRenderOptions.PageNumbersOnly)
}

