mirror of
https://github.com/discourse/discourse.git
synced 2026-08-08 20:18:23 -05:00
UX: Create polls with public=true by default (#24332)
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'
This commit is contained in:
@@ -145,6 +145,15 @@
|
||||
{{/unless}}
|
||||
{{/unless}}
|
||||
|
||||
<div class="input-group poll-public">
|
||||
<DToggleSwitch
|
||||
@state={{this.publicPoll}}
|
||||
@label="poll.ui_builder.poll_public.label"
|
||||
class="poll-toggle-public"
|
||||
{{on "click" this.togglePublic}}
|
||||
/>
|
||||
</div>
|
||||
|
||||
{{#if this.showAdvanced}}
|
||||
<div class="input-group poll-allowed-groups">
|
||||
<label class="input-group-label">{{i18n
|
||||
@@ -213,19 +222,6 @@
|
||||
</div>
|
||||
</div>
|
||||
{{/unless}}
|
||||
|
||||
{{#unless this.isPie}}
|
||||
<div class="input-group poll-checkbox column">
|
||||
<label>
|
||||
<Input
|
||||
@type="checkbox"
|
||||
@checked={{this.publicPoll}}
|
||||
class="poll-toggle-public"
|
||||
/>
|
||||
{{i18n "poll.ui_builder.poll_public.label"}}
|
||||
</label>
|
||||
</div>
|
||||
{{/unless}}
|
||||
{{/if}}
|
||||
</:body>
|
||||
<:footer>
|
||||
|
||||
@@ -30,7 +30,7 @@ export default class PollUiBuilderModal extends Component {
|
||||
pollAutoClose;
|
||||
pollResult = ALWAYS_POLL_RESULT;
|
||||
chartType = BAR_CHART_TYPE;
|
||||
publicPoll = false;
|
||||
publicPoll = true;
|
||||
|
||||
@or("showAdvanced", "isNumber") showNumber;
|
||||
@gt("pollOptions.length", 1) canRemoveOption;
|
||||
@@ -174,9 +174,7 @@ export default class PollUiBuilderModal extends Component {
|
||||
if (pollType === NUMBER_POLL_TYPE) {
|
||||
pollHeader += ` step=${step}`;
|
||||
}
|
||||
if (publicPoll) {
|
||||
pollHeader += ` public=true`;
|
||||
}
|
||||
pollHeader += ` public=${publicPoll ? "true" : "false"}`;
|
||||
if (chartType && pollType !== NUMBER_POLL_TYPE) {
|
||||
pollHeader += ` chartType=${chartType}`;
|
||||
}
|
||||
@@ -381,4 +379,9 @@ export default class PollUiBuilderModal extends Component {
|
||||
event?.preventDefault();
|
||||
this.set("pollType", pollType);
|
||||
}
|
||||
|
||||
@action
|
||||
togglePublic() {
|
||||
this.set("publicPoll", !this.publicPoll);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user