@using MrCMS.Helpers
@using MrCMS.Web.Apps.Ecommerce.Entities.NewsletterBuilder
@model List<MrCMS.Models.SortItem>
@{
    Layout = "~/Areas/Admin/Views/Shared/_LayoutPopup.cshtml";
}
@using (Html.BeginForm("SortContentItems", "Newsletter", FormMethod.Post))
{
    @Html.ReturnToReferrer();
    
        <fieldset>
            <legend>
                Sort Content Items
                <span class="btn-group  display-inline  pull-right">
                    <button class="btn btn-primary" id="submit">
                        Save & Close
                    </button>
                </span>
            </legend>

            <ul id="sortable">
                @if (Model.Any())
                {
                    for (var i = 0; i < Model.Count; i++)
                    {
                        <li>
                            @Html.HiddenFor(model => model[i].Id)
                            @Html.HiddenFor(model => model[i].Order)
                            <i class="glyphicon glyphicon-resize-full"></i>&nbsp;&nbsp;
                            @Model[i].Name
                        </li>
                    }
                }
                else
                {
                    <li>No options to sort.</li>
                }
            </ul>
        </fieldset>
    }

    @{ Html.IncludeScript("~/Apps/Ecommerce/Areas/Admin/Content/Scripts/custom/sorting.js"); }
