Updates to carbonads-ad
This commit is contained in:
		
							parent
							
								
									881a8e5d4c
								
							
						
					
					
						commit
						8ef02aa351
					
				|  | @ -1,3 +1,4 @@ | |||
| import AdComponent from "discourse/plugins/discourse-adplugin/discourse/components/ad_component"; | ||||
| import { | ||||
|   default as computed, | ||||
|   observes | ||||
|  | @ -7,21 +8,20 @@ const currentUser = Discourse.User.current(), | |||
|   serve_id = Discourse.SiteSettings.carbonads_serve_id, | ||||
|   placement = Discourse.SiteSettings.carbonads_placement; | ||||
| 
 | ||||
| export default Ember.Component.extend({ | ||||
|   init: function() { | ||||
| export default AdComponent.extend({ | ||||
|   init() { | ||||
|     this.set("serve_id", serve_id); | ||||
|     this.set("placement", placement); | ||||
|     this._super(); | ||||
|   }, | ||||
| 
 | ||||
|   @computed("serve_id", "placement") | ||||
|   url: function() { | ||||
|     return (`//cdn.carbonads.com/carbon.js?serve=${this.get("serve_id")}&placement=${this.get("placement")}`).htmlSafe(); | ||||
|   url(serveId, placement) { | ||||
|     return `//cdn.carbonads.com/carbon.js?serve=${serveId}&placement=${placement}`.htmlSafe(); | ||||
|   }, | ||||
| 
 | ||||
| 
 | ||||
|   @computed("trust_level") | ||||
|   checkTrustLevels: function() { | ||||
|   @computed() | ||||
|   showToTrustLevel() { | ||||
|     return !( | ||||
|       currentUser && | ||||
|       currentUser.get("trust_level") > | ||||
|  | @ -29,8 +29,8 @@ export default Ember.Component.extend({ | |||
|     ); | ||||
|   }, | ||||
| 
 | ||||
|   @computed("checkTrustLevels") | ||||
|   showAd: function(checkTrustLevels) { | ||||
|     return placement && serve_id && checkTrustLevels; | ||||
|   @computed("showToTrustLevel", "showToGroups") | ||||
|   showAd(showToTrustLevel, showToGroups) { | ||||
|     return placement && serve_id && showToTrustLevel && showToGroups; | ||||
|   } | ||||
| }); | ||||
|  |  | |||
		Loading…
	
		Reference in New Issue