2015-08-24 12:26:20 +09:00
|
|
|
Posts.addField([
|
|
|
|
{
|
|
|
|
fieldName: 'thumbnailUrl',
|
|
|
|
fieldSchema: {
|
|
|
|
type: String,
|
|
|
|
optional: true,
|
|
|
|
editableBy: ["member", "admin"],
|
|
|
|
autoform: {
|
|
|
|
type: 'bootstrap-postthumbnail'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'media',
|
|
|
|
fieldSchema: {
|
|
|
|
type: Object,
|
|
|
|
optional: true,
|
|
|
|
blackbox: true
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'sourceName',
|
|
|
|
fieldSchema: {
|
|
|
|
type: String,
|
|
|
|
optional: true,
|
|
|
|
}
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'sourceUrl',
|
|
|
|
fieldSchema: {
|
|
|
|
type: String,
|
|
|
|
optional: true,
|
2015-04-22 07:50:11 +09:00
|
|
|
}
|
|
|
|
}
|
2015-08-24 12:26:20 +09:00
|
|
|
]);
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-05-17 15:38:02 +09:00
|
|
|
Telescope.modules.add("postThumbnail", {
|
2015-05-18 10:12:48 +09:00
|
|
|
template: 'post_thumbnail',
|
2015-04-22 07:50:11 +09:00
|
|
|
order: 15
|
|
|
|
});
|
|
|
|
|
2015-08-24 12:26:20 +09:00
|
|
|
Settings.addField([
|
|
|
|
{
|
|
|
|
fieldName: 'embedlyKey',
|
|
|
|
fieldSchema: {
|
|
|
|
type: String,
|
|
|
|
optional: true,
|
|
|
|
private: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'embedly',
|
|
|
|
class: 'private-field'
|
|
|
|
}
|
2015-04-22 07:50:11 +09:00
|
|
|
}
|
2015-08-24 12:26:20 +09:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'thumbnailWidth',
|
|
|
|
fieldSchema: {
|
|
|
|
type: Number,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'embedly'
|
|
|
|
}
|
2015-04-22 07:50:11 +09:00
|
|
|
}
|
2015-08-24 12:26:20 +09:00
|
|
|
},
|
|
|
|
{
|
|
|
|
fieldName: 'thumbnailHeight',
|
|
|
|
fieldSchema: {
|
|
|
|
type: Number,
|
|
|
|
optional: true,
|
|
|
|
autoform: {
|
|
|
|
group: 'embedly'
|
|
|
|
}
|
2015-04-22 07:50:11 +09:00
|
|
|
}
|
|
|
|
}
|
2015-08-24 12:26:20 +09:00
|
|
|
]);
|
2015-04-22 07:50:11 +09:00
|
|
|
|
2015-08-03 20:02:54 +09:00
|
|
|
function addThumbnailClass (postClass, post) {
|
2015-04-22 07:50:11 +09:00
|
|
|
var thumbnailClass = !!post.thumbnailUrl ? "has-thumbnail" : "no-thumbnail";
|
|
|
|
return postClass + " " + thumbnailClass;
|
2015-04-27 10:12:48 +09:00
|
|
|
}
|
|
|
|
// add callback that adds "has-thumbnail" or "no-thumbnail" CSS classes
|
2015-05-17 15:38:02 +09:00
|
|
|
Telescope.callbacks.add("postClass", addThumbnailClass);
|
2015-09-19 10:33:37 +09:00
|
|
|
|
|
|
|
function checkIfPreviouslyPosted (data) {
|
|
|
|
Meteor.call("checkForDuplicates", data.url, function (error, result) {
|
|
|
|
if (error) {
|
|
|
|
Messages.flash(error.reason + '. <a href="'+FlowRouter.path("postPage", {_id: error.details})+'">'+i18n.t("go_to_post")+'</a>');
|
|
|
|
}
|
|
|
|
});
|
|
|
|
}
|
|
|
|
Telescope.callbacks.add("afterEmbedlyPrefill", checkIfPreviouslyPosted);
|
|
|
|
|