htmlSafe and clean up

This commit is contained in:
Sarah Ni 2015-08-19 11:44:14 +10:00
parent 2237164075
commit fbb27c6060
3 changed files with 9 additions and 8 deletions

View File

@ -6,7 +6,6 @@ var const_height = '';
var _loaded = false,
_promise = null;
function splitWidthInt(value) {
var str = value.substring(0, 3);
return str.trim();
@ -78,6 +77,10 @@ export default Ember.Component.extend({
return "div-gpt-ad-" + this.get('placement');
}.property('placement'),
adWrapperStyle: function() {
return `width: ${this.get('const_width')}px; height: ${this.get('const_height')}px;`.htmlSafe();
}.property('const_width', 'const_height'),
_initGoogleDFP: function() {
var self = this;
loadGoogle(this.siteSettings).then(function() {

View File

@ -1,10 +1,8 @@
<div class="google-dfp-ad-label"><h2>Google Ad Plugin Display</h2></div>
<div id={{divId}} style='width: {{const_width}}px; height: {{const_height}}px' class="dfp-ad-unit" align=center>
<div id={{divId}} style={{adWrapperStyle}} class="dfp-ad-unit" align=center>
{{#if loadedGoogletag}}
<script type='text/javascript'>
googletag.cmd.push(function() { googletag.display('{{divId}}'); });
</script>
{{/if}}
</div>

View File

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