nathank
(Nathan Kershaw)
June 15, 2023, 3:52am
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 Likes
wesochuck
(Wes Osborn)
June 15, 2023, 12:42pm
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 Likes
nathank
(Nathan Kershaw)
September 23, 2023, 2:57am
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 Like
@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 Like
This is now part of core:
discourse:main
← discourse:poll-public
opened 03:58PM - 10 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 Likes
nathank
(Nathan Kershaw)
November 14, 2023, 5:28am
6
Nice!! This makes the TC nicely obsolete. I consider this mission accomplished
meave
December 1, 2023, 12:26pm
7
So … how do we change the default to private ?