@using System.Drawing
@using MrCMS.Helpers
@model MrCMS.Entities.Documents.Media.MediaFile
<div class="file-result" data-file-result="@Model.Id">
    <div class="header">
        @if (Model.IsImage())
        {
            @Html.RenderImage(Model.FileUrl, new Size(25, 25))
        }
        @Model.FileName - @Model.ContentLength bytes
        <a href="#" class="pull-right" data-media-toggle="@Model.Id">@Resource("Show")</a>
    </div>
    <div class="content" style="display: none" data-media-result="@Model.Id">
        @if (Model.IsImage())
        {
            <table>
                <tbody>
                    <tr>
                        <td>
                            @Html.RenderImage(Model.FileUrl, new Size(64, 64))
                        </td>
                        <td width="10"></td>
                        <td>
                            @foreach (var size in Model.GetSizes())
                            {
                                <div>
                                    @{
                                var id = "SelectedFile-" + Model.Id + "-" + size.Width + "-" + size.Height;
                                    }
                                    @Html.RadioButton("SelectedFile", Model.Id + "-" + size.Width + "-" + size.Height, new { id, data_file = Model.Id })
                                    @Html.Label(id, new { style = "display:inline" }, size.Name + " (" + size.ActualWidth + "px x " + size.ActualHeight + "px)")
                                </div>
                            }

                            <input type="button" class="btn-primary btn btn-sm" data-file="@Model.Id" data-action="select" disabled="disabled" value="@Resource("Admin Media Choose File", "Choose File")" />
                        </td>
                    </tr>
                </tbody>
            </table>
        }
        else
        {
            var id = "SelectedFile-" + Model.Id;
            @Html.RadioButton("SelectedFile", Model.FileUrl, new { id, data_file = Model.Id })
            @Html.Label(id, "Select file")

            <input type="button" class="btn-primary btn set-file" data-file="@Model.Id" data-action="select" disabled="disabled" value="@Resource("Admin Media Choose File", "Choose File")" />
        }
    </div>
</div>
