Skip to content

Commit

Permalink
#501: file list updated to show thumbnail image instead of icon, if f…
Browse files Browse the repository at this point in the history
…ile has it.
  • Loading branch information
Simonas Mikulenas committed Jun 27, 2013
1 parent 1da8469 commit 5771bfc
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -278,6 +278,8 @@ protected void FillMediaViewModel(MediaViewModel model, Media media)
model.IsArchived = media.IsArchived;
model.ParentFolderId = media.Folder != null ? media.Folder.Id : Guid.Empty;
model.ParentFolderName = media.Folder != null ? media.Folder.Title : MediaGlobalization.MediaList_RootFolderName;
model.Tooltip = media.Image != null ? media.Image.Caption : null;
model.ThumbnailUrl = media.Image != null ? media.Image.PublicThumbnailUrl : null;
}

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -603,6 +603,12 @@ input.bcms-grid-input:focus {
vertical-align: middle;
}

.bcms-system-file img {
display: block;
width: 54px;
height: 42px;
}

.bcms-media-name {
line-height: 16px;
font-size: 11px;
Expand Down
20 changes: 10 additions & 10 deletions Modules/BetterCms.Module.MediaManager/Scripts/bcms.media.js
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,16 @@ function ($, bcms, modal, siteSettings, forms, dynamicContent, messages, mediaUp
self.parentFolderId = ko.observable(item.ParentFolderId);
self.parentFolderName = ko.observable(item.ParentFolderName);

self.tooltip = item.Tooltip;
self.thumbnailUrl = ko.observable(item.ThumbnailUrl);

self.getImageUrl = function () {
if (!self.thumbnailUrl()) {
return null;
}
return self.thumbnailUrl();
};

self.contextMenu = new MediaItemContextMenuViewModel();

self.isFile = function () {
Expand Down Expand Up @@ -631,16 +641,6 @@ function ($, bcms, modal, siteSettings, forms, dynamicContent, messages, mediaUp

var self = this;

self.tooltip = item.Tooltip;
self.thumbnailUrl = ko.observable(item.ThumbnailUrl);

self.getImageUrl = function() {
if (!self.thumbnailUrl()) {
return null;
}
return self.thumbnailUrl();
};

self.previewImage = function () {
var previewUrl = self.publicUrl();
if (previewUrl) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ namespace BetterCms.Module.MediaManager.ViewModels.MediaManager
[Serializable]
public class MediaImageViewModel : MediaFileViewModel
{
public string ThumbnailUrl { get; set; }

public string Tooltip { get; set; }

public MediaImageViewModel()
{
Type = MediaType.Image;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,10 @@ public class MediaViewModel : IEditableGridItem

public virtual string ParentFolderName { get; set; }

public virtual string Tooltip { get; set; }

public virtual string ThumbnailUrl { get; set; }

public MediaViewModel()
{
ContentType = MediaContentType.File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@

<div class="bcms-media-items-block">
<div data-bind="css: iconClassNames()">
<!-- ko if: isImage() -->
<!-- ko if: getImageUrl() -->
<img data-bind="attr: { alt: tooltip, src: getImageUrl() }" />
<!-- /ko -->
</div>
Expand Down

0 comments on commit 5771bfc

Please sign in to comment.