I´m a newby but interested in solving the problem so I asked chat-gpt:
Here is the answer:
The script you found is a good start. Itâs modifying the poll-ui-builder
controller to set the publicPoll
property to true
when the controllerâs onShow()
function is called. This is indeed intended to be added as a Theme Component.
However, the code might not be working due to the order of execution. The original onShow()
method sets publicPoll
to false
and then the modification sets publicPoll
to true
afterwards.
A correct way would be to call the parentâs onShow
method first, and then set publicPoll
to true
:
<script type="text/discourse-plugin" version="0.8">
api.modifyClass("controller:poll-ui-builder", {
onShow() {
this._super(...arguments);
this.set('publicPoll', true);
}
});
</script>
You can add this script to your theme by following these steps:
- Go to the Discourse Admin dashboard.
- Under the âCustomizeâ section, click on âThemesâ.
- Select the theme that you want to modify.
- In the theme editing screen, click on âEdit CSS/HTMLâ.
- In the left sidebar, click on â</> Commonâ.
- Paste the above script into the â</> Commonâ section.
- Click on the âSaveâ button.
This will apply the change to your theme. Please remember that theme changes are only applied to users who are using that particular theme. If you have multiple themes, youâll need to add this modification to each one.
Also, remember to clear your browser cache or do a hard reload to ensure that the changes are loaded correctly.
I will try to follow these steps with the admin of our Forum, but this takes a while, if someone else here want to try this in first please and give feedback I would be very happy.
Another thing i would love to change is the behaviour of the ui, i want to skip the simple screen, so i asked chat-gpt again:
In your current code, the extended view is controlled by the showAdvanced
property. If this is set to true
, the advanced view will be shown.
To always show the advanced view, you can modify the onShow()
method in the poll-ui-builder
controller to set showAdvanced
to true
. You can add this modification to the theme component you created earlier. Hereâs the updated script:
<script type="text/discourse-plugin" version="0.8">
api.modifyClass("controller:poll-ui-builder", {
onShow() {
this._super(...arguments);
this.set('publicPoll', true);
this.set('showAdvanced', true);
}
});
</script>
Remember to follow the steps I previously outlined to add this script to your theme. Once the script is saved, the advanced view should always be shown when the poll UI is loaded.
Again, remember to clear your browser cache or do a hard reload to ensure that the changes are loaded correctly.
I would love to try and test by myself somehow, but as mentioned before i´m just a moderator, not the admin of our site, so this will take some days or weeks.