Isaac Janzen 554f03f3da
FEATURE: Add group and category restrictions to house ads (#205)
# Description

This PR adds the ability to apply **group** and **category** restrictions to a **house ad**.

# What is included
- In order to get the group and category selectors to work within `admin/assets/javascripts/discourse/controllers/admin-plugins-house-ads-show.js` I needed to modernize the file. 
- I dropped the `bufferedProperty` implementation in favor of a vanilla ember approach
- I added `category_ids` and `group_ids` to our house ads model
- I added tests for group / category restrictions
- I added a preview button to display the house ad
- `/site.json` would return a object called `house_creatives` and a list of key value pairs that matched the ad name with the html, like so:
```js
{ AD_KEY: ad.html }
```
I need access to the category ids on the client to conditionally render the house ads so the new format will be: 
```js
{ AD_KEY: { html: ad.html, category_ids: ad.category_ids } }
```

# Screenshots
<img width="658" alt="Screenshot 2024-04-08 at 2 39 22 PM" src="https://github.com/discourse/discourse-adplugin/assets/50783505/b44b386d-65a1-4a2a-a487-d735b13357dd">

# Preview Video

https://github.com/discourse/discourse-adplugin/assets/50783505/6d0d8253-afef-4e15-b6fc-c6f696efd169
2024-04-09 11:54:11 -06:00

48 lines
2.0 KiB
YAML
Executable File

en:
js:
adplugin:
advertisement_label: "ADVERTISEMENT"
admin_js:
admin:
site_settings:
categories:
ad_plugin: "Ad Plugin"
dfp_plugin: "DFP/Ad Manager"
adsense_plugin: "AdSense"
amazon_plugin: "Amazon"
carbonads_plugin: "Carbon Ads"
adbutler_plugin: "AdButler"
adplugin:
house_ads:
title: "House Ads"
new: "New"
settings: "Settings"
new_name: "New House Ad"
save: "Save"
delete: "Delete"
description: "Define your own ads and where they should be displayed."
get_started: "Start by creating a new ad."
filter_placeholder: "Select ads..."
more_settings: "More Settings"
show_to_anons: "Show to anonymous users"
show_to_logged_in_users: "Show to logged in users"
category_chooser_description: "Choose the categories where this ad should be displayed or leave empty to show the ad everywhere. The `no_ads_for_categories` site setting has priority over this setting."
group_chooser_description: "Choose the groups that can view this ad or leave empty to show the ad to all signed in users."
preview: "Preview"
topic_list_top:
title: "Topic list top ads"
description: "Ads to show at the top of topic list pages."
topic_above_post_stream:
title: "Topic above post stream"
description: "Ads to show above the title of a topic on the topic page."
topic_above_suggested:
title: "Topic above suggested"
description: "Ads to show after the last post in a topic, above the suggested topics."
post_bottom:
title: "Between posts"
description: "Ads to show in between posts, after every N posts."
topic_list_between:
title: "Between topics"
description: "Ads to show in between topics, after every N topics."