mirror of
https://github.com/vale981/Vulcan
synced 2025-03-06 10:01:40 -05:00
test if Embedly key exists, and if not show message
This commit is contained in:
parent
09885700b0
commit
baf7aec813
5 changed files with 26 additions and 2 deletions
|
@ -1,5 +1,6 @@
|
|||
{
|
||||
"thumbnail": "Thumbnail",
|
||||
"thumbnailUrl": "Thumbnail",
|
||||
"clear_thumbnail": "Clear Thumbnail"
|
||||
"clear_thumbnail": "Clear Thumbnail",
|
||||
"please_fill_in_embedly_key": "Please fill in your Embedly API key to enable thumbnails."
|
||||
}
|
|
@ -1,4 +1,6 @@
|
|||
{
|
||||
"thumbnail": "Aperçu",
|
||||
"thumbnailUrl": "Aperçu"
|
||||
"thumbnailUrl": "Aperçu",
|
||||
"clear_thumbnail": "Effacer l'aperçu",
|
||||
"please_fill_in_embedly_key": "Veuillez fournir une clé API Embedly pour activer les aperçus."
|
||||
}
|
|
@ -1,8 +1,12 @@
|
|||
<template name="afPostThumbnail">
|
||||
{{#if embedlyKeyExists}}
|
||||
<div class="post-thumbnail-container" style="{{style}}">
|
||||
<img src="{{this.value}}" class="post-thumbnail-preview" style="{{style}}"/>
|
||||
<div class="post-thumbnail-loading">{{>spinner}}</div>
|
||||
</div>
|
||||
<input type="hidden" value="{{this.value}}" {{this.atts}}/>
|
||||
<a href="#" class="remove-thumbnail-link">{{_ 'clear_thumbnail'}}</a>
|
||||
{{else}}
|
||||
<p>{{_ "please_fill_in_embedly_key"}}</p>
|
||||
{{/if}}
|
||||
</template>
|
|
@ -2,6 +2,16 @@ AutoForm.addInputType("bootstrap-postthumbnail", {
|
|||
template: "afPostThumbnail"
|
||||
});
|
||||
|
||||
Template.afPostThumbnail.created = function () {
|
||||
var instance = this;
|
||||
instance.embedlyKeyExists = new ReactiveVar(false);
|
||||
// embedly key is not published to client, so we need a method to test if it has been provided or not
|
||||
Meteor.call('embedlyKeyExists', function (error, result) {
|
||||
if (result)
|
||||
instance.embedlyKeyExists.set(result);
|
||||
});
|
||||
}
|
||||
|
||||
Template.afPostThumbnail.helpers({
|
||||
atts: function addFormControlAtts() {
|
||||
var atts = _.clone(this.atts);
|
||||
|
@ -13,6 +23,10 @@ Template.afPostThumbnail.helpers({
|
|||
var thumbnailWidth = getSetting('thumbnailWidth', 200);
|
||||
var thumbnailHeight = getSetting('thumbnailHeight', 125);
|
||||
return "width: "+thumbnailWidth+"px; height: "+thumbnailHeight+"px;"
|
||||
},
|
||||
embedlyKeyExists: function () {
|
||||
// haven't found a better way to do this yet…
|
||||
return Template.instance().embedlyKeyExists.get();
|
||||
}
|
||||
});
|
||||
|
||||
|
|
|
@ -45,6 +45,9 @@ Meteor.methods({
|
|||
},
|
||||
getEmbedlyData: function (url) {
|
||||
return getEmbedlyData(url);
|
||||
},
|
||||
embedlyKeyExists: function () {
|
||||
return !!getSetting('embedlyKey');
|
||||
}
|
||||
});
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue