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:
parent
cdbe0f74e8
commit
7e37e3e824
|
@ -145,6 +145,15 @@
|
||||||
{{/unless}}
|
{{/unless}}
|
||||||
{{/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}}
|
{{#if this.showAdvanced}}
|
||||||
<div class="input-group poll-allowed-groups">
|
<div class="input-group poll-allowed-groups">
|
||||||
<label class="input-group-label">{{i18n
|
<label class="input-group-label">{{i18n
|
||||||
|
@ -213,19 +222,6 @@
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
{{/unless}}
|
{{/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}}
|
{{/if}}
|
||||||
</:body>
|
</:body>
|
||||||
<:footer>
|
<:footer>
|
||||||
|
|
|
@ -30,7 +30,7 @@ export default class PollUiBuilderModal extends Component {
|
||||||
pollAutoClose;
|
pollAutoClose;
|
||||||
pollResult = ALWAYS_POLL_RESULT;
|
pollResult = ALWAYS_POLL_RESULT;
|
||||||
chartType = BAR_CHART_TYPE;
|
chartType = BAR_CHART_TYPE;
|
||||||
publicPoll = false;
|
publicPoll = true;
|
||||||
|
|
||||||
@or("showAdvanced", "isNumber") showNumber;
|
@or("showAdvanced", "isNumber") showNumber;
|
||||||
@gt("pollOptions.length", 1) canRemoveOption;
|
@gt("pollOptions.length", 1) canRemoveOption;
|
||||||
|
@ -174,9 +174,7 @@ export default class PollUiBuilderModal extends Component {
|
||||||
if (pollType === NUMBER_POLL_TYPE) {
|
if (pollType === NUMBER_POLL_TYPE) {
|
||||||
pollHeader += ` step=${step}`;
|
pollHeader += ` step=${step}`;
|
||||||
}
|
}
|
||||||
if (publicPoll) {
|
pollHeader += ` public=${publicPoll ? "true" : "false"}`;
|
||||||
pollHeader += ` public=true`;
|
|
||||||
}
|
|
||||||
if (chartType && pollType !== NUMBER_POLL_TYPE) {
|
if (chartType && pollType !== NUMBER_POLL_TYPE) {
|
||||||
pollHeader += ` chartType=${chartType}`;
|
pollHeader += ` chartType=${chartType}`;
|
||||||
}
|
}
|
||||||
|
@ -381,4 +379,9 @@ export default class PollUiBuilderModal extends Component {
|
||||||
event?.preventDefault();
|
event?.preventDefault();
|
||||||
this.set("pollType", pollType);
|
this.set("pollType", pollType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@action
|
||||||
|
togglePublic() {
|
||||||
|
this.set("publicPoll", !this.publicPoll);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,12 +26,14 @@
|
||||||
.date-picker-wrapper {
|
.date-picker-wrapper {
|
||||||
margin-right: 5px;
|
margin-right: 5px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
&:last-child {
|
||||||
|
margin-bottom: 0;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
.poll-checkbox {
|
.poll-public .d-toggle-switch--label {
|
||||||
label {
|
margin-bottom: 0;
|
||||||
width: unset;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
.radio-group {
|
.radio-group {
|
||||||
|
|
|
@ -96,14 +96,14 @@ module("Poll | Component | poll-ui-builder", function (hooks) {
|
||||||
await click(".insert-poll");
|
await click(".insert-poll");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
results[results.length - 1],
|
results[results.length - 1],
|
||||||
"[poll type=number results=always min=1 max=20 step=1]\n[/poll]\n"
|
"[poll type=number results=always min=1 max=20 step=1 public=true]\n[/poll]\n"
|
||||||
);
|
);
|
||||||
|
|
||||||
await fillIn(".poll-options-step", "2");
|
await fillIn(".poll-options-step", "2");
|
||||||
await click(".insert-poll");
|
await click(".insert-poll");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
results[results.length - 1],
|
results[results.length - 1],
|
||||||
"[poll type=number results=always min=1 max=20 step=2]\n[/poll]\n",
|
"[poll type=number results=always min=1 max=20 step=2 public=true]\n[/poll]\n",
|
||||||
"includes step value"
|
"includes step value"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -111,8 +111,8 @@ module("Poll | Component | poll-ui-builder", function (hooks) {
|
||||||
await click(".insert-poll");
|
await click(".insert-poll");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
results[results.length - 1],
|
results[results.length - 1],
|
||||||
"[poll type=number results=always min=1 max=20 step=2 public=true]\n[/poll]\n",
|
"[poll type=number results=always min=1 max=20 step=2 public=false]\n[/poll]\n",
|
||||||
"includes public boolean"
|
"can be set to private"
|
||||||
);
|
);
|
||||||
|
|
||||||
await fillIn(".poll-options-step", "0");
|
await fillIn(".poll-options-step", "0");
|
||||||
|
@ -131,7 +131,7 @@ module("Poll | Component | poll-ui-builder", function (hooks) {
|
||||||
await click(".insert-poll");
|
await click(".insert-poll");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
results[results.length - 1],
|
results[results.length - 1],
|
||||||
"[poll type=regular results=always chartType=bar]\n* a\n* b\n[/poll]\n",
|
"[poll type=regular results=always public=true chartType=bar]\n* a\n* b\n[/poll]\n",
|
||||||
"has correct output"
|
"has correct output"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -142,8 +142,8 @@ module("Poll | Component | poll-ui-builder", function (hooks) {
|
||||||
await click(".insert-poll");
|
await click(".insert-poll");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
results[results.length - 1],
|
results[results.length - 1],
|
||||||
"[poll type=regular results=always public=true chartType=bar]\n* a\n* b\n[/poll]\n",
|
"[poll type=regular results=always public=false chartType=bar]\n* a\n* b\n[/poll]\n",
|
||||||
"has public boolean"
|
"can be set to private"
|
||||||
);
|
);
|
||||||
|
|
||||||
const groupChooser = selectKit(".group-chooser");
|
const groupChooser = selectKit(".group-chooser");
|
||||||
|
@ -154,7 +154,7 @@ module("Poll | Component | poll-ui-builder", function (hooks) {
|
||||||
await click(".insert-poll");
|
await click(".insert-poll");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
results[results.length - 1],
|
results[results.length - 1],
|
||||||
"[poll type=regular results=always public=true chartType=bar groups=custom_group]\n* a\n* b\n[/poll]\n",
|
"[poll type=regular results=always public=false chartType=bar groups=custom_group]\n* a\n* b\n[/poll]\n",
|
||||||
"has groups"
|
"has groups"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
@ -171,7 +171,7 @@ module("Poll | Component | poll-ui-builder", function (hooks) {
|
||||||
await click(".insert-poll");
|
await click(".insert-poll");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
results[results.length - 1],
|
results[results.length - 1],
|
||||||
"[poll type=multiple results=always min=1 max=2 chartType=bar]\n* a\n* b\n[/poll]\n",
|
"[poll type=multiple results=always min=1 max=2 public=true chartType=bar]\n* a\n* b\n[/poll]\n",
|
||||||
"has correct output"
|
"has correct output"
|
||||||
);
|
);
|
||||||
|
|
||||||
|
@ -182,8 +182,8 @@ module("Poll | Component | poll-ui-builder", function (hooks) {
|
||||||
await click(".insert-poll");
|
await click(".insert-poll");
|
||||||
assert.strictEqual(
|
assert.strictEqual(
|
||||||
results[results.length - 1],
|
results[results.length - 1],
|
||||||
"[poll type=multiple results=always min=1 max=2 public=true chartType=bar]\n* a\n* b\n[/poll]\n",
|
"[poll type=multiple results=always min=1 max=2 public=false chartType=bar]\n* a\n* b\n[/poll]\n",
|
||||||
"has public boolean"
|
"can be set to private boolean"
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue