186 Commits
Author SHA1 Message Date
David Taylor 3ca4398bad DEV: Restructure file locations
- Colocate components / connectors
- Move admin UI files to `admin/assets` so they are only served to admins
2023-11-07 18:14:24 +00:00
David Taylor dbafb3b277 DEV: Update tests to use qunit-dom 2023-11-07 18:14:12 +00:00
David Taylor 86ef7da2eb DEV: Apply eslint --fix 2023-11-07 18:14:12 +00:00
David Taylor 32a43a850f DEV: Update linting config 2023-11-07 18:14:12 +00:00
dependabot[bot] 8931e2a07e Bump @babel/traverse from 7.20.10 to 7.23.2 (#182)
Bumps [@babel/traverse](https://github.com/babel/babel/tree/HEAD/packages/babel-traverse) from 7.20.10 to 7.23.2.
- [Release notes](https://github.com/babel/babel/releases)
- [Changelog](https://github.com/babel/babel/blob/main/CHANGELOG.md)
- [Commits](https://github.com/babel/babel/commits/v7.23.2/packages/babel-traverse)

---
updated-dependencies:
- dependency-name: "@babel/traverse"
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-10-18 18:26:49 +02:00
Discourse Translator Bot 44f49725f8 Update translations (#181) 2023-08-29 15:50:11 +02:00
Discourse Translator Bot 3a89fbdd9a Update translations (#180) 2023-08-23 09:28:54 +02:00
Penar Musaraj 8f51e0e4c0 DEV: Pin plugin for Discourse 3.1 stable (#179) 2023-08-22 13:45:25 -05:00
Discourse Translator Bot 30c49eb50d Update translations (#178) 2023-08-08 15:42:08 +02:00
dependabot[bot] 8cb9628f0d Bump word-wrap from 1.2.3 to 1.2.4 (#177)
Bumps [word-wrap](https://github.com/jonschlinkert/word-wrap) from 1.2.3 to 1.2.4.
- [Release notes](https://github.com/jonschlinkert/word-wrap/releases)
- [Commits](https://github.com/jonschlinkert/word-wrap/compare/1.2.3...1.2.4)

---
updated-dependencies:
- dependency-name: word-wrap
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-19 01:00:58 +02:00
dependabot[bot] b4aa9a05be Bump semver from 6.3.0 to 6.3.1 (#176)
Bumps [semver](https://github.com/npm/node-semver) from 6.3.0 to 6.3.1.
- [Release notes](https://github.com/npm/node-semver/releases)
- [Changelog](https://github.com/npm/node-semver/blob/v6.3.1/CHANGELOG.md)
- [Commits](https://github.com/npm/node-semver/compare/v6.3.0...v6.3.1)

---
updated-dependencies:
- dependency-name: semver
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2023-07-11 10:37:40 +02:00
Discourse Translator Bot db0097b8f8 Update translations (#175) 2023-07-04 18:13:14 +02:00
Discourse Translator Bot bade14daa0 Update translations (#174) 2023-06-27 16:39:17 +02:00
Isaac Janzen 743478d593 DEV: Use angle bracket syntax (#172) 2023-05-26 09:20:47 -05:00
Kris 58205cc9ac UX: introduce min-height for responsive ads (#170) 2023-04-25 16:19:48 -04:00
Discourse Translator Bot d3005f26af Update translations (#169) 2023-04-11 15:44:40 +02:00
Osama Sayegh c2057a5056 FEATURE: Add per-ad visibility settings for anons and logged-in users (#168)
This commit adds 2 new settings to house ads to control whether an ad is shown to anonymous users and logged in users. Existing ads that were created before this feature will default to true for both settings; i.e., they will remain to be visible to both anonymous and logged-in users, but it will be possible to change the settings. Turning off both settings will effectively disable the ad completely.
2023-04-07 17:56:22 +03:00
Discourse Translator Bot bfd4438b97 Update translations (#167) 2023-02-21 17:11:00 +01:00
Rishabh 4d2ec950d0 Ensure README images are pointing to discourse/gh-owned repositories (#166) 2023-01-25 17:30:08 +05:30
discoursebotanddiscoursebuild 165ecdefc5 DEV: Update CI workflows (#165)
Co-authored-by: discoursebuild <[email protected]>
2023-01-10 18:02:36 +00:00
David Taylor c519b4bc92 DEV: Update eslint-config-discourse, use prettier for hbs (#163) 2023-01-04 13:34:08 +01:00
Discourse Translator Bot dc48bea931 Update translations (#164) 2022-12-30 17:49:25 +01:00
David Taylor c73ac98748 DEV: Introduce syntax_tree for ruby formatting (#161) 2022-12-29 13:29:26 +01:00
Discourse Translator Bot ff6b767796 Update translations (#160) 2022-12-28 13:31:54 +01:00
Discourse Translator Bot 116795aff3 Update translations (#159) 2022-11-29 15:35:21 +01:00
dependabot[bot] fd6ac11ee9 Bump minimatch from 3.0.4 to 3.1.2 (#157)
Bumps [minimatch](https://github.com/isaacs/minimatch) from 3.0.4 to 3.1.2.
- [Release notes](https://github.com/isaacs/minimatch/releases)
- [Commits](https://github.com/isaacs/minimatch/compare/v3.0.4...v3.1.2)

---
updated-dependencies:
- dependency-name: minimatch
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-11-27 17:33:42 +01:00
Discourse Translator Bot 203eedb915 Update translations (#156) 2022-11-16 11:36:55 +01:00
discoursebotanddiscoursebuild 8ac32a06c3 DEV: Update CI workflows (#155)
Co-authored-by: discoursebuild <[email protected]>
2022-11-07 12:45:46 -06:00
Discourse Translator Bot f52ac0775f Update translations (#154) 2022-11-02 15:12:51 +01:00
Penar Musaraj fa2ec23ebc DEV: Use popupAjaxError instead of bootbox (#153) 2022-10-18 13:58:55 -04:00
Discourse Translator Bot f7d9d13de8 Update translations (#152) 2022-10-05 15:31:18 +02:00
David Taylor a647813ce7 DEV: Bump rubocop-discourse (#151)
* DEV: Bump rubocop-discourse

* Fix rubocop violations
2022-10-03 21:36:57 +02:00
Discourse Translator Bot a570a46ad2 Update translations (#150) 2022-09-27 19:07:32 +02:00
Discourse Translator Bot 3b50a509f2 Update translations (#149) 2022-07-26 15:20:46 +02:00
Roman Rizzi 4940d0ea19 FIX: Ensure we won't render the connector if there are no ads (#148) 2022-07-14 15:58:29 -03:00
Roman Rizzi d9b739f803 FIX: Don't render the connector when we shouldn't display an ad in the topic list item. (#146)
We expose the ad-slot logic to determine which ads are potentially available for each slot and don't render the connector when there are none. Leaking the component logic is not ideal, but I don't see a better solution given the
current design.
2022-07-12 16:13:18 -03:00
Discourse Translator Bot a4aa6332bb Update translations (#147) 2022-07-12 17:25:54 +02:00
Roman Rizzi 469771db1d DEV: Skip assertion temporarily. (#145)
The code-review plugin overrides the core's topic-list template, which makes all the connectors for the outlets there stop working. I'm temporarily skipping this assertion until we remove the override.
2022-07-07 15:07:16 -03:00
5901a52dbc FEATURE: support placing ads between topic list for house ads (#143)
* init

* more

* Pass td and colspan to component

* various fixes for house ads between n topics and add a test

* Make adComponents condition easier to read

Co-authored-by: Jordan Vidrine <[email protected]>
Co-authored-by: Penar Musaraj <[email protected]>
Co-authored-by: romanrizzi <[email protected]>
2022-07-07 08:53:29 -03:00
Discourse Translator Bot c27f5717e4 Update translations (#144) 2022-07-06 09:14:50 +02:00
Discourse Translator Bot a514c7aee2 Update translations (#142) 2022-06-21 15:25:57 +02:00
discoursebotanddiscoursebuild 3f951116fa DEV: Update CI workflows (#141)
Co-authored-by: discoursebuild <[email protected]>
2022-06-17 21:32:32 +02:00
Isaac Janzen fb73dda584 DEV: Remove 'htmlSafe' string prototype extensions (#140)
Context: https://deprecations.emberjs.com/v3.x/#toc_ember-string-prototype_extensions
2022-06-01 11:37:01 -05:00
discoursebotanddiscoursebuild b9ac5516bf DEV: Update CI workflows (#139)
Co-authored-by: discoursebuild <[email protected]>
2022-05-23 16:58:32 +02:00
dependabot[bot] e56197505f Bump async from 2.6.3 to 2.6.4 (#136)
Bumps [async](https://github.com/caolan/async) from 2.6.3 to 2.6.4.
- [Release notes](https://github.com/caolan/async/releases)
- [Changelog](https://github.com/caolan/async/blob/v2.6.4/CHANGELOG.md)
- [Commits](https://github.com/caolan/async/compare/v2.6.3...v2.6.4)

---
updated-dependencies:
- dependency-name: async
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-29 18:02:21 +02:00
dependabot[bot] 208b56b130 Bump ansi-regex from 4.1.0 to 4.1.1 (#135)
Bumps [ansi-regex](https://github.com/chalk/ansi-regex) from 4.1.0 to 4.1.1.
- [Release notes](https://github.com/chalk/ansi-regex/releases)
- [Commits](https://github.com/chalk/ansi-regex/compare/v4.1.0...v4.1.1)

---
updated-dependencies:
- dependency-name: ansi-regex
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-12 13:53:32 +02:00
dependabot[bot] 898de0c9c8 Bump minimist from 1.2.5 to 1.2.6 (#134)
Bumps [minimist](https://github.com/substack/minimist) from 1.2.5 to 1.2.6.
- [Release notes](https://github.com/substack/minimist/releases)
- [Commits](https://github.com/substack/minimist/compare/1.2.5...1.2.6)

---
updated-dependencies:
- dependency-name: minimist
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2022-04-12 13:51:42 +02:00
discoursebotanddiscoursebuild 8ca041846a DEV: Update CI workflows (#133)
Co-authored-by: discoursebuild <[email protected]>
2022-03-22 14:01:25 +01:00
Jarek Radosz 7e2a490b67 DEV: Fix imports (#132) 2022-03-06 19:52:19 +01:00
Jarek Radosz c788b7bf1f DEV: Lose the es6 suffix (#131) 2022-03-05 17:23:41 +01:00
Discourse Translator Bot 03ec825e8e Update translations (#130) 2022-02-14 15:20:25 +11:00
David Taylor 912e68e587 DEV: Import test helpers 2022-01-25 14:41:53 +00:00
discoursebuild 9be37644d8 DEV: Update CI workflows 2022-01-25 14:41:53 +00:00
Discourse Translator Bot 58085298f0 Update translations (#128) 2022-01-11 14:20:49 +01:00
Andrei Prigorshnev 62a4eff705 DEV: migrate routes to the new @action pattern (#126) 2022-01-06 15:16:37 +04:00
Discourse Translator Bot 0d8e33c661 Update translations (#127) 2022-01-04 17:38:54 +01:00
Discourse Translator Bot 713d2951e7 Update translations (#125) 2021-12-28 14:13:16 +01:00
Discourse Translator Bot 0983b26180 Update translations (#124) 2021-12-21 10:10:58 -05:00
discoursebotanddavidtaylorhq 8c3f2b691f DEV: Update CI workflows (#121)
Co-authored-by: davidtaylorhq <[email protected]>
2021-12-16 16:16:25 +00:00
Jarek Radosz d5cf5776d9 DEV: Fix deprecated imports (#120) 2021-11-12 19:13:46 +01:00
Martin Brennan 55045bba3c DEV: Update code for eslint object-shorthand-rule. See https://github.com/discourse/eslint-config-discourse/commit/4f7aba06c03fdd22bb26669aeb8ed4af3127c409 (#119) 2021-11-10 11:58:31 +11:00
tshenry f2171a51c3 FIX: use imports instead of Discourse global (#118)
Replaces `Discourse.Site` with the imported equivalent and `Discourse.SiteSettings` with `this.siteSettings`
2021-09-21 11:27:10 -07:00
discoursebotandCvX a01058f041 DEV: Update CI workflows (#117)
Co-authored-by: CvX <[email protected]>
2021-09-15 15:39:13 +02:00
dependabot[bot] 1d47138cb7 Bump path-parse from 1.0.6 to 1.0.7 (#116)
Bumps [path-parse](https://github.com/jbgutierrez/path-parse) from 1.0.6 to 1.0.7.
- [Release notes](https://github.com/jbgutierrez/path-parse/releases)
- [Commits](https://github.com/jbgutierrez/path-parse/commits/v1.0.7)

---
updated-dependencies:
- dependency-name: path-parse
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-08-13 00:49:51 +02:00
Discourse Translator Bot d7c127cc48 Update translations (#115) 2021-08-04 14:14:07 +02:00
discoursebotanddavidtaylorhq f4247ab7d2 DEV: Update CI workflows (#114)
Co-authored-by: davidtaylorhq <[email protected]>
2021-07-02 17:06:52 +02:00
Penar Musaraj 190aa503ce DEV: SCSS cleanup 2021-06-23 21:59:53 -04:00
dependabot[bot] d74deaad20 Bump glob-parent from 5.1.1 to 5.1.2 (#113)
Bumps [glob-parent](https://github.com/gulpjs/glob-parent) from 5.1.1 to 5.1.2.
- [Release notes](https://github.com/gulpjs/glob-parent/releases)
- [Changelog](https://github.com/gulpjs/glob-parent/blob/main/CHANGELOG.md)
- [Commits](https://github.com/gulpjs/glob-parent/compare/v5.1.1...v5.1.2)

---
updated-dependencies:
- dependency-name: glob-parent
  dependency-type: indirect
...

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-06-12 13:55:12 +02:00
Penar Musaraj c25c041f98 DEV: Remove SCSS color vars fallbacks (#112) 2021-05-12 16:16:40 -04:00
dependabot[bot] 43189e0f56 Bump lodash from 4.17.20 to 4.17.21 (#111)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.20 to 4.17.21.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.20...4.17.21)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-10 10:22:25 +02:00
dependabot[bot] a43a5d2edc Bump handlebars from 4.7.6 to 4.7.7 (#110)
Bumps [handlebars](https://github.com/wycats/handlebars.js) from 4.7.6 to 4.7.7.
- [Release notes](https://github.com/wycats/handlebars.js/releases)
- [Changelog](https://github.com/handlebars-lang/handlebars.js/blob/master/release-notes.md)
- [Commits](https://github.com/wycats/handlebars.js/compare/v4.7.6...v4.7.7)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-10 10:48:36 +10:00
Discourse Translator Bot 1741deecfe Update translations (#109) 2021-05-04 15:18:24 +02:00
dependabot[bot] 8a3ca77a60 Bump rexml from 3.2.4 to 3.2.5 (#108)
Bumps [rexml](https://github.com/ruby/rexml) from 3.2.4 to 3.2.5.
- [Release notes](https://github.com/ruby/rexml/releases)
- [Changelog](https://github.com/ruby/rexml/blob/master/NEWS.md)
- [Commits](https://github.com/ruby/rexml/compare/v3.2.4...v3.2.5)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-05-02 17:09:36 +02:00
Discourse Translator Bot 9e30a576da Update translations (#107) 2021-04-20 15:31:55 +02:00
dependabot[bot] fbdff69540 Bump y18n from 4.0.0 to 4.0.1 (#106)
Bumps [y18n](https://github.com/yargs/y18n) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/yargs/y18n/releases)
- [Changelog](https://github.com/yargs/y18n/blob/master/CHANGELOG.md)
- [Commits](https://github.com/yargs/y18n/commits)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2021-04-01 10:15:23 +02:00
Justin DiRose c4e88ba82c Add missing link to meta topic in README (#105) 2021-02-23 19:15:42 +01:00
discoursebotandCvX 7f90994154 DEV: Update CI workflows (#104)
Co-authored-by: CvX <[email protected]>
2021-02-11 17:12:28 +01:00
Jarek Radosz a16ed5f0bf UX: Add title to iframe elements
Fixes template linting errors
2021-02-09 20:03:39 +01:00
CvX d3730993a6 DEV: Update CI workflows 2021-02-09 20:03:39 +01:00
Discourse Translator Bot 4ac7779cc9 Update translations (#102) 2021-02-09 14:52:34 +01:00
Joffrey JAFFEUX 6438000ed4 DEV: prettier 2.2.1 (#101) 2021-01-27 10:36:36 +01:00
Discourse Translator Bot 1654937788 Update translations (#100) 2021-01-26 14:51:33 +01:00
discoursebotandjustindirose 112fe8f4cb DEV: Update CI workflows (#98)
* DEV: Update CI workflows

* DEV: Fix linting

Co-authored-by: justindirose <[email protected]>
2021-01-04 14:42:25 -06:00
Roman Rizzi 4bf6420b91 REFACTOR: Use the new format for acceptance tests. (#97) 2020-12-29 13:01:26 -03:00
Discourse Translator Bot 4131f8403a Update translations (#96) 2020-11-24 17:24:04 +01:00
Discourse Translator Bot 2390a9d1d9 Update translations (#95) 2020-11-03 10:15:25 -05:00
Discourse CI 7b912d9252 DEV: Update CI workflows 2020-10-14 16:27:46 +00:00
jjaffeux 9adaef17cc Revert "DEV: enforces no-var (#94)"
This reverts commit 9ad0133624.
2020-10-13 15:42:21 +02:00
Joffrey JAFFEUX 9ad0133624 DEV: enforces no-var (#94) 2020-10-13 11:40:33 +02:00
Discourse CI e692fdf64f DEV: Update CI workflows 2020-10-12 08:16:43 +00:00
Discourse CI 059b04468a DEV: Update CI workflows 2020-10-09 19:03:13 +00:00
Discourse CI fb7f4e5766 DEV: Update CI workflows 2020-10-09 16:15:07 +00:00
Discourse CI 12f15a0306 DEV: Update CI workflows 2020-10-09 15:09:39 +00:00
Discourse Translator Bot c66c651c5b Update translations 2020-10-06 15:21:57 +02:00
Justin DiRose a626b8e79d DEV: Add testing workflow 2020-09-25 12:04:33 -05:00
Justin DiRose 1f49cf94db DEV: Add linting workflow 2020-09-25 12:04:17 -05:00
Joffrey JAFFEUX 15b2c1a05e REFACTOR: loadGoogle doesn't take any argument (#92) 2020-09-23 15:05:23 +02:00
Discourse Translator Bot 22dfb3aa5e Update translations 2020-09-22 13:00:22 +00:00
Discourse Translator Bot 3a7e642ae3 Update translations 2020-09-16 10:14:07 +00:00
Discourse Translator Bot 87c1478743 Update translations 2020-09-15 13:00:25 +00:00
Joffrey JAFFEUX 30dad0281d DEV: apply coding standards (#91) 2020-09-04 13:24:14 +02:00
Discourse Translator Bot 88e2bab0d6 Update translations 2020-09-01 13:00:18 +00:00
Discourse Translator Bot a36c34bedc Update translations 2020-08-25 13:00:18 +00:00
jjaffeux 5afca0aaa1 linting 2020-08-21 16:48:41 +02:00
Lawrence Thorpe 8439608f17 FIX: isFluid parameter for in-feed adsense units (#90)
Fixes issue in #89
2020-08-21 10:24:12 -04:00
Lawrence Thorpe 50788a876e Add support for adsense fluid format for in-feed (#89) 2020-08-21 09:53:34 -04:00
Discourse Translator Bot 501ad7878e Update translations 2020-08-18 13:00:20 +00:00
Discourse Translator Bot 20ebd91f8f Update translations 2020-08-11 13:00:20 +00:00
Discourse Translator Bot b28039e86a Update translations 2020-08-05 13:23:04 +00:00
Joffrey JAFFEUX 914735767a FIX: re-revert db4f5f99 with updated tests (#88)
The tests were using an incorrect value for the site setting (the name of the group instead of the id).

`no_ads_for_groups` shows groups names in the UI byt actually stores IDs.
2020-08-04 08:03:22 +02:00
Penar Musaraj db4f5f990d Revert "FIX: removes part of the 2.4 legacy code forgotten (#87)"
This reverts commit c27d5f8e85.
2020-08-03 21:44:10 -04:00
Joffrey JAFFEUX c27d5f8e85 FIX: removes part of the 2.4 legacy code forgotten (#87)
no_ads_for_groups returns a list of ids
2020-08-03 21:01:51 +02:00
Penar Musaraj 1d073e2a96 DEV: Use CSS custom properties for colors in SCSS
Prepares the plugin for an upcoming change in core while maintaining
backwards compatiblity.
2020-08-03 13:11:20 -04:00
jjaffeux 0a23be6008 DEV: uses html-safe instead of triple curly brackets 2020-08-01 17:48:23 +02:00
jjaffeux 75fb2bf892 FIX: defines an enabled_site_setting
This will amongst other things prevent to load plugin's code if the plugin is disabled.
2020-08-01 17:31:28 +02:00
jjaffeux 1e6e3bb3e9 DEV: 2.5 is now stable 2020-08-01 17:22:17 +02:00
jjaffeux 06ea132309 DEV: 2.4.0.beta3 has been released 2020-08-01 17:21:40 +02:00
dependabot[bot] 24cb463ddb Bump lodash from 4.17.15 to 4.17.19 (#86)
Bumps [lodash](https://github.com/lodash/lodash) from 4.17.15 to 4.17.19.
- [Release notes](https://github.com/lodash/lodash/releases)
- [Commits](https://github.com/lodash/lodash/compare/4.17.15...4.17.19)

Signed-off-by: dependabot[bot] <[email protected]>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2020-07-16 10:20:14 -04:00
Discourse Translator Bot dd5fb1f785 DEV: Switch from Transifex to Crowdin 2020-07-16 14:00:09 +02:00
Bianca Nenciu 3fc872520e FIX: CodeFund is shutting down (#85) 2020-07-10 18:09:32 +03:00
Robin Ward 3d0ee3f28a FIX: Prettier 2020-06-25 15:50:21 -04:00
Robin Ward 05967a8d52 FIX: Plugin was broken in stable 2020-06-25 14:51:14 -04:00
Neil Lalonde cff1459dbc Update translations 2020-06-24 11:39:24 -04:00
Kane York 5273d52f28 FIX: Do not require login to see ads.txt (#84) 2020-06-24 16:26:04 +10:00
Rafael dos Santos Silva 4ded0bdba9 DEV: Fix usage of deprecated global 2020-06-04 17:30:26 -03:00
Robin Ward 5b99fd5bbd DEV: Discourse.Route has been deprecated 2020-05-12 13:58:12 -04:00
jjaffeux ef316ab4ac DEV: Move to rubocop-discourse. 2020-05-06 17:43:43 +02:00
Neil Lalonde f11382e224 Update translations 2020-05-04 10:47:54 -04:00
Rishabh f7582f0df8 Update README.md
plugin installation info is now at https://meta.discourse.org/t/install-plugins-in-discourse/19157
2020-04-17 16:21:28 +05:30
Joffrey JAFFEUX 270799166b REFACTOR: applies discourse core coding practices (#82) 2020-03-23 09:40:29 +01:00
Neil Lalonde cd82a905ae Load Google Ad Manager code from doubleclick.net
https://support.google.com/admanager/answer/1638622?hl=en
2020-03-13 14:24:54 -04:00
Neil Lalonde bec86bd59a Update translations 2020-02-25 10:30:45 -05:00
Neil Lalonde f2ccce4beb Update translations 2020-02-13 15:03:14 -05:00
jjaffeux af346fc1c2 FIX: makes houses hads work with sk2 2020-02-07 10:34:58 +01:00
Neil Lalonde 63ae1672ad Add note about CSP to DFP, AdSense, and AdButler settings
Ad networks that serve javascript files won't work unless CSP is
disabled (a bad idea), or the content security policy script src
site setting is updated to include all sources of permitted
javascript. We will keep instructions up-to-date in the first post
of this topic: https://meta.discourse.org/t/33734
2020-02-03 17:18:42 -05:00
Neil Lalonde 3fdd0f35f3 Update translations 2020-01-20 11:19:03 -05:00
Gerhard Schlager 275921ac70 Make prettier happy 2020-01-16 00:12:27 +01:00
Neil Lalonde 116f9dd238 FEATURE: add support for fluid ad size in Google Ad Manager
No width or height will be set on containers when ad size is fluid.
2020-01-15 16:52:02 -05:00
David Taylor cf27a7be64 DEV: Stop loading external scripts while running tests (#81)
* DEV: Stop loading external scripts while running tests

* Revert "Turn of CSP for tests"

This reverts commit db1bf99277. It had no effect, since CSP is set by the server, and this was only affecting the client
2020-01-06 10:01:40 -07:00
Blake Erickson db1bf99277 Turn of CSP for tests 2020-01-03 16:30:34 -07:00
Neil Lalonde 73aa618aef Update translations 2019-12-19 12:48:16 -05:00
Penar Musaraj 155d9f904c Import Promise from RSVP 2019-11-22 11:04:36 -05:00
Penar Musaraj b59f841944 DEV: Respect radix rule in eslint-config-discourse 1.0.6 2019-11-18 10:07:55 -05:00
Neil Lalonde a3e3dbf24b Update translations 2019-11-06 10:44:38 -05:00
Neil Lalonde 0d534ce52a Update translations 2019-10-10 11:24:07 -04:00
Neil Lalonde 8d4df6df91 Rename house ad routes so ad blockers don't detect them
adplugin, house_ads, house_ad_settings become
pluginad, house_creatives, and house_settings.
2019-10-08 17:41:13 -04:00
Neil Lalonde edc549b269 UX: remove left padding of ads between posts on narrow width browsers 2019-09-17 11:27:01 -04:00
Sam Saffron 02f9145751 lint file
AdButler is not a whitelisted constant, access it via window.
2019-09-17 13:46:32 +10:00
Neil Lalonde cc09403757 Bump to version 1.2.5 2019-09-16 15:03:47 -04:00
Neil Lalonde 9a02cae641 Update README with info about new settings
Also remove outdated list of supported sizes. It's not a useful table.
2019-09-16 15:03:14 -04:00
Neil Lalonde 6704238c94 Update README with more info about AdButler support 2019-09-16 14:50:15 -04:00
Neil Lalonde 51c1b89a62 Prettier 2019-09-16 14:35:58 -04:00
discoursehosting 19f0457e8c AdButler support (#80) 2019-09-16 14:26:17 -04:00
Neil Lalonde b500ea171f DEV: Add tests for no_ads_for_categories 2019-09-11 12:18:42 -04:00
Neil Lalonde 0612054da8 Bump to version 1.2.4 2019-09-10 17:09:21 -04:00
Neil Lalonde 62888e734f FIX: handle no ad size given for AdSense and DFP ad units
For AdSense, assume responsive size.
For DFP, don't attempt to render the ad unit.
2019-09-10 17:07:47 -04:00
Neil Lalonde 2ad24e4a60 FEATURE: add option to disable ads in restricted categories
Use the new setting "no ads for restricted categories".
2019-07-22 11:43:39 -04:00
Roman Rizzi 2ceb99e151 DEV: migrate no_ads_for_groups to use IDs instead of group names (#77) [Undo revert] (#79)
This reverts commit dee02ac3ba.
2019-07-19 10:29:52 -03:00
Neil Lalonde 4991941d03 FIX: CodeFund ads in between posts on narrow widths 2019-07-18 12:16:02 -04:00
Neil Lalonde 71c51ebd8b FIX: ads always showing in all placements for CodeFund and Carbon Ads
Checkboxes used to choose which placements to have ads were not handled
correctly.
2019-07-17 14:05:58 -04:00
Roman Rizzi dee02ac3ba Revert "DEV: migrate no_ads_for_groups to use IDs instead of group names (#77)" (#78)
This reverts commit 09a92f3438.
2019-07-16 11:57:20 -03:00
Neil Lalonde 93af4587fa FIX: Amazon ads never showing 2019-07-16 10:55:39 -04:00
Roman Rizzi 09a92f3438 DEV: migrate no_ads_for_groups to use IDs instead of group names (#77) 2019-07-16 11:35:16 -03:00
Neil Lalonde 3aa9cb8a0c FIX: wrong size DFP ads when using multiple sizes
getWidthAndHeight was being called twice for each ad placement:
once when setting the size of the div, and once when calling the 
defineSlot API. getWidthAndHeight always advances to the next size
in the list, so the wrong size ad would be inserted into the div.
2019-07-15 15:34:46 -04:00
Neil Lalonde e8295c600c Update translations 2019-07-15 13:59:41 -04:00
Neil Lalonde 1929ac405c lint errors 2019-07-08 15:18:34 -04:00
Neil Lalonde 333f6cef81 FEATURE: support multiple ad sizes in AdSense and Ad Manager
Each ad placement in the AdSense and Ad Manager settings takes a list
of ad sizes instead of only one size. If given multiple sizes, the sizes
will alternate in order for each ad that's rendered.
2019-07-08 15:10:25 -04:00
Neil Lalonde 6f786b2f4d Bump to version 1.2.3 2019-06-27 14:16:19 -04:00
Neil Lalonde ad939a851a FEATURE: option to disable ads on personal messages
Use the new setting "no ads for personal messages".
2019-06-27 14:13:51 -04:00
Neil Lalonde 2ba276b0fb FIX: DFP ad units being refreshed multiple times on the same render
Ember is firing events multiple times when the ad component is shown.

Only solution I can find is to add a delay between calls to refresh
the ad unit. I chose 3 seconds.
2019-06-26 11:15:04 -04:00
Brahn Partridge 89200f3b99 try io instead of app to maybe workaround CORs problem 2019-06-24 09:59:58 -04:00
Neil Lalonde 3054f2539a FEATURE: use a different Ad Manager publisher ID for mobile
If you want to use one Ad Manager publisher on desktop and a different
one on mobile, use the new dfp_publisher_id_mobile setting.
By default, dfp_publisher_id will be used for both desktop and mobile.
2019-06-19 11:52:23 -04:00
Neil Lalonde 8ab28f4fda Bump to version 1.2.2 2019-06-17 21:01:33 -04:00
Neil Lalonde 25090a55a1 prettier 2019-06-17 21:00:05 -04:00
Neil Lalonde 92609c7af4 FIX: no_ads_for_tags support for hidden tags
Hidden tags aren't sent to the client, so they couldn't be used to
disable ads on topic pages. Do this calculation on the server.
Topic list pages for tags can continue to check on the client because
non-staff get a 404 error when trying to view a hidden tag's topic list.
2019-06-17 17:20:38 -04:00
Neil Lalonde ca345f273c Update translations 2019-06-17 13:56:18 -04:00
Arpit Jalan d34b45627e Fix the build. 2019-06-15 16:01:52 +05:30
Neil Lalonde 31efc7025d FEATURE: new setting to disable ads based on tags
Enter a list of tags in the new setting no_ads_for_tags to prevent
ads from being rendered on topics with one or more of those tags,
and on topic list pages for those tags.
2019-06-14 14:44:09 -04:00
Penar Musaraj 574500ba08 Run Prettier 2019-06-14 13:24:55 -04:00
Penar Musaraj 203e14b639 Fix eslint warnings 2019-06-14 12:10:11 -04:00
Joffrey JAFFEUX 8c3fe62e90 DEV: new API s/replaceCurrentUser/updateCurrentUser
See https://github.com/discourse/discourse/pull/7769
2019-06-14 10:59:32 +02:00
Neil Lalonde 3a04f95916 REFACTOR: some changes to be closer to example implementation
https://support.google.com/admanager/answer/4578089?hl=en

* unique div ID for every ad slot
* setTargeting before calling addService
* don't destroySlots async (no examples of correct way to use this...)
2019-06-10 15:43:48 -04:00
Neil Lalonde 0432256adb Update translations 2019-06-10 10:37:57 -04:00
Neil Lalonde 35c1af6648 Version bump to 1.2.1 2019-06-05 17:01:31 -04:00
Neil Lalonde 04525d0cf1 FIX: dfp category targeting params
DFP category targeting param wasn't always being updated on topic
list pages.

Also remove dependency on a category param being passed in to the
component from a template so that we can now place dfp ads
in places that don't have access to the current category and
targeting will still work.
2019-06-05 17:00:47 -04:00
Neil Lalonde 7af8f1d46b FEATURE: new setting to disable ads based on category of current page
Use the "no ads for categories" setting to define which category pages
(topic list and topics) should not render any ads.
2019-06-05 16:00:24 -04:00
204 changed files with 9033 additions and 3228 deletions
+2
View File
@@ -0,0 +1,2 @@
3.1.999: 30c49eb50d6d16fcf82bace3da0e1972b7b220c0
-105
View File
@@ -1,105 +0,0 @@
{
"env": {
"jasmine": true,
"node": true,
"mocha": true,
"browser": true,
"builtin": true
},
"parserOptions": {
"ecmaVersion": 7,
"sourceType": "module"
},
"globals":
{"Ember":true,
"jQuery":true,
"$":true,
"RSVP":true,
"Discourse":true,
"Em":true,
"PreloadStore":true,
"Handlebars":true,
"I18n":true,
"bootbox":true,
"module":true,
"moduleFor":true,
"moduleForComponent":true,
"Pretender":true,
"sandbox":true,
"controllerFor":true,
"test":true,
"ok":true,
"not":true,
"expect":true,
"equal":true,
"visit":true,
"andThen":true,
"click":true,
"currentPath":true,
"currentRouteName":true,
"currentURL":true,
"fillIn":true,
"keyEvent":true,
"triggerEvent":true,
"count":true,
"exists":true,
"visible":true,
"invisible":true,
"asyncRender":true,
"selectDropdown":true,
"asyncTestDiscourse":true,
"fixture":true,
"find":true,
"sinon":true,
"moment":true,
"start":true,
"_":true,
"alert":true,
"containsInstance":true,
"deepEqual":true,
"notEqual":true,
"define":true,
"require":true,
"requirejs":true,
"hasModule":true,
"Blob":true,
"File":true},
"rules": {
"block-scoped-var": 2,
"dot-notation": 0,
"eqeqeq": [
2,
"allow-null"
],
"guard-for-in": 2,
"no-bitwise": 2,
"no-caller": 2,
"no-cond-assign": 0,
"no-debugger": 2,
"no-empty": 0,
"no-eval": 2,
"no-extend-native": 2,
"no-extra-parens": 0,
"no-irregular-whitespace": 2,
"no-iterator": 2,
"no-loop-func": 2,
"no-multi-str": 2,
"no-new": 2,
"no-plusplus": 0,
"no-proto": 2,
"no-script-url": 2,
"no-sequences": 2,
"no-shadow": 2,
"no-undef": 2,
"no-unused-vars": 2,
"no-with": 2,
"semi": 2,
"strict": 0,
"valid-typeof": 2,
"wrap-iife": [
2,
"inside"
]
},
"parser": "babel-eslint"
}
+1
View File
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/eslint");
+11
View File
@@ -0,0 +1,11 @@
name: Discourse Plugin
on:
push:
branches:
- main
pull_request:
jobs:
ci:
uses: discourse/.github/.github/workflows/discourse-plugin.yml@v1
+3 -2
View File
@@ -2,7 +2,8 @@
log/*.log log/*.log
pkg/ pkg/
auto_generated auto_generated
Gemfile.lock
.DS_Store .DS_Store
*.swp *.swp
.rubocop-https---raw-githubusercontent-com-discourse-discourse-master--rubocop-yml node_modules
yarn-error.log
.rubocop-https---raw-githubusercontent-com-discourse-*
+1
View File
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/prettier");
+5 -1
View File
@@ -1 +1,5 @@
inherit_from: https://raw.githubusercontent.com/discourse/discourse/master/.rubocop.yml inherit_gem:
rubocop-discourse: stree-compat.yml
RSpec/NamedSubject:
Enabled: false
+2
View File
@@ -0,0 +1,2 @@
--print-width=100
--plugins=plugin/trailing_comma,plugin/disable_auto_ternary
+1
View File
@@ -0,0 +1 @@
module.exports = require("@discourse/lint-configs/template-lint");
-15
View File
@@ -1,15 +0,0 @@
[main]
host = https://www.transifex.com
lang_map = el_GR: el, es_ES: es, fr_FR: fr, hu_HU: hu, ko_KR: ko, pt_PT: pt, sk_SK: sk, vi_VN: vi
[discourse-org.discourse-adpluginclientenyml]
file_filter = config/locales/client.<lang>.yml
source_file = config/locales/client.en.yml
source_lang = en
type = YML
[discourse-org.discourse-adpluginserverenyml]
file_filter = config/locales/server.<lang>.yml
source_file = config/locales/server.en.yml
source_lang = en
type = YML
+3 -2
View File
@@ -1,7 +1,8 @@
# frozen_string_literal: true # frozen_string_literal: true
source 'https://rubygems.org' source "https://rubygems.org"
group :development do group :development do
gem 'translations-manager', git: 'https://github.com/discourse/translations-manager.git' gem "rubocop-discourse"
gem "syntax_tree"
end end
+54
View File
@@ -0,0 +1,54 @@
GEM
remote: https://rubygems.org/
specs:
ast (2.4.2)
json (2.6.3)
language_server-protocol (3.17.0.3)
parallel (1.23.0)
parser (3.2.2.4)
ast (~> 2.4.1)
racc
prettier_print (1.2.1)
racc (1.7.3)
rainbow (3.1.1)
regexp_parser (2.8.2)
rexml (3.2.6)
rubocop (1.57.2)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
parser (>= 3.2.2.4)
rainbow (>= 2.2.2, < 4.0)
regexp_parser (>= 1.8, < 3.0)
rexml (>= 3.2.5, < 4.0)
rubocop-ast (>= 1.28.1, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.30.0)
parser (>= 3.2.1.0)
rubocop-capybara (2.19.0)
rubocop (~> 1.41)
rubocop-discourse (3.4.0)
rubocop (>= 1.1.0)
rubocop-rspec (>= 2.0.0)
rubocop-factory_bot (2.24.0)
rubocop (~> 1.33)
rubocop-rspec (2.25.0)
rubocop (~> 1.40)
rubocop-capybara (~> 2.17)
rubocop-factory_bot (~> 2.22)
ruby-progressbar (1.13.0)
syntax_tree (6.2.0)
prettier_print (>= 1.2.0)
unicode-display_width (2.5.0)
PLATFORMS
arm64-darwin-21
x86_64-linux
DEPENDENCIES
rubocop-discourse
syntax_tree
BUNDLED WITH
2.4.21
+56 -39
View File
@@ -1,10 +1,12 @@
# Official Discourse Advertising Plugin # Official Discourse Advertising Plugin
Official Plugin Topic & Documentation: https://meta.discourse.org/t/official-advertising-ad-plugin-for-discourse/33734
This is the official Discourse advertising plugin. It allows advertisements to be served by supported advertising platforms for users with a Discourse forum. This is the official Discourse advertising plugin. It allows advertisements to be served by supported advertising platforms for users with a Discourse forum.
**Authors**: [Sarah Ni](https://github.com/cyberkoi) & [Vi Nguyen](https://github.com/ladydanger) **Authors**: [Sarah Ni](https://github.com/cyberkoi) & [Vi Nguyen](https://github.com/ladydanger)
**Version**: 1.2.0 **Version**: 1.2.5
**Contributors**: See [credits section](#credits) below **Contributors**: See [credits section](#credits) below
@@ -17,8 +19,8 @@ This is the official Discourse advertising plugin. It allows advertisements to
* [Google Adsense](http://www.google.com.au/adsense/start/why-adsense.html) * [Google Adsense](http://www.google.com.au/adsense/start/why-adsense.html)
* [Google Double Click for Publishers](https://www.google.com/dfp) * [Google Double Click for Publishers](https://www.google.com/dfp)
* [Amazon Affiliates](http://affiliate-program.amazon.com) - Banner and Product Link Ads * [Amazon Affiliates](http://affiliate-program.amazon.com) - Banner and Product Link Ads
* [CodeFund](https://codefund.io) - Ethical Ad Platform for Developers
* [Carbon Ads](https://www.carbonads.net/) * [Carbon Ads](https://www.carbonads.net/)
* [AdButler](https://www.adbutler.com/)
## Quick Start in 3 Steps ## Quick Start in 3 Steps
@@ -34,7 +36,7 @@ For non-docker or local development installation (those with programming experie
### Step 1 - Install the Official Discourse Advertising Plugin ### Step 1 - Install the Official Discourse Advertising Plugin
As seen in a [how-to on meta.discourse.org](https://meta.discourse.org/t/advanced-troubleshooting-with-docker/15927#Example:%20Install%20a%20plugin), simply **add the plugin's repository url to your container's app.yml file**: As seen in a [how-to on meta.discourse.org](https://meta.discourse.org/t/install-plugins-in-discourse/19157), simply **add the plugin's repository url to your container's app.yml file**:
```yml ```yml
hooks: hooks:
@@ -79,8 +81,8 @@ the ad slots. The ads will start showing as soon as you add them to slots.
<li>House Ads - if you want to create and serve ads from your Discourse instance.</li> <li>House Ads - if you want to create and serve ads from your Discourse instance.</li>
<li>Adsense - if using Adsense as your advertisement platform.</li> <li>Adsense - if using Adsense as your advertisement platform.</li>
<li>DFP - if using the DoubleClick for Publishers advertisement platform.</li> <li>DFP - if using the DoubleClick for Publishers advertisement platform.</li>
<li>CodeFund - if using the CodeFund ethical advertisement platform.</li>
<li>Carbon Ads - if using the Carbon Ads advertisement platform.</li> <li>Carbon Ads - if using the Carbon Ads advertisement platform.</li>
<li>AdButler - if using the AdButler advertisement platform.</li>
</ul> </ul>
</ul> </ul>
@@ -94,24 +96,47 @@ the ad slots. The ads will start showing as soon as you add them to slots.
##### Adsense Advertisement Tag to Discourse's Site Settings ##### Adsense Advertisement Tag to Discourse's Site Settings
![](https://www.dropbox.com/sc/pguxq17zo2rovyd/AAD--LTH_IIgVhgczoaY1Ljva?dl=1) ![image](https://user-images.githubusercontent.com/5862206/214489271-32ce230f-9f79-441e-9d7a-c5488ebb8c8a.png)
##### DoubleClick for Publishers' Advertisement Tag to Discourse's Site Settings ##### DoubleClick for Publishers' Advertisement Tag to Discourse's Site Settings
![](https://www.dropbox.com/sc/0inoc1iduux0gsf/AADi8tfKX9S6Tx9S8RndcUE8a?dl=1) ![image](https://user-images.githubusercontent.com/5862206/214489324-8554a996-1876-432b-a686-e1add3b96ec4.png)
##### Amazon Affiliates' Advertisement Tag to Discourse's Site Settings ##### Amazon Affiliates' Advertisement Tag to Discourse's Site Settings
Only for Product Link and Banner Ads. Only for Product Link and Banner Ads.
![](https://www.dropbox.com/sc/l67fb5c3tl8bq3d/AAAAMmccMW3kkIeBR7cBdWoFa?dl=1) ![image](https://user-images.githubusercontent.com/5862206/214489360-8829291b-8571-4deb-a867-139e823ebdea.png)
##### CodeFund Embed Tag to Discourse's Site Settings
![CodeFund Instructions](https://s3-us-west-2.amazonaws.com/codesponsor/discourse-codefund-instructions.png)
##### Carbon Ads Script Tag to Discourse's Site Settings ##### Carbon Ads Script Tag to Discourse's Site Settings
![Carbon Ads](https://d11a6trkgmumsb.cloudfront.net/original/3X/3/a/3acc7488db2b53733cdd427d3cb1b76361c786e1.png) ![adpluginexample](https://user-images.githubusercontent.com/5862206/214489455-234a3812-3606-47bf-9e49-cdaa3d1e3b9c.png)
##### AdButler Ads Zone URL to Discourse's Site Settings
This plugin only support AdButler "Standard Zones". Text and VAST are not supported.
If you browse to a zone in the AdButler admin, then you can find the Publisher ID (PPPPPP) and the Zone ID (ZZZZZZ) in the URL of your browser's address bar:
`https://admin.adbutler.com/?ID=PPPPPP&p=textadzone.view&zoneID=ZZZZZZ`
Configure the ads in Admin > Settings > AdButler.
Enter the publisher id in the "adbutler publisher id" setting, and enter the Zone IDs in the different
zone id settings as desired.
By default, ads are assumed to be size 728 x 90, or 320 x 50 in mobile view.
To use different size ads, customize using CSS in your site's theme. Override the following CSS:
```css
.adbutler-ad {
width: 728px;
height: 90px;
}
.adbutler-mobile-ad {
width: 320px;
height: 50px;
}
```
### Step 3 - See Your Ad ### Step 3 - See Your Ad
@@ -122,9 +147,11 @@ Once you've configured your settings and your advertising platform has ads that
In this section, we go into more detail on: In this section, we go into more detail on:
* Available Locations for Ad Display * Available Locations for Ad Display
* Ad Sizes Supported
* Trust Levels * Trust Levels
* Languages Supported * Personal messages
* Groups
* Categories
* Tags
### Available Locations for Ad Display ### Available Locations for Ad Display
@@ -137,26 +164,7 @@ The following are available locations along with a description and an image show
| Topic Above Suggested | Ad will appear in the footer above suggested topics of all Discourse forum topics | | Topic Above Suggested | Ad will appear in the footer above suggested topics of all Discourse forum topics |
| Post Bottom & Nth Post | Ad will appear on the stipulated nth post within a topic. So if you have 5 posts in a topic and you want the ad to display after on the 2nd post, put 2 in ```ad_platform_nth_post_code```. | | Post Bottom & Nth Post | Ad will appear on the stipulated nth post within a topic. So if you have 5 posts in a topic and you want the ad to display after on the 2nd post, put 2 in ```ad_platform_nth_post_code```. |
![adplugin2](https://user-images.githubusercontent.com/5862206/214489128-2e0a9520-ffa5-47a9-81f8-27609b2c9975.jpeg)
![](https://www.dropbox.com/sc/rm5bcn8c85niul1/AAAUVW-hn56XtCl_XTNlE19Ra?dl=1)
### Advertisement Sizes Supported
This plugin supports the following ad sizes for the following locations.
All locations except post bottom | Post bottom location | Mobile
--- | --- | ---
728 x 90 | 728 x 90 | 320 x 50
336 x 280 | 336 x 280 |
300 x 250 | 300 x 250 |
970 x 90 | 970 x 90 |
468 x 60 | 468 x 60 |
234 x 60 | 234 x 60 |
125 x 125 | |
180 x 150 | |
200 x 200 | |
250 x 250 | |
### Trust Levels ### Trust Levels
@@ -170,12 +178,21 @@ You can use the ```ad_platform_through_trust_level``` dropdown to disable ads fo
To find more about trust levels in Discourse, refer to [Discourse's posts on trust levels](https://meta.discourse.org/t/what-do-user-trust-levels-do/4924) To find more about trust levels in Discourse, refer to [Discourse's posts on trust levels](https://meta.discourse.org/t/what-do-user-trust-levels-do/4924)
### Languages Supported ### Personal messages
* Chinese (Simplified) By default, ads won't be shown in personal messages. To enable ads in personal messages, use the "no ads for personal messages" setting.
* English
* French ### Groups
* Spanish
To give some users an ad-free experience, put the users in groups and add those groups to the "no ads for groups" setting.
### Categories
To disable ads in certain categories, add them to the "no ads for categories" setting. Also consider using the "no ads for restricted categories" to disable ads in all categories that have read access restrictions.
### Tags
Individual topics can have ads disabled by using tags, and entering those tags in the "no ads for tags" setting. This is useful if some topics violate ad network policies.
## Other Installation ## Other Installation
@@ -2,9 +2,9 @@ export default {
resource: "admin.adminPlugins", resource: "admin.adminPlugins",
path: "/plugins", path: "/plugins",
map() { map() {
this.route("houseAds", { path: "/adplugin/house_ads" }, function() { this.route("houseAds", { path: "/pluginad/house_creatives" }, function () {
this.route("index", { path: "/" }); this.route("index", { path: "/" });
this.route("show", { path: "/:ad_id" }); this.route("show", { path: "/:ad_id" });
}); });
} },
}; };
@@ -0,0 +1,42 @@
import Ember from "ember";
import MultiSelectComponent from "select-kit/components/multi-select";
const { makeArray } = Ember;
import { computed } from "@ember/object";
export default MultiSelectComponent.extend({
classNames: ["house-ads-chooser"],
filterable: true,
filterPlaceholder: "admin.adplugin.house_ads.filter_placeholder",
tokenSeparator: "|",
allowCreate: false,
allowAny: false,
settingValue: "",
valueAttribute: null,
nameProperty: null,
value: computed("settingValue", function () {
return this.settingValue
.toString()
.split(this.tokenSeparator)
.filter(Boolean);
}),
// TODO: kept for legacy, remove when Discourse is 2.5
mutateValues(values) {
this.set("settingValue", values.join(this.tokenSeparator));
},
computeValues() {
return this.settingValue.split(this.tokenSeparator).filter(Boolean);
},
content: computed("choices", function () {
return makeArray(this.choices);
}),
actions: {
onChange(value) {
const settingValue = makeArray(value).join(this.tokenSeparator);
this.attrs.onChange && this.attrs.onChange(settingValue);
},
},
});
@@ -0,0 +1,13 @@
<label for={{name}}>{{title}}</label>
{{house-ads-chooser
settingValue=adValue
choices=adNames
onChange=(action (mut adValue))
}}
<div class="setting-controls">
{{#if changed}}
<DButton class="ok" @action={{action "save"}} @icon="check" />
<DButton class="cancel" @action={{action "cancel"}} @icon="times" />
{{/if}}
</div>
<p class="help">{{help}}</p>
@@ -0,0 +1,7 @@
import { mapBy } from "@ember/object/computed";
import HouseAdsSetting from "discourse/plugins/discourse-adplugin/discourse/components/house-ads-setting";
export default HouseAdsSetting.extend({
classNames: "house-ads-setting house-ads-list-setting",
adNames: mapBy("allAds", "name"),
});
@@ -0,0 +1,9 @@
<label for={{name}}>{{title}}</label>
<TextField @value={{adValue}} @classNames="house-ads-text-input" />
<div class="setting-controls">
{{#if changed}}
<DButton class="ok" @action={{action "save"}} @icon="check" />
<DButton class="cancel" @action={{action "cancel"}} @icon="times" />
{{/if}}
</div>
<p class="help">{{help}}</p>
@@ -1,9 +1,10 @@
import Component from "@ember/component";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
import { i18n, propertyNotEqual } from "discourse/lib/computed"; import { i18n, propertyNotEqual } from "discourse/lib/computed";
import computed from "ember-addons/ember-computed-decorators"; import I18n from "I18n";
export default Ember.Component.extend({ export default Component.extend({
classNames: "house-ads-setting", classNames: "house-ads-setting",
adValue: "", adValue: "",
saving: false, saving: false,
@@ -22,29 +23,29 @@ export default Ember.Component.extend({
if (!this.get("saving")) { if (!this.get("saving")) {
this.setProperties({ this.setProperties({
saving: true, saving: true,
savingStatus: I18n.t("saving") savingStatus: I18n.t("saving"),
}); });
ajax( ajax(
`/admin/plugins/adplugin/house_ad_settings/${this.get("name")}.json`, `/admin/plugins/pluginad/house_settings/${this.get("name")}.json`,
{ {
type: "PUT", type: "PUT",
data: { value: this.get("adValue") } data: { value: this.get("adValue") },
} }
) )
.then(data => { .then(() => {
const adSettings = this.get("adSettings"); const adSettings = this.get("adSettings");
adSettings.set(this.get("name"), this.get("adValue")); adSettings.set(this.get("name"), this.get("adValue"));
this.setProperties({ this.setProperties({
value: this.get("adValue"), value: this.get("adValue"),
savingStatus: I18n.t("saved") savingStatus: I18n.t("saved"),
}); });
}) })
.catch(popupAjaxError) .catch(popupAjaxError)
.finally(() => { .finally(() => {
this.setProperties({ this.setProperties({
saving: false, saving: false,
savingStatus: "" savingStatus: "",
}); });
}); });
} }
@@ -52,6 +53,6 @@ export default Ember.Component.extend({
cancel() { cancel() {
this.set("adValue", this.get("value")); this.set("adValue", this.get("value"));
} },
} },
}); });
@@ -0,0 +1,8 @@
import Controller, { inject as controller } from "@ember/controller";
import { alias } from "@ember/object/computed";
export default Controller.extend({
adminPluginsHouseAds: controller("adminPlugins.houseAds"),
houseAds: alias("adminPluginsHouseAds.model"),
adSettings: alias("adminPluginsHouseAds.houseAdsSettings"),
});
@@ -1,25 +1,41 @@
import Controller, { inject as controller } from "@ember/controller";
import { not, or } from "@ember/object/computed";
import { ajax } from "discourse/lib/ajax"; import { ajax } from "discourse/lib/ajax";
import { popupAjaxError } from "discourse/lib/ajax-error"; import { popupAjaxError } from "discourse/lib/ajax-error";
import { propertyNotEqual } from "discourse/lib/computed"; import { propertyNotEqual } from "discourse/lib/computed";
import { bufferedProperty } from "discourse/mixins/buffered-content"; import { bufferedProperty } from "discourse/mixins/buffered-content";
import I18n from "I18n";
export default Ember.Controller.extend(bufferedProperty("model"), { export default Controller.extend(bufferedProperty("model"), {
adminPluginsHouseAds: Ember.inject.controller("adminPlugins.houseAds"), adminPluginsHouseAds: controller("adminPlugins.houseAds"),
saving: false, saving: false,
savingStatus: "", savingStatus: "",
nameDirty: propertyNotEqual("buffered.name", "model.name"), nameDirty: propertyNotEqual("buffered.name", "model.name"),
htmlDirty: propertyNotEqual("buffered.html", "model.html"), htmlDirty: propertyNotEqual("buffered.html", "model.html"),
dirty: Ember.computed.or("nameDirty", "htmlDirty"), visibleToAnonsDirty: propertyNotEqual(
disableSave: Ember.computed.not("dirty"), "buffered.visible_to_anons",
"model.visible_to_anons"
),
visibleToLoggedInDirty: propertyNotEqual(
"buffered.visible_to_logged_in_users",
"model.visible_to_logged_in_users"
),
dirty: or(
"nameDirty",
"htmlDirty",
"visibleToLoggedInDirty",
"visibleToAnonsDirty"
),
disableSave: not("dirty"),
actions: { actions: {
save() { save() {
if (!this.get("saving")) { if (!this.get("saving")) {
this.setProperties({ this.setProperties({
saving: true, saving: true,
savingStatus: I18n.t("saving") savingStatus: I18n.t("saving"),
}); });
const data = {}, const data = {},
@@ -31,22 +47,26 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
} }
data.name = buffered.get("name"); data.name = buffered.get("name");
data.html = buffered.get("html"); data.html = buffered.get("html");
data.visible_to_logged_in_users = buffered.get(
"visible_to_logged_in_users"
);
data.visible_to_anons = buffered.get("visible_to_anons");
ajax( ajax(
newRecord newRecord
? `/admin/plugins/adplugin/house_ads` ? `/admin/plugins/pluginad/house_creatives`
: `/admin/plugins/adplugin/house_ads/${buffered.get("id")}`, : `/admin/plugins/pluginad/house_creatives/${buffered.get("id")}`,
{ {
type: newRecord ? "POST" : "PUT", type: newRecord ? "POST" : "PUT",
data data,
} }
) )
.then(data => { .then((ajaxData) => {
this.commitBuffer(); this.commitBuffer();
this.set("savingStatus", I18n.t("saved")); this.set("savingStatus", I18n.t("saved"));
if (newRecord) { if (newRecord) {
const model = this.get("model"); const model = this.get("model");
model.set("id", data.house_ad.id); model.set("id", ajaxData.house_ad.id);
const houseAds = this.get("adminPluginsHouseAds.model"); const houseAds = this.get("adminPluginsHouseAds.model");
if (!houseAds.includes(model)) { if (!houseAds.includes(model)) {
houseAds.pushObject(model); houseAds.pushObject(model);
@@ -61,7 +81,7 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
.finally(() => { .finally(() => {
this.setProperties({ this.setProperties({
saving: false, saving: false,
savingStatus: "" savingStatus: "",
}); });
}); });
} }
@@ -80,14 +100,14 @@ export default Ember.Controller.extend(bufferedProperty("model"), {
return; return;
} }
ajax(`/admin/plugins/adplugin/house_ads/${model.get("id")}`, { ajax(`/admin/plugins/pluginad/house_creatives/${model.get("id")}`, {
type: "DELETE" type: "DELETE",
}) })
.then(() => { .then(() => {
houseAds.removeObject(model); houseAds.removeObject(model);
this.transitionToRoute("adminPlugins.houseAds.index"); this.transitionToRoute("adminPlugins.houseAds.index");
}) })
.catch(() => bootbox.alert(I18n.t("generic_error"))); .catch(popupAjaxError);
} },
} },
}); });
@@ -0,0 +1,5 @@
import Controller from "@ember/controller";
export default Controller.extend({
loadingAds: true,
});
@@ -0,0 +1,9 @@
import { action } from "@ember/object";
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
@action
moreSettings() {
this.transitionTo("adminSiteSettingsCategory", "ad_plugin");
},
});
@@ -0,0 +1,21 @@
import EmberObject from "@ember/object";
import DiscourseRoute from "discourse/routes/discourse";
import I18n from "I18n";
export default DiscourseRoute.extend({
model(params) {
if (params.ad_id === "new") {
return EmberObject.create({
name: I18n.t("admin.adplugin.house_ads.new_name"),
html: "",
visible_to_logged_in_users: true,
visible_to_anons: true,
});
} else {
return this.modelFor("adminPlugins.houseAds").findBy(
"id",
parseInt(params.ad_id, 10)
);
}
},
});
@@ -0,0 +1,22 @@
import EmberObject from "@ember/object";
import { ajax } from "discourse/lib/ajax";
import DiscourseRoute from "discourse/routes/discourse";
export default DiscourseRoute.extend({
settings: null,
model() {
return ajax("/admin/plugins/pluginad/house_creatives.json").then((data) => {
this.set("settings", EmberObject.create(data.settings));
return data.house_ads.map((ad) => EmberObject.create(ad));
});
},
setupController(controller, model) {
controller.setProperties({
model,
houseAdsSettings: this.get("settings"),
loadingAds: false,
});
},
});
@@ -0,0 +1,51 @@
<DSection @class="house-ads-settings content-body">
<div>{{i18n "admin.adplugin.house_ads.description"}}</div>
{{#if houseAds.length}}
<form class="form-horizontal">
{{house-ads-list-setting
name="topic_list_top"
value=adSettings.topic_list_top
allAds=houseAds
adSettings=adSettings
}}
{{house-ads-list-setting
name="topic_above_post_stream"
value=adSettings.topic_above_post_stream
allAds=houseAds
adSettings=adSettings
}}
{{house-ads-list-setting
name="topic_above_suggested"
value=adSettings.topic_above_suggested
allAds=houseAds
adSettings=adSettings
}}
{{house-ads-list-setting
name="post_bottom"
value=adSettings.post_bottom
allAds=houseAds
adSettings=adSettings
}}
{{house-ads-list-setting
name="topic_list_between"
value=adSettings.topic_list_between
allAds=houseAds
adSettings=adSettings
}}
<DButton
@label="admin.adplugin.house_ads.more_settings"
@icon="cog"
class="btn-default"
@action={{route-action "moreSettings"}}
/>
</form>
{{else}}
<p>
{{#link-to "adminPlugins.houseAds.show" "new"}}
{{i18n "admin.adplugin.house_ads.get_started"}}
{{/link-to}}
</p>
{{/if}}
</DSection>
@@ -0,0 +1,48 @@
<DSection @class="edit-house-ad content-body">
<h1><TextField @class="house-ad-name" @value={{buffered.name}} /></h1>
<div class="controls">
<AceEditor @content={{buffered.html}} @mode="html" />
</div>
<div class="controls">
<div class="visibility-settings">
<div>
<Input
class="visible-to-logged-in-checkbox"
@type="checkbox"
@checked={{this.buffered.visible_to_logged_in_users}}
/>
<span>{{i18n "admin.adplugin.house_ads.show_to_logged_in_users"}}</span>
</div>
<div>
<Input
class="visible-to-anonymous-checkbox"
@type="checkbox"
@checked={{this.buffered.visible_to_anons}}
/>
<span>{{i18n "admin.adplugin.house_ads.show_to_anons"}}</span>
</div>
</div>
<DButton
@action={{action "save"}}
@disabled={{disableSave}}
class="btn-primary save-button"
@label="admin.adplugin.house_ads.save"
/>
{{#if saving}}
{{savingStatus}}
{{else}}
{{#if dirty}}
<a href {{action "cancel"}}>{{i18n "cancel"}}</a>
{{/if}}
{{/if}}
<DButton
@action={{action "destroy"}}
class="btn-danger delete-button"
@label="admin.adplugin.house_ads.delete"
/>
</div>
</DSection>
@@ -1,21 +1,21 @@
<div class="adplugin-mgmt"> <div class="adplugin-mgmt">
<h1>{{i18n 'admin.adplugin.house_ads.title'}}</h1> <h1>{{i18n "admin.adplugin.house_ads.title"}}</h1>
{{#if model.length}} {{#if model.length}}
<div class="content-list"> <div class="content-list">
<div class="house-ads-actions"> <div class="house-ads-actions">
{{#link-to 'adminPlugins.houseAds.show' 'new' class="btn btn-primary"}} {{#link-to "adminPlugins.houseAds.show" "new" class="btn btn-primary"}}
{{d-icon "plus"}} {{d-icon "plus"}}
<span>{{i18n 'admin.adplugin.house_ads.new'}}</span> <span>{{i18n "admin.adplugin.house_ads.new"}}</span>
{{/link-to}} {{/link-to}}
{{#link-to 'adminPlugins.houseAds.index' class="btn btn-default"}} {{#link-to "adminPlugins.houseAds.index" class="btn btn-default"}}
{{d-icon "cog"}} {{d-icon "cog"}}
<span>{{i18n 'admin.adplugin.house_ads.settings'}}</span> <span>{{i18n "admin.adplugin.house_ads.settings"}}</span>
{{/link-to}} {{/link-to}}
</div> </div>
<ul class="house-ads-list"> <ul class="house-ads-list">
{{#each model as |ad|}} {{#each model as |ad|}}
<li class="house-ads-list-item"> <li class="house-ads-list-item">
{{#link-to 'adminPlugins.houseAds.show' ad.id}} {{#link-to "adminPlugins.houseAds.show" ad.id}}
{{ad.name}} {{ad.name}}
{{/link-to}} {{/link-to}}
</li> </li>
@@ -24,4 +24,4 @@
</div> </div>
{{/if}} {{/if}}
{{outlet}} {{outlet}}
</div> </div>
+16 -16
View File
@@ -5,10 +5,7 @@ module ::AdPlugin
requires_plugin AdPlugin.plugin_name requires_plugin AdPlugin.plugin_name
def index def index
render_json_dump( render_json_dump(house_ads: HouseAd.all.map(&:to_hash), settings: HouseAdSetting.all)
house_ads: HouseAd.all.map(&:to_hash),
settings: HouseAdSetting.all
)
end end
def show def show
@@ -17,11 +14,7 @@ module ::AdPlugin
def create def create
ad = HouseAd.create(house_ad_params) ad = HouseAd.create(house_ad_params)
if ad.valid? ad.valid? ? render_json_dump(house_ad: ad.to_hash) : render_json_error(ad)
render_json_dump(house_ad: ad.to_hash)
else
render_json_error(ad)
end
end end
def update def update
@@ -31,25 +24,32 @@ module ::AdPlugin
ad = HouseAd.create(house_ad_params.except(:id)) ad = HouseAd.create(house_ad_params.except(:id))
end end
if ad.valid? ad.valid? ? render_json_dump(house_ad: ad.to_hash) : render_json_error(ad)
render_json_dump(house_ad: ad.to_hash)
else
render_json_error(ad)
end
end end
def destroy def destroy
if ad = HouseAd.find(house_ad_params[:id]) if ad = HouseAd.find(house_ad_params[:id])
ad.destroy ad.destroy
else else
render_json_error(I18n.t('not_found'), status: 404) render_json_error(I18n.t("not_found"), status: 404)
end end
end end
private private
def house_ad_params def house_ad_params
params.permit(:id, :name, :html) @permitted ||=
begin
permitted =
params.permit(:id, :name, :html, :visible_to_anons, :visible_to_logged_in_users)
permitted[:visible_to_logged_in_users] = ActiveModel::Type::Boolean.new.cast(
permitted[:visible_to_logged_in_users],
)
permitted[:visible_to_anons] = ActiveModel::Type::Boolean.new.cast(
permitted[:visible_to_anons],
)
permitted
end
end end
end end
end end
+32 -11
View File
@@ -4,7 +4,7 @@ module ::AdPlugin
class HouseAd class HouseAd
include ActiveModel::Validations include ActiveModel::Validations
attr_accessor :id, :name, :html attr_accessor :id, :name, :html, :visible_to_logged_in_users, :visible_to_anons
NAME_REGEX = /\A[[:alnum:]\s\.,'!@#$%&\*\-\+\=:]*\z/i NAME_REGEX = /\A[[:alnum:]\s\.,'!@#$%&\*\-\+\=:]*\z/i
@@ -20,6 +20,8 @@ module ::AdPlugin
def initialize def initialize
@name = "New Ad" @name = "New Ad"
@html = "<div class='house-ad'>New Ad</div>" @html = "<div class='house-ad'>New Ad</div>"
@visible_to_logged_in_users = true
@visible_to_anons = true
end end
def self.from_hash(h) def self.from_hash(h)
@@ -27,6 +29,10 @@ module ::AdPlugin
ad.name = h[:name] ad.name = h[:name]
ad.html = h[:html] ad.html = h[:html]
ad.id = h[:id].to_i if h[:id] ad.id = h[:id].to_i if h[:id]
if h.key?(:visible_to_logged_in_users)
ad.visible_to_logged_in_users = h[:visible_to_logged_in_users]
end
ad.visible_to_anons = h[:visible_to_anons] if h.key?(:visible_to_anons)
ad ad
end end
@@ -37,7 +43,7 @@ module ::AdPlugin
end end
def self.alloc_id def self.alloc_id
DistributedMutex.synchronize('adplugin-house-ad-id') do DistributedMutex.synchronize("adplugin-house-ad-id") do
max_id = AdPlugin.pstore_get("ad:_id") max_id = AdPlugin.pstore_get("ad:_id")
max_id = 1 unless max_id max_id = 1 unless max_id
AdPlugin.pstore_set("ad:_id", max_id + 1) AdPlugin.pstore_set("ad:_id", max_id + 1)
@@ -46,7 +52,7 @@ module ::AdPlugin
end end
def self.find(id) def self.find(id)
if r = AdPlugin::pstore_get("ad:#{id}") if r = AdPlugin.pstore_get("ad:#{id}")
from_hash(r) from_hash(r)
else else
nil nil
@@ -54,18 +60,27 @@ module ::AdPlugin
end end
def self.all def self.all
PluginStoreRow.where(plugin_name: AdPlugin.plugin_name) PluginStoreRow
.where(plugin_name: AdPlugin.plugin_name)
.where("key LIKE 'ad:%'") .where("key LIKE 'ad:%'")
.where("key != 'ad:_id'") .where("key != 'ad:_id'")
.map do |psr| .map { |psr| from_hash(PluginStore.cast_value(psr.type_name, psr.value)) }
from_hash(PluginStore.cast_value(psr.type_name, psr.value)) .sort_by { |ad| ad.id }
end.sort_by { |ad| ad.id } end
def self.all_for_anons
self.all.select(&:visible_to_anons)
end
def self.all_for_logged_in_users
self.all.select(&:visible_to_logged_in_users)
end end
def save def save
if self.valid? if self.valid?
self.id = self.class.alloc_id if self.id.to_i <= 0 self.id = self.class.alloc_id if self.id.to_i <= 0
AdPlugin::pstore_set("ad:#{id}", to_hash) AdPlugin.pstore_set("ad:#{id}", to_hash)
Site.clear_anon_cache!
self.class.publish_if_ads_enabled self.class.publish_if_ads_enabled
true true
else else
@@ -76,6 +91,10 @@ module ::AdPlugin
def update(attrs) def update(attrs)
self.name = attrs[:name] self.name = attrs[:name]
self.html = attrs[:html] self.html = attrs[:html]
if attrs.key?(:visible_to_logged_in_users)
self.visible_to_logged_in_users = attrs[:visible_to_logged_in_users]
end
self.visible_to_anons = attrs[:visible_to_anons] if attrs.key?(:visible_to_anons)
self.save self.save
end end
@@ -83,12 +102,15 @@ module ::AdPlugin
{ {
id: @id, id: @id,
name: @name, name: @name,
html: @html html: @html,
visible_to_logged_in_users: @visible_to_logged_in_users,
visible_to_anons: @visible_to_anons,
} }
end end
def destroy def destroy
AdPlugin::pstore_delete("ad:#{id}") AdPlugin.pstore_delete("ad:#{id}")
Site.clear_anon_cache!
self.class.publish_if_ads_enabled self.class.publish_if_ads_enabled
end end
@@ -97,6 +119,5 @@ module ::AdPlugin
AdPlugin::HouseAdSetting.publish_settings AdPlugin::HouseAdSetting.publish_settings
end end
end end
end end
end end

Some files were not shown because too many files have changed in this diff Show More