@using MrCMS.Helpers
@model System.Collections.Generic.List<MrCMS.Models.SortItem>
@{
    ViewBag.Title = "Sort Pages";
    Layout = "~/Areas/Admin/Views/Shared/_Layout.cshtml";
}
@section JavaScriptBlock
{
    <script type="text/javascript">
        $(document).ready(function () {
            $("#sortable").sortable({
                update: function (event, ui) {
                    $('#sortable li').each(function (index, domElement) {
                        $(domElement).find('[name*="Order"]').val(index);
                    });
                }
            });
        });
    </script>
}
<form method="POST" id="sort-webpage">
    <fieldset>
        <legend>@Resource("Sort")
     <span class="btn-group  display-inline  pull-right">
         <input type="submit" class="btn btn-primary" value="@Resource("Save")" />
     </span>
        </legend>
        <ul id="sortable">
            @for (int 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>
            }
        </ul>
    </fieldset>
</form>
