From edffa2009445b18c26e4637f6cb9268ec96cac15 Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Mon, 4 Apr 2016 16:49:01 -0400 Subject: [PATCH 1/2] Improve description of DFP and AdSense settings. People keep putting javascript into those fields. Also add a constraint on the fields so people get an error when they paste javascript. --- config/locales/server.en.yml | 32 ++++++++++++++++---------------- config/settings.yml | 22 ++++++++++++++++++++-- 2 files changed, 36 insertions(+), 18 deletions(-) diff --git a/config/locales/server.en.yml b/config/locales/server.en.yml index 576bdbf..037dffa 100755 --- a/config/locales/server.en.yml +++ b/config/locales/server.en.yml @@ -2,40 +2,40 @@ en: site_settings: dfp_publisher_id: "Input your publisher ID" dfp_through_trust_level: "Show your ads to users based on trust levels" - dfp_topic_list_top_code: "Enter ad code to display at topic list top location" - dfp_mobile_topic_list_top_code: "Enter ad code to display mobile ads at topic list top location" + dfp_topic_list_top_code: "Enter the code of the ad unit to display at topic list top location. This is the short code (max 100 chars) of the ad unit, not the JavaScript code." + dfp_mobile_topic_list_top_code: "Enter the code of the ad unit to display mobile ads at topic list top location. This is the short code (max 100 chars) of the ad unit, not the JavaScript code." dfp_topic_list_top_ad_sizes: "Choose your ad size" dfp_target_topic_list_top_key_code: "Input custom targeting keys - inventory Level" dfp_target_topic_list_top_value_code: "Input custom targeting values - inventory Level" - dfp_topic_above_post_stream_code: "Enter ad code to display at topic above post stream location" - dfp_mobile_topic_above_post_stream_code: "Enter ad code to display mobile ads at topic above post stream location" + dfp_topic_above_post_stream_code: "Enter the code of the ad unit to display at topic above post stream location. This is the short code (max 100 chars) of the ad unit, not the JavaScript code." + dfp_mobile_topic_above_post_stream_code: "Enter the code of the ad unit to display mobile ads at topic above post stream location. This is the short code (max 100 chars) of the ad unit, not the JavaScript code." dfp_topic_above_post_stream_ad_sizes: "Choose your ad size" dfp_target_topic_above_post_stream_key_code: "Input custom targeting keys - inventory Level" dfp_target_topic_above_post_stream_value_code: "Input custom targeting values - inventory Level" - dfp_topic_above_suggested_code: "Enter ad code to display at topic above suggested location" - dfp_mobile_topic_above_suggested_code: "Enter ad code to display mobile ads at topic above suggested location" + dfp_topic_above_suggested_code: "Enter the code of the ad unit to display at topic above suggested location. This is the short code (max 100 chars) of the ad unit, not the JavaScript code." + dfp_mobile_topic_above_suggested_code: "Enter the code of the ad unit to display mobile ads at topic above suggested location. This is the short code (max 100 chars) of the ad unit, not the JavaScript code." dfp_topic_above_suggested_ad_sizes: "Choose your ad size" dfp_target_topic_above_suggested_key_code: "Input custom targeting keys - inventory Level" dfp_target_topic_above_suggested_value_code: "Input custom targeting values - inventory Level" - dfp_post_bottom_code: "Enter ad code to display at post bottom location" - dfp_mobile_post_bottom_code: "Enter ad code to display mobile ads at post bottom location" + dfp_post_bottom_code: "Enter the code of the ad unit to display at post bottom location. This is the short code (max 100 chars) of the ad unit, not the JavaScript code." + dfp_mobile_post_bottom_code: "Enter the code of the ad unit to display mobile ads at post bottom location. This is the short code (max 100 chars) of the ad unit, not the JavaScript code." dfp_nth_post_code: "Choose a post number for your ad to show in the post bottom location - this is the nth post" dfp_post_bottom_ad_sizes: "Choose your ad size" dfp_target_post_bottom_key_code: "Input custom targeting keys - inventory Level" dfp_target_post_bottom_value_code: "Input custom targeting values - inventory Level" adsense_publisher_code: "Input your publisher ID" adsense_through_trust_level: "Show your ads to users based on trust levels" - adsense_topic_list_top_code: "Enter ad code to display at topic list top location" - adsense_mobile_topic_list_top_code: "Enter ad code to display mobile ads at topic list top location" + adsense_topic_list_top_code: "Enter code of the ad unit to display at topic list top location. This is the number assigned to the ad unit, not the JavaScript code." + adsense_mobile_topic_list_top_code: "Enter code of the ad unit to display mobile ads at topic list top location. This is the number assigned to the ad unit, not the JavaScript code." adsense_topic_list_top_ad_sizes: "Choose your ad sizes" - adsense_topic_above_post_stream_code: "Enter ad code to display at topic above post stream location" - adsense_mobile_topic_above_post_stream_code: "Enter ad code to display mobile ads at topic above post stream location" + adsense_topic_above_post_stream_code: "Enter code of the ad unit to display at topic above post stream location. This is the number assigned to the ad unit, not the JavaScript code." + adsense_mobile_topic_above_post_stream_code: "Enter code of the ad unit to display mobile ads at topic above post stream location. This is the number assigned to the ad unit, not the JavaScript code." adsense_topic_above_post_stream_ad_sizes: "Choose your ad sizes" - adsense_topic_above_suggested_code: "Enter ad code to display at topic above suggested location" - adsense_mobile_topic_above_suggested_code: "Enter ad code to display mobile ads at topic above suggested location" + adsense_topic_above_suggested_code: "Enter code of the ad unit to display at topic above suggested location. This is the number assigned to the ad unit, not the JavaScript code." + adsense_mobile_topic_above_suggested_code: "Enter code of the ad unit to display mobile ads at topic above suggested location. This is the number assigned to the ad unit, not the JavaScript code." adsense_topic_above_suggested_ad_sizes: "Choose your ad sizes" - adsense_post_bottom_code: "Enter ad code to display ads at post bottom location" - adsense_mobile_post_bottom_code: "Enter ad code to display mobile ads at post bottom location" + adsense_post_bottom_code: "Enter code of the ad unit to display ads at post bottom location. This is the number assigned to the ad unit, not the JavaScript code." + adsense_mobile_post_bottom_code: "Enter code of the ad unit to display mobile ads at post bottom location. This is the number assigned to the ad unit, not the JavaScript code." adsense_post_bottom_ad_sizes: "Choose your ad sizes" adsense_nth_post_code: "Choose a post number for your ad to show in the post bottom location - this is the nth post" amazon_through_trust_level: "Show your ads to users based on trust levels" diff --git a/config/settings.yml b/config/settings.yml index 23a7d9b..bb55436 100755 --- a/config/settings.yml +++ b/config/settings.yml @@ -9,9 +9,11 @@ adsense_plugin: adsense_topic_list_top_code: client: true default: '' + max: 50 adsense_mobile_topic_list_top_code: client: true - default: '' + default: '' + max: 50 adsense_topic_list_top_ad_sizes: client: true default: '728*90 - leaderboard' @@ -30,9 +32,11 @@ adsense_plugin: adsense_topic_above_post_stream_code: client: true default: '' + max: 50 adsense_mobile_topic_above_post_stream_code: client: true - default: '' + default: '' + max: 50 adsense_topic_above_post_stream_ad_sizes: client: true default: '728*90 - leaderboard' @@ -51,9 +55,11 @@ adsense_plugin: adsense_topic_above_suggested_code: client: true default: '' + max: 50 adsense_mobile_topic_above_suggested_code: client: true default: '' + max: 50 adsense_topic_above_suggested_ad_sizes: client: true default: '728*90 - leaderboard' @@ -72,9 +78,11 @@ adsense_plugin: adsense_post_bottom_code: client: true default: '' + max: 50 adsense_mobile_post_bottom_code: client: true default: '' + max: 50 adsense_post_bottom_ad_sizes: client: true default: '728*90 - leaderboard' @@ -89,6 +97,7 @@ adsense_plugin: adsense_nth_post_code: client: true default: '' + max: 50 dfp_plugin: dfp_publisher_id: @@ -101,9 +110,11 @@ dfp_plugin: dfp_topic_list_top_code: client: true default: '' + max: 50 dfp_mobile_topic_list_top_code: client: true default: '' + max: 50 dfp_topic_list_top_ad_sizes: client: true default: '728*90 - leaderboard' @@ -130,9 +141,11 @@ dfp_plugin: dfp_topic_above_post_stream_code: client: true default: '' + max: 50 dfp_mobile_topic_above_post_stream_code: client: true default: '' + max: 50 dfp_topic_above_post_stream_ad_sizes: client: true default: '728*90 - leaderboard' @@ -159,9 +172,11 @@ dfp_plugin: dfp_topic_above_suggested_code: client: true default: '' + max: 50 dfp_mobile_topic_above_suggested_code: client: true default: '' + max: 50 dfp_topic_above_suggested_ad_sizes: client: true default: '728*90 - leaderboard' @@ -185,12 +200,15 @@ dfp_plugin: default: '' type: value_list client: true + max: 50 dfp_post_bottom_code: client: true default: '' + max: 50 dfp_mobile_post_bottom_code: client: true default: '' + max: 50 dfp_nth_post_code: client: true default: '' From ef45e3290e14b76e3ce0a9f287d0ae6de0d9279b Mon Sep 17 00:00:00 2001 From: Neil Lalonde Date: Mon, 4 Apr 2016 16:51:34 -0400 Subject: [PATCH 2/2] Don't hard-code center justify of AdSense ads. Let position be customized with CSS. --- assets/javascripts/discourse/components/google-adsense.js.es6 | 4 ++-- .../discourse/templates/components/google-adsense.hbs | 4 ++-- plugin.rb | 4 ++++ 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/assets/javascripts/discourse/components/google-adsense.js.es6 b/assets/javascripts/discourse/components/google-adsense.js.es6 index 31d8fa0..a349ff4 100644 --- a/assets/javascripts/discourse/components/google-adsense.js.es6 +++ b/assets/javascripts/discourse/components/google-adsense.js.es6 @@ -115,7 +115,7 @@ export default Ember.Component.extend({ }, adWrapperStyle: function() { - return `width: ${this.get('ad_width')}px; height: ${this.get('ad_height')}px; margin:0 auto;`.htmlSafe(); + return `width: ${this.get('ad_width')}px; height: ${this.get('ad_height')}px;`.htmlSafe(); }.property('ad_width', 'ad_height'), adInsStyle: function() { @@ -123,7 +123,7 @@ export default Ember.Component.extend({ }.property('adWrapperStyle'), adWrapperStyleMobile: function() { - return `width: ${this.get('ad_mobile_width')}px; height: ${this.get('ad_mobile_height')}px; margin:0 auto;`.htmlSafe(); + return `width: ${this.get('ad_mobile_width')}px; height: ${this.get('ad_mobile_height')}px;`.htmlSafe(); }.property('ad_mobile_width', 'ad_mobile_height'), adTitleStyleMobile: function() { diff --git a/assets/javascripts/discourse/templates/components/google-adsense.hbs b/assets/javascripts/discourse/templates/components/google-adsense.hbs index 83ca346..7d81e18 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}} {{#if site.mobileView}}

ADVERTISEMENT

-
+
{{else}}

ADVERTISEMENT

-
+