upd: add info about multiple choices for polls

closes transfem-org/Sharkey#182
This commit is contained in:
Mar0xy 2023-11-30 22:16:42 +01:00
parent 7251f12908
commit 90ddbc5dcd
No known key found for this signature in database
GPG key ID: 56569BBE47D2C828
4 changed files with 21 additions and 6 deletions

View file

@ -891,6 +891,7 @@ continueThread: "View thread continuation"
deleteAccountConfirm: "This will irreversibly delete your account. Proceed?" deleteAccountConfirm: "This will irreversibly delete your account. Proceed?"
incorrectPassword: "Incorrect password." incorrectPassword: "Incorrect password."
voteConfirm: "Confirm your vote for \"{choice}\"?" voteConfirm: "Confirm your vote for \"{choice}\"?"
voteConfirmMulti: "Confirm your vote for \"{choice}\"?\n You can choose more options after confirmation."
hide: "Hide" hide: "Hide"
useDrawerReactionPickerForMobile: "Display reaction picker as drawer on mobile" useDrawerReactionPickerForMobile: "Display reaction picker as drawer on mobile"
welcomeBackWithName: "Welcome back, {name}" welcomeBackWithName: "Welcome back, {name}"
@ -2007,6 +2008,7 @@ _poll:
remainingHours: "{h} hour(s) {m} minute(s) remaining" remainingHours: "{h} hour(s) {m} minute(s) remaining"
remainingMinutes: "{m} minute(s) {s} second(s) remaining" remainingMinutes: "{m} minute(s) {s} second(s) remaining"
remainingSeconds: "{s} second(s) remaining" remainingSeconds: "{s} second(s) remaining"
multiple: "Multiple choices"
_visibility: _visibility:
public: "Public" public: "Public"
publicDescription: "Your note will be visible for all users" publicDescription: "Your note will be visible for all users"

2
locales/index.d.ts vendored
View file

@ -894,6 +894,7 @@ export interface Locale {
"deleteAccountConfirm": string; "deleteAccountConfirm": string;
"incorrectPassword": string; "incorrectPassword": string;
"voteConfirm": string; "voteConfirm": string;
"voteConfirmMulti": string;
"hide": string; "hide": string;
"useDrawerReactionPickerForMobile": string; "useDrawerReactionPickerForMobile": string;
"welcomeBackWithName": string; "welcomeBackWithName": string;
@ -2154,6 +2155,7 @@ export interface Locale {
"remainingHours": string; "remainingHours": string;
"remainingMinutes": string; "remainingMinutes": string;
"remainingSeconds": string; "remainingSeconds": string;
"multiple": string;
}; };
"_visibility": { "_visibility": {
"public": string; "public": string;

View file

@ -891,6 +891,7 @@ continueThread: "さらにスレッドを見る"
deleteAccountConfirm: "アカウントが削除されます。よろしいですか?" deleteAccountConfirm: "アカウントが削除されます。よろしいですか?"
incorrectPassword: "パスワードが間違っています。" incorrectPassword: "パスワードが間違っています。"
voteConfirm: "「{choice}」に投票しますか?" voteConfirm: "「{choice}」に投票しますか?"
voteConfirmMulti: "「{choice}」に投票しますか?\n 確認後、選択肢を増やすことができます。"
hide: "隠す" hide: "隠す"
useDrawerReactionPickerForMobile: "モバイルデバイスのときドロワーで表示" useDrawerReactionPickerForMobile: "モバイルデバイスのときドロワーで表示"
welcomeBackWithName: "おかえりなさい、{name}さん" welcomeBackWithName: "おかえりなさい、{name}さん"
@ -2058,6 +2059,7 @@ _poll:
remainingHours: "終了まであと{h}時間{m}分" remainingHours: "終了まであと{h}時間{m}分"
remainingMinutes: "終了まであと{m}分{s}秒" remainingMinutes: "終了まであと{m}分{s}秒"
remainingSeconds: "終了まであと{s}秒" remainingSeconds: "終了まであと{s}秒"
multiple: "複数の選択肢"
_visibility: _visibility:
public: "パブリック" public: "パブリック"

View file

@ -17,6 +17,8 @@ SPDX-License-Identifier: AGPL-3.0-only
</ul> </ul>
<p v-if="!readOnly" :class="$style.info"> <p v-if="!readOnly" :class="$style.info">
<span>{{ i18n.t('_poll.totalVotes', { n: total }) }}</span> <span>{{ i18n.t('_poll.totalVotes', { n: total }) }}</span>
<span v-if="note.poll.multiple"> · </span>
<span v-if="note.poll.multiple">{{ i18n.ts._poll.multiple }}</span>
<span> · </span> <span> · </span>
<a v-if="!closed && !isVoted" style="color: inherit;" @click="showResult = !showResult">{{ showResult ? i18n.ts._poll.vote : i18n.ts._poll.showResult }}</a> <a v-if="!closed && !isVoted" style="color: inherit;" @click="showResult = !showResult">{{ showResult ? i18n.ts._poll.vote : i18n.ts._poll.showResult }}</a>
<span v-if="isVoted">{{ i18n.ts._poll.voted }}</span> <span v-if="isVoted">{{ i18n.ts._poll.voted }}</span>
@ -78,12 +80,19 @@ const vote = async (id) => {
pleaseLogin(); pleaseLogin();
if (props.readOnly || closed.value || isVoted.value) return; if (props.readOnly || closed.value || isVoted.value) return;
if (!props.note.poll.multiple) {
const { canceled } = await os.confirm({ const { canceled } = await os.confirm({
type: 'question', type: 'question',
text: i18n.t('voteConfirm', { choice: props.note.poll.choices[id].text }), text: i18n.t('voteConfirm', { choice: props.note.poll.choices[id].text }),
}); });
if (canceled) return; if (canceled) return;
} else {
const { canceled } = await os.confirm({
type: 'question',
text: i18n.t('voteConfirmMulti', { choice: props.note.poll.choices[id].text }),
});
if (canceled) return;
}
await os.api('notes/polls/vote', { await os.api('notes/polls/vote', {
noteId: props.note.id, noteId: props.note.id,