mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 01:51:40 -05:00
helpers for logo & thumbnail urls
This commit is contained in:
parent
b30ba944be
commit
1f9a92ec17
3 changed files with 22 additions and 3 deletions
|
@ -3,7 +3,7 @@ import React from 'react';
|
|||
const PostThumbnail = ({post}) => {
|
||||
return (
|
||||
<a className="post-thumbnail" href={Posts.getLink(post)} target={Posts.getLinkTarget(post)}>
|
||||
<img src={post.thumbnailUrl} />
|
||||
<img src={Posts.getThumbnailUrl(post)} />
|
||||
</a>
|
||||
)
|
||||
}
|
||||
|
|
|
@ -317,4 +317,13 @@ Telescope.utils.getFieldLabel = (fieldName, collection) => {
|
|||
const label = collection.simpleSchema()._schema[fieldName].label;
|
||||
const nameWithSpaces = Telescope.utils.camelToSpaces(fieldName.replace("telescope.", ""));
|
||||
return label || nameWithSpaces;
|
||||
}
|
||||
}
|
||||
|
||||
Telescope.utils.getLogoUrl = () => {
|
||||
const logoUrl = Telescope.settings.get("logoUrl");
|
||||
if (!!logoUrl) {
|
||||
const prefix = Telescope.utils.getSiteUrl().slice(0,-1);
|
||||
// the logo may be hosted on another website
|
||||
return logoUrl.indexOf('://') > -1 ? logoUrl : prefix + logoUrl;
|
||||
}
|
||||
};
|
|
@ -142,4 +142,14 @@ Posts.getNotificationProperties = function (post) {
|
|||
properties.htmlBody = post.htmlBody;
|
||||
|
||||
return properties;
|
||||
};
|
||||
};
|
||||
|
||||
Posts.getThumbnailUrl = (post) => {
|
||||
const thumbnailUrl = post.thumbnailUrl;
|
||||
if (!!thumbnailUrl) {
|
||||
const prefix = Telescope.utils.getSiteUrl().slice(0,-1);
|
||||
// the thumbnail may be hosted on another website
|
||||
return thumbnailUrl.indexOf('://') > -1 ? thumbnailUrl : prefix + thumbnailUrl;
|
||||
}
|
||||
};
|
||||
Posts.helpers({ getThumbnailUrl() { return Posts.getThumbnailUrl(this); } });
|
Loading…
Add table
Reference in a new issue