Update Poll model and temlate

This commit is contained in:
Visman 2021-12-27 09:46:35 +07:00
parent 42cb2bbf2a
commit 15d81858ff
4 changed files with 13 additions and 8 deletions

View file

@ -93,11 +93,10 @@ class Poll extends DataModel
*/
protected function getuserVoted(): bool
{
if ($this->c->user->isGuest) {
return true;
}
if ($this->tid < 1) {
if (
$this->c->user->isGuest
|| $this->tid < 1
) {
return false;
}
@ -253,6 +252,8 @@ class Poll extends DataModel
return ['Poll results are hidden up to %s voters', $this->parent->poll_term];
} elseif ($this->userVoted) {
return 'You voted';
} elseif ($this->c->user->isGuest) {
return 'Guest cannot vote';
} else {
return 'Poll status is undefined';
}

View file

@ -84,6 +84,9 @@ msgstr "Poll results are hidden up to %s voters."
msgid "You voted"
msgstr "You voted."
msgid "Guest cannot vote"
msgstr "Guest can't vote."
msgid "Poll status is undefined"
msgstr "Poll status is undefined."

View file

@ -84,6 +84,9 @@ msgstr "Результаты опроса скрыты до %s проголос
msgid "You voted"
msgstr "Вы проголосовали."
msgid "Guest cannot vote"
msgstr "Гость не может голосовать."
msgid "Poll status is undefined"
msgstr "Статус опроса неопределен."

View file

@ -42,9 +42,7 @@
<button class="f-btn" name="vote" value="{{ __('Vote') }}" title="{{ __('Vote') }}"><span>{!! __('Vote') !!}</span></button>
</p>
</form>
@else
@if (null !== $poll->status)
@elseif (null !== $poll->status)
<p class="f-poll-status"><span>{!! __($poll->status) !!}</span></p>
@endif
@endif
</div>