')
+ .attr('data-action', 'showImagePreview')
+ .attr('data-id', id)
+ .attr('title', name)
+ .attr('href', this.getImageUrl(id))
+ .append($img)
+ .get(0)
+ .outerHTML;
- return preview;
+ return html;
},
getEditPreview: function (name, type, id) {
name = Handlebars.Utils.escapeExpression(name);
id = Handlebars.Utils.escapeExpression(id);
- var preview = name;
-
- if (~this.previewTypeList.indexOf(type)) {
- preview = '
';
+ if (!~this.previewTypeList.indexOf(type)) {
+ return null;
}
- return preview;
+ let html = $('
')
+ .attr('src', this.getImageUrl(id, 'small'))
+ .attr('title', name)
+ .css({
+ maxWidth: (this.imageSizes[this.previewSize] || {})[0],
+ maxHeight: (this.imageSizes[this.previewSize] || {})[1],
+ })
+ .get(0)
+ .outerHTML;
+
+ return html;
},
getValueForDisplay: function () {
@@ -549,7 +569,7 @@ define('views/fields/file', 'views/fields/link', function (Dep) {
var $att = $('')
.append(removeLink)
- .append(
+ .append(
$('' + preview + '')
.addClass('gray-box')
);