From ffbd69688efc93b453e477a88696b17cff414b1a Mon Sep 17 00:00:00 2001 From: Ken Cooper Date: Wed, 28 Oct 2015 16:51:53 -0700 Subject: [PATCH 1/2] Fixed: mobile viewport was too large when presenting ads, making for a sloppy mobile experience. Restricted length of "Advertisement" label to fix it. --- .../discourse/components/amazon-product-links.js.es6 | 4 ++++ assets/javascripts/discourse/components/google-adsense.js.es6 | 4 ++++ assets/javascripts/discourse/components/google-dfp-ad.js.es6 | 4 ++++ .../discourse/templates/components/amazon-product-links.hbs | 3 ++- .../discourse/templates/components/google-adsense.hbs | 3 ++- .../discourse/templates/components/google-dfp-ad.hbs | 3 ++- 6 files changed, 18 insertions(+), 3 deletions(-) diff --git a/assets/javascripts/discourse/components/amazon-product-links.js.es6 b/assets/javascripts/discourse/components/amazon-product-links.js.es6 index 240cb76..9bcdc85 100644 --- a/assets/javascripts/discourse/components/amazon-product-links.js.es6 +++ b/assets/javascripts/discourse/components/amazon-product-links.js.es6 @@ -101,6 +101,10 @@ export default Ember.Component.extend({ return `width: ${this.get('mobile_amazon_width')}px; height: ${this.get('mobile_amazon_height')}px;`.htmlSafe(); }.property('mobile_amazon_width', 'mobile_amazon_height'), + adTitleStyleMobile: function() { + return `width: ${this.get('mobile_amazon_width')}px;`.htmlSafe(); + }.property('mobile_amazon_width'), + userInput: function() { return `${this.get('user_input')}`.htmlSafe(); }.property('user_input'), diff --git a/assets/javascripts/discourse/components/google-adsense.js.es6 b/assets/javascripts/discourse/components/google-adsense.js.es6 index 585d3da..be52cae 100644 --- a/assets/javascripts/discourse/components/google-adsense.js.es6 +++ b/assets/javascripts/discourse/components/google-adsense.js.es6 @@ -120,6 +120,10 @@ export default Ember.Component.extend({ return `width: ${this.get('ad_mobile_width')}px; height: ${this.get('ad_mobile_height')}px; margin:0 auto;`.htmlSafe(); }.property('ad_mobile_width', 'ad_mobile_height'), + adTitleStyleMobile: function() { + return `width: ${this.get('ad_mobile_width')}px;`.htmlSafe(); + }.property('ad_mobile_width'), + adInsStyleMobile: function() { return `display: inline-block; ${this.get('adWrapperStyleMobile')}`.htmlSafe(); }.property('adWrapperStyleMobile'), diff --git a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 index b8a6f1c..f10b3fb 100755 --- a/assets/javascripts/discourse/components/google-dfp-ad.js.es6 +++ b/assets/javascripts/discourse/components/google-dfp-ad.js.es6 @@ -187,6 +187,10 @@ export default Ember.Component.extend({ return `width: ${this.get('const_mobile_width')}px; height: ${this.get('const_mobile_height')}px;`.htmlSafe(); }.property('const_mobile_width', 'const_mobile_height'), + adTitleStyleMobile: function() { + return `width: ${this.get('const_mobile_width')}px;`.htmlSafe(); + }.property('const_mobile_width'), + checkTrustLevels: function() { return !((currentUser) && (currentUser.get('trust_level') > Discourse.SiteSettings.dfp_through_trust_level)); }.property('trust_level'), diff --git a/assets/javascripts/discourse/templates/components/amazon-product-links.hbs b/assets/javascripts/discourse/templates/components/amazon-product-links.hbs index bb1f41b..1522e49 100644 --- a/assets/javascripts/discourse/templates/components/amazon-product-links.hbs +++ b/assets/javascripts/discourse/templates/components/amazon-product-links.hbs @@ -1,9 +1,10 @@ {{#if checkTrustLevels}} - {{#if site.mobileView}} + {{else}} +
diff --git a/assets/javascripts/discourse/templates/components/google-adsense.hbs b/assets/javascripts/discourse/templates/components/google-adsense.hbs index c31f0e9..29e8ac6 100644 --- a/assets/javascripts/discourse/templates/components/google-adsense.hbs +++ b/assets/javascripts/discourse/templates/components/google-adsense.hbs @@ -1,7 +1,7 @@ {{#if checkTrustLevels}} -

ADVERTISEMENT

{{#if site.mobileView}}
+

ADVERTISEMENT

{{else}} +

ADVERTISEMENT

ADVERTISEMENT

{{#if site.mobileView}} +

ADVERTISEMENT

{{else}} +

ADVERTISEMENT

{{/if}} {{/if}} \ No newline at end of file From 31a59a454d94b49465326d537dc60cf103a1ab8c Mon Sep 17 00:00:00 2001 From: Ken Cooper Date: Wed, 28 Oct 2015 19:40:37 -0700 Subject: [PATCH 2/2] Fixed: mobile iframe link for Amazon banners was generating the desktop link. --- .../discourse/templates/components/amazon-product-links.hbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/assets/javascripts/discourse/templates/components/amazon-product-links.hbs b/assets/javascripts/discourse/templates/components/amazon-product-links.hbs index 1522e49..5dafa0a 100644 --- a/assets/javascripts/discourse/templates/components/amazon-product-links.hbs +++ b/assets/javascripts/discourse/templates/components/amazon-product-links.hbs @@ -1,7 +1,7 @@ {{#if checkTrustLevels}} {{#if site.mobileView}} - {{else}}