nathank
(Nathan Kershaw)
15.Июнь.2023 03:52:24
1
Install this theme component
This simple theme component allows some control over the default poll behaviour. It was inspired by this Topic:
In my community folks always want to see who voted on a poll, but… they always seem to forget to select the check-mark Show who voted. Is there any way to set this as a default?
Other settings could easily be added if needed.
9 лайков
wesochuck
(Wes Osborn)
15.Июнь.2023 12:42:20
2
THANK YOU! I’ve already got this installed on my forum and I’m looking forward to fewer “Oops” moments for the folks who participate on our forum.
4 лайка
nathank
(Nathan Kershaw)
23.Сентябрь.2023 02:57:38
3
This looks to be broken at the mo:
I don’t think it’s working on my test site now either. It may need updating to account for some recent changes?
I’ll split this off into a dev topic
I’ll take a look when I get the chance, but PRs are always welcome!
1 лайк
@nathank
I was looking at this code:
<script type="text/discourse-plugin" version="0.8">
api.modifyClass("controller:poll-ui-builder", {
onShow() {
this._super(...arguments);
if (settings.Public) {this.set('publicPoll', true)};
if (settings.Advanced) {this.set('showAdvanced', true)};
}
});
</script>
I think you can do the following:
api.modifyClass("component:modal/poll-ui-builder", {
pluginId: 'poll-defaults',
didInsertElement() {
this._super(...arguments); // super.didInsertElement(...arguments); doesn't work (?)
if (settings.Public) {this.set('publicPoll', true)}
if (settings.Advanced) {this.set('showAdvanced', true)}
},
});
It works.
However, I’m perplexed with didInsertElement.
poll-ui-builder is now a glimmer component. didInsertElement is not supposed to exist based on the ember upgrading guide .
I can see in core some usage . Maybe some specificity in Discourse?
Also, I’m not sure why super.didInsertElement doesn’t exist in this above code context.
1 лайк
This is now part of core:
main ← poll-public
merged 10:07PM - 12 Nov 23 UTC
In the vast majority of cases, people want poll voters to be public. Previously,… the checkbox for this was hidden behind the 'show advanced' settings in the poll builder UI.
This commit makes three changes to improve the experience:
1. Add `public=true|false` to poll markup (previously it would only be added when true
2. Bring the 'public' switch outside the 'show advanced' section for improved visibility
3. Change the default to 'true'
<img width="300" alt="SCR-20231110-nzvk" src="https://github.com/discourse/discourse/assets/6270921/33c5e562-dda4-4867-8dc2-137ed18cffa6">
3 лайка
nathank
(Nathan Kershaw)
14.Ноябрь.2023 05:28:18
6
Nice!! This makes the TC nicely obsolete. I consider this mission accomplished
3 лайка
meave
01.Декабрь.2023 12:26:12
7
So … how do we change the default to private ?