Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

SAKIII-4255 check mimetype before setting mimetype description

  • Loading branch information...
commit ae3fb9062a3e8cf46fea91aef456d954a2a81735 1 parent 26d4643
@jsloane jsloane authored
View
6 devwidgets/relatedcontent/javascript/relatedcontent.js
@@ -123,6 +123,12 @@ require(["jquery", "sakai/sakai.api.core"], function($, sakai) {
moreResults = true;
}
data.results[index].commentcount = sakai.api.Content.getCommentCount(item);
+ var mimeType = sakai.api.Content.getMimeType(data.results[index]);
+ var mimeTypeDescription = sakai.api.i18n.getValueForKey(sakai.config.MimeTypes["other"].description);
+ if (sakai.config.MimeTypes[mimeType]){
+ mimeTypeDescription = sakai.api.i18n.getValueForKey(sakai.config.MimeTypes[mimeType].description);
+ }
+ data.results[index].mimeTypeDescription = mimeTypeDescription;
});
var json = {
"content": contentData,
View
9 devwidgets/relatedcontent/relatedcontent.html
@@ -18,13 +18,12 @@
{var mimeType = sakai.api.Content.getMimeType(i)}
{var thumbnail = sakai.api.Content.getThumbnail(i)}
<a href="/content#p=${i['_path']|safeURL}/${i['sakai:pooled-content-file-name']|safeOutput}" title="${i['sakai:pooled-content-file-name']|safeOutput}">
- {var mimeTypeDescription = sakai.config.MimeTypes[mimeType].description}
{if thumbnail}
- <img class="s3d-icon-32" src="${thumbnail}" alt="${sakai.api.i18n.getValueForKey(mimeTypeDescription)}" />
+ <img class="s3d-icon-32" src="${thumbnail}" alt="${i.mimeTypeDescription}" />
{elseif sakai.config.MimeTypes[mimeType]}
- <img class="s3d-icon-32" src="${sakai.config.MimeTypes[mimeType].URL}" alt="${sakai.api.i18n.getValueForKey(mimeTypeDescription)}" />
+ <img class="s3d-icon-32" src="${sakai.config.MimeTypes[mimeType].URL}" alt="${i.mimeTypeDescription}" />
{else}
- <img class="s3d-icon-32" src="${sakai.config.MimeTypes["other"].URL}" alt="${sakai.api.i18n.getValueForKey(mimeTypeDescription)}" />
+ <img class="s3d-icon-32" src="${sakai.config.MimeTypes["other"].URL}" alt="${i.mimeTypeDescription}" />
{/if}
</a>
<div class="relatedcontent_content_right">
@@ -38,7 +37,7 @@
</span>
</a>
{if sakai.config.MimeTypes[mimeType]}
- <span class="relatedcontent_mimetypedescription">${sakai.api.i18n.getValueForKey(mimeTypeDescription)}</span>
+ <span class="relatedcontent_mimetypedescription">${i.mimeTypeDescription}</span>
{/if}
{if i.commentcount}
<span class="relatedcontent_comments">
Please sign in to comment.
Something went wrong with that request. Please try again.