Making edit media screen suck less for non-images.

--HG--
branch : 1.x
This commit is contained in:
Bertrand Le Roy
2012-08-12 15:57:30 -07:00
parent 9fd54f8f43
commit abf5b279dd

View File

@@ -5,6 +5,11 @@
@{
Style.Require("MediaAdmin");
Layout.Title = T("Edit Media - {0}", Model.Name).ToString();
var isPicture = new[] {".png", ".jpg", ".jpeg", ".gif", ".bmp", ".ico"}
.Contains(Path.GetExtension(Model.RelativePath ?? "").ToLowerInvariant());
var embedHTML = isPicture ?
"<img src=\"" + Model.PublicUrl + "\"/>" :
"<a href=\"" + Model.PublicUrl + "\">" + Model.Name + "</a>";
}
<div class="breadCrumbs">
@@ -18,23 +23,24 @@
<div class="sections clearBoth">
<div class="primary">
<div>
<img src="@Model.PublicUrl" class="previewImage"/>
</div>
@if (isPicture) {
<div>
<img src="@Model.PublicUrl" class="previewImage"/>
</div>
}
@* todo: make these real (including markup) *@
<div>
@* <label>@T("Dimensions: <span>500 x 375 pixels</span>")</label> *@
@* <label>@T("Dimensions: <span>500 x 375 pixels</span>")</label> *@
<label>@T("Size: <span>{0}</span>", Model.Size.ToFriendlySizeString())</label>
<label>@T("Size: <span>{0}</span>", Model.Size.ToFriendlySizeString())</label>
<label>@T("Added on: <span>{0}</span>", Model.LastUpdated)</label>
<label>@T("Added on: <span>{0}</span>", Model.LastUpdated)</label>
</div>
<div>
<label for="embedPath">@T("Embed:")</label>
<input id="embedPath" class="textMedium" name="embedPath" type="text" readonly="readonly" value="&lt;img src=&quot;@Model.PublicUrl&quot; @* width=&quot;500&quot; height=&quot;375&quot; *@ /&gt;" />
<span class="hint">@T("Copy this html to add this image to your site.")</span>
<input id="embedPath" class="textMedium" name="embedPath" type="text" readonly="readonly" value="@embedHTML" />
<span class="hint">@T("Copy this html to add this media file to your site.")</span>
</div>
@using (Html.BeginFormAntiForgeryPost()) {