FIX: Support for embedding ads via component

This commit is contained in:
Robin Ward 2016-11-23 14:29:30 -05:00
parent de4a8366fc
commit 1cd0bef933
3 changed files with 40 additions and 33 deletions

View File

@ -0,0 +1,33 @@
{{#if site.mobileView}}
{{#if model.postSpecificCountAdsense}}
{{#if siteSettings.adsense_mobile_post_bottom_code}}
{{google-adsense placement="post-bottom" postNumber=model.post_number}}
{{/if}}
{{/if}}
{{#if model.postSpecificCountDFP}}
{{#if siteSettings.dfp_mobile_post_bottom_code}}
{{google-dfp-ad placement="post-bottom" category=model.topic.category.slug postNumber=model.post_number}}
{{/if}}
{{/if}}
{{#if model.postSpecificCountAmazon}}
{{#if siteSettings.amazon_mobile_post_bottom_src_code}}
{{amazon-product-links placement="post-bottom" postNumber=model.post_number}}
{{/if}}
{{/if}}
{{else}}
{{#if model.postSpecificCountAdsense}}
{{#if siteSettings.adsense_post_bottom_code}}
{{google-adsense placement="post-bottom" postNumber=model.post_number}}
{{/if}}
{{/if}}
{{#if model.postSpecificCountDFP}}
{{#if siteSettings.dfp_post_bottom_code}}
{{google-dfp-ad placement="post-bottom" category=model.topic.category.slug postNumber=model.post_number}}
{{/if}}
{{/if}}
{{#if model.postSpecificCountAmazon}}
{{#if siteSettings.amazon_post_bottom_src_code}}
{{amazon-product-links placement="post-bottom" postNumber=model.post_number}}
{{/if}}
{{/if}}
{{/if}}

View File

@ -1,33 +1 @@
{{#if site.mobileView}}
{{#if postSpecificCountAdsense}}
{{#if siteSettings.adsense_mobile_post_bottom_code}}
{{google-adsense placement="post-bottom" postNumber=post_number}}
{{/if}}
{{/if}}
{{#if postSpecificCountDFP}}
{{#if siteSettings.dfp_mobile_post_bottom_code}}
{{google-dfp-ad placement="post-bottom" category=topic.category.slug postNumber=post_number}}
{{/if}}
{{/if}}
{{#if postSpecificCountAmazon}}
{{#if siteSettings.amazon_mobile_post_bottom_src_code}}
{{amazon-product-links placement="post-bottom" postNumber=post_number}}
{{/if}}
{{/if}}
{{else}}
{{#if postSpecificCountAdsense}}
{{#if siteSettings.adsense_post_bottom_code}}
{{google-adsense placement="post-bottom" postNumber=post_number}}
{{/if}}
{{/if}}
{{#if postSpecificCountDFP}}
{{#if siteSettings.dfp_post_bottom_code}}
{{google-dfp-ad placement="post-bottom" category=topic.category.slug postNumber=post_number}}
{{/if}}
{{/if}}
{{#if postSpecificCountAmazon}}
{{#if siteSettings.amazon_post_bottom_src_code}}
{{amazon-product-links placement="post-bottom" postNumber=post_number}}
{{/if}}
{{/if}}
{{/if}}
{{adplugin-container model=this}}

View File

@ -30,6 +30,12 @@ export default {
withPluginApi('0.1', api => {
api.decorateWidget('post:after', dec => {
if (dec.canConnectComponent) {
return dec.connect({ component: 'adplugin-container', context: 'model' });
}
// Old way for backwards compatibility
return dec.connect({
templateName: 'connectors/post-bottom/discourse-adplugin',
context: 'model'