@using MrCMS.Entities.Documents.Web
@using MrCMS.Helpers
@using MrCMS.Paging
@model MrCMS.Web.Areas.Admin.Models.CustomScriptPagesSearchModel
@{
    ViewBag.Title = "Custom Script Pages";
    var webpages = ViewData["results"] as IPagedList<Webpage>;
}
<fieldset>
    <legend>
        @Resource("Admin User Custom Script Pages", "Custom Script Pages")
    </legend>
    <div class="alert alert-info">
        <p>@Resource("This page shows all CMS pages with header or footer scripts set.")</p>
    </div>
    @if (webpages.Any())
    {
        <table class="table table-striped table-condensed">
            <thead>

                <tr>
                    <th>
                        @Resource("Name")
                    </th>
                    <th>
                        @Resource("Custom Header?")
                    </th>
                    <th>
                        @Resource("Custom Footer?")
                    </th>
                    <th></th>
                </tr>
            </thead>
            <tbody>
                @foreach (var webpage in webpages)
                {
                    <tr>
                        <td>
                            @webpage.Name
                        </td>
                        <td>
                            @(!string.IsNullOrWhiteSpace(webpage.CustomHeaderScripts) ? "✓" : "")
                        </td>
                        <td>
                            @(!string.IsNullOrWhiteSpace(webpage.CustomFooterScripts) ? "✓" : "")
                        </td>
                        <td class="text-right">
                            @Html.ActionLink(Resource("Edit"), "Edit", "Webpage", new { id = webpage.Id }, new { @class = "btn btn-default btn-xs" })
                        </td>
                    </tr>
                }
            </tbody>
        </table>

        @Html.Pager(webpages, "Index", page => new { page })
    }
    else
    {
        <div class="alert alert-info">
            There are currently no pages with custom scripts
        </div>
    }
</fieldset>
