Dropdown boxes added for each location

This commit is contained in:
Sarah Ni 2015-08-10 14:04:21 +10:00
parent 9aa1bb3f4a
commit 013d6bc363
7 changed files with 87 additions and 86 deletions

BIN
.DS_Store vendored

Binary file not shown.

View File

@ -7,6 +7,16 @@ var _loaded = false,
_promise = null; _promise = null;
function splitWidthInt(value) {
var str = value.substring(0, 3);
return str.trim();
}
function splitHeightInt(value) {
var str = value.substring(4, 7);
return str.trim();
}
function loadGoogle(settings) { function loadGoogle(settings) {
if (_loaded) { if (_loaded) {
return Ember.RSVP.resolve(); return Ember.RSVP.resolve();
@ -26,17 +36,17 @@ function loadGoogle(settings) {
// Define our ad units - extend for mobile view. // Define our ad units - extend for mobile view.
googletag.cmd.push(function() { googletag.cmd.push(function() {
if (settings.dfp_topic_list_top_code && !settings.dfp_show_topic_list_top) { if (settings.dfp_topic_list_top_code && !settings.dfp_show_topic_list_top && settings.topic_list_top_ad_sizes) {
googletag.defineSlot(settings.dfp_topic_list_top_code, [parseInt(settings.dfp_size_topic_list_top_width_code), parseInt(settings.dfp_size_topic_list_top_height_code)], 'div-gpt-ad-topic-list-top').addService(googletag.pubads()); googletag.defineSlot(settings.dfp_topic_list_top_code, [parseInt(splitWidthInt(settings.topic_list_top_ad_sizes)), parseInt(splitHeightInt(settings.topic_list_top_ad_sizes))], 'div-gpt-ad-topic-list-top').addService(googletag.pubads());
} }
if (settings.dfp_topic_above_post_stream_code && !settings.dfp_show_topic_above_post_stream) { if (settings.dfp_topic_above_post_stream_code && !settings.dfp_show_topic_above_post_stream && settings.topic_above_post_stream_ad_sizes) {
googletag.defineSlot(settings.dfp_topic_above_post_stream_code, [parseInt(settings.dfp_size_topic_above_post_stream_width_code), parseInt(settings.dfp_size_topic_above_post_stream_height_code)], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads()); googletag.defineSlot(settings.dfp_topic_above_post_stream_code, [parseInt(splitWidthInt(settings.topic_above_post_stream_ad_sizes)), parseInt(splitHeightInt(settings.topic_above_post_stream_ad_sizes))], 'div-gpt-ad-topic-above-post-stream').addService(googletag.pubads());
} }
if (settings.dfp_topic_above_suggested_code && !settings.dfp_show_topic_above_suggested) { if (settings.dfp_topic_above_suggested_code && !settings.dfp_show_topic_above_suggested && settings.topic_above_suggested_ad_sizes) {
googletag.defineSlot(settings.dfp_topic_above_suggested_code, [parseInt(settings.dfp_size_topic_above_suggested_width_code), parseInt(settings.dfp_size_topic_above_suggested_height_code)], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads()); googletag.defineSlot(settings.dfp_topic_above_suggested_code, [parseInt(splitWidthInt(settings.topic_above_suggested_ad_sizes)), parseInt(splitHeightInt(settings.topic_above_suggested_ad_sizes))], 'div-gpt-ad-topic-above-suggested').addService(googletag.pubads());
} }
if (settings.dfp_post_bottom_code && !settings.dfp_show_post_bottom) { if (settings.dfp_post_bottom_code && !settings.dfp_show_post_bottom && settings.post_bottom_ad_sizes) {
googletag.defineSlot(settings.dfp_post_bottom_code, [parseInt(settings.dfp_size_post_bottom_width_code), parseInt(settings.dfp_size_post_bottom_height_code)], 'div-gpt-ad-post-bottom').addService(googletag.pubads()); googletag.defineSlot(settings.dfp_post_bottom_code, [parseInt(splitWidthInt(settings.post_bottom_ad_sizes)), parseInt(splitHeightInt(settings.post_bottom_ad_sizes))], 'div-gpt-ad-post-bottom').addService(googletag.pubads());
} }
googletag.pubads().enableSingleRequest(); googletag.pubads().enableSingleRequest();
googletag.enableServices(); googletag.enableServices();

View File

@ -1,3 +1,3 @@
{{#if postSpecificCount}} {{#if postSpecificCount}}
{{google-dfp-ad placement="post-bottom"}} {{google-dfp-ad placement="post-bottom"}}
{{/if}} {{/if}}

View File

@ -1,20 +1,20 @@
.google-dfp-ad { .discourse-google-dfp {
padding: 3px; padding: 3px;
margin-bottom: 10px; margin-bottom: 10px;
clear: both; clear: both;
} }
.google-dfp-ad .dfp-ad-unit { .discourse-google-dfp .dfp-ad-unit {
margin: 0 auto; margin: 0 auto;
} }
.google-dfp-ad .google-dfp-ad-label { .discourse-google-dfp .google-dfp-ad-label {
width: 728px; width: 728px;
margin: 0 auto; margin: 0 auto;
} }
.google-dfp-ad .google-dfp-ad-label h2 { .discourse-google-dfp .google-dfp-ad-label h2 {
margin: 4px 0 !important; margin: 4px 0 !important;
color: #858a8c; color: #858a8c;
text-transform: uppercase; text-transform: uppercase;

View File

@ -2,28 +2,14 @@ en:
site_settings: site_settings:
dfp_show_topic_list_top: "Disable topic_list_top ad" dfp_show_topic_list_top: "Disable topic_list_top ad"
dfp_topic_list_top_code: "Show leaderboard ad above topic lists." dfp_topic_list_top_code: "Show leaderboard ad above topic lists."
topic_list_top_ad_sizes: "Choose your ad size"
dfp_show_topic_above_post_stream: "Disable topic_above_post_stream ad" dfp_show_topic_above_post_stream: "Disable topic_above_post_stream ad"
dfp_topic_above_post_stream_code: "Show leaderboard ad above post stream" dfp_topic_above_post_stream_code: "Show leaderboard ad above post stream"
topic_above_post_stream_ad_sizes: "Choose your ad size"
dfp_show_topic_above_suggested: "Disable topic_above_suggested ad" dfp_show_topic_above_suggested: "Disable topic_above_suggested ad"
dfp_topic_above_suggested_code: "Show leaderboard ad above suggested topics" dfp_topic_above_suggested_code: "Show leaderboard ad above suggested topics"
topic_above_suggested_ad_sizes: "Choose your ad size"
dfp_show_post_bottom: "Disable post_bottom ad" dfp_show_post_bottom: "Disable post_bottom ad"
dfp_post_bottom_code: "Show leaderboard ad post_bottom topics" dfp_post_bottom_code: "Show leaderboard ad post_bottom topics"
dfp_size_topic_list_top_width_code: "Put your ad topic list top size width!"
dfp_size_topic_list_top_height_code: "Put your ad topic above post stream size height!"
dfp_size_topic_above_post_stream_width_code: "Put your ad topic above post stream size width!"
dfp_size_topic_above_post_stream_height_code: "Put your ad topic list top size height!"
dfp_size_topic_above_suggested_width_code: "Put your ad topic above suggested size width!"
dfp_size_topic_above_suggested_height_code: "Put your ad topic above suggested size height!"
dfp_size_post_bottom_width_code: "Put your ad post bottom size width!"
dfp_size_post_bottom_height_code: "Put your ad post bottom size height!"
dfp_nth_post_code: "Choose the Nth position for your ad to show" dfp_nth_post_code: "Choose the Nth position for your ad to show"
dfp_show_size_1_example: "leaderboard 728x90" post_bottom_ad_sizes: "Choose your ad size"
dfp_show_size_2_example: "large rectangle 336x280"
dfp_show_size_3_example: "medium rectangle 300x250"
dfp_show_size_4_example: "large leaderboard 970x90"
dfp_show_size_5_example: "banner 468x60"
dfp_show_size_6_example: "half banner 234x60"
dfp_show_size_7_example: "button 125x125"
dfp_show_size_8_example: "small rectangle 180x150"
dfp_show_size_9_example: "small square 200x200"
dfp_show_size_10_example: "square 250x250"

View File

@ -2,82 +2,87 @@ ad_plugin:
dfp_topic_list_top_code: dfp_topic_list_top_code:
client: true client: true
default: '' default: ''
dfp_size_topic_list_top_width_code:
client: true
default: ''
dfp_size_topic_list_top_height_code:
client: true
default: ''
dfp_show_topic_list_top: dfp_show_topic_list_top:
client: true client: true
default: false default: false
dfp_topic_above_post_stream_code: dfp_topic_above_post_stream_code:
client: true client: true
default: '' default: ''
dfp_size_topic_above_post_stream_width_code:
client: true
default: ''
dfp_size_topic_above_post_stream_height_code:
client: true
default: ''
dfp_show_topic_above_post_stream: dfp_show_topic_above_post_stream:
client: true client: true
default: false default: false
dfp_topic_above_suggested_code: dfp_topic_above_suggested_code:
client: true client: true
default: '' default: ''
dfp_size_topic_above_suggested_width_code:
client: true
default: ''
dfp_size_topic_above_suggested_height_code:
client: true
default: ''
dfp_show_topic_above_suggested: dfp_show_topic_above_suggested:
client: true client: true
default: false default: false
dfp_post_bottom_code: dfp_post_bottom_code:
client: true client: true
default: '' default: ''
dfp_size_post_bottom_width_code:
client: true
default: ''
dfp_size_post_bottom_height_code:
client: true
default: ''
dfp_show_post_bottom: dfp_show_post_bottom:
client: true client: true
default: false default: false
dfp_nth_post_code: dfp_nth_post_code:
client: true client: true
default: '' default: ''
dfp_show_size_1_example: topic_list_top_ad_sizes:
client: true client: true
default: false default: '728*90 - leaderboard'
dfp_show_size_2_example: type: enum
choices:
- 728*90 - leaderboard
- 336*280 - large rectangle
- 300*250 - medium rectangle
- 970*90 - large leaderboard
- 468*60 - banner
- 234*60 - half banner
- 125*125 - button
- 180*150 - small rectangle
- 200*200 - small square
- 250*250 - square
topic_above_post_stream_ad_sizes:
client: true client: true
default: false default: '728*90 - leaderboard'
dfp_show_size_3_example: type: enum
choices:
- 728*90 - leaderboard
- 336*280 - large rectangle
- 300*250 - medium rectangle
- 970*90 - large leaderboard
- 468*60 - banner
- 234*60 - half banner
- 125*125 - button
- 180*150 - small rectangle
- 200*200 - small square
- 250*250 - square
topic_above_suggested_ad_sizes:
client: true client: true
default: false default: '728*90 - leaderboard'
dfp_show_size_4_example: type: enum
choices:
- 728*90 - leaderboard
- 336*280 - large rectangle
- 300*250 - medium rectangle
- 970*90 - large leaderboard
- 468*60 - banner
- 234*60 - half banner
- 125*125 - button
- 180*150 - small rectangle
- 200*200 - small square
- 250*250 - square
post_bottom_ad_sizes:
client: true client: true
default: false default: '728*90 - leaderboard'
dfp_show_size_5_example: type: enum
client: true choices:
default: false - 728*90 - leaderboard
dfp_show_size_6_example: - 336*280 - large rectangle
client: true - 300*250 - medium rectangle
default: false - 970*90 - large leaderboard
dfp_show_size_7_example: - 468*60 - banner
client: true - 234*60 - half banner
default: false - 125*125 - button
dfp_show_size_8_example: - 180*150 - small rectangle
client: true - 200*200 - small square
default: false - 250*250 - square
dfp_show_size_9_example:
client: true
default: false
dfp_show_size_10_example:
client: true
default: false

View File

@ -5,22 +5,22 @@
register_css <<CSS register_css <<CSS
.google-dfp-ad { .discourse-google-dfp {
padding: 3px; padding: 3px;
margin-bottom: 10px; margin-bottom: 10px;
clear: both; clear: both;
} }
.google-dfp-ad .dfp-ad-unit { .discourse-google-dfp .dfp-ad-unit {
margin: 0 auto; margin: 0 auto;
} }
.google-dfp-ad .google-dfp-ad-label { .discourse-google-dfp .google-dfp-ad-label {
width: 728px; width: 728px;
margin: 0 auto; margin: 0 auto;
} }
.google-dfp-ad .google-dfp-ad-label h2 { .discourse-google-dfp .google-dfp-ad-label h2 {
margin: 4px 0 !important; margin: 4px 0 !important;
color: #858a8c; color: #858a8c;
text-transform: uppercase; text-transform: uppercase;