1
0
Fork 0
mirror of https://github.com/Oreolek/ifhub.club.git synced 2024-07-08 09:24:25 +03:00
ifhub.club/application/frontend/components/poll/poll.form.tpl
2015-11-12 23:50:12 +07:00

102 lines
3.9 KiB
Smarty
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

{**
* Форма добавления опроса
*}
<form action="" method="post" id="js-poll-form" data-action="{if $poll}update{else}add{/if}">
{* Заголовок *}
{component 'field' template='text'
name = 'poll[title]'
value = {($poll) ? $poll->getTitle() : '' }
label = $aLang.poll.form.fields.title
inputAttributes= [ 'autofocus' => true ]}
{component 'field' template='checkbox'
name = 'poll[is_guest_allow]'
checked = {($poll && $poll->getIsGuestAllow()) ? true : false }
label = $aLang.poll.form.fields.is_guest_allow}
{component 'field' template='checkbox'
name = 'poll[is_guest_check_ip]'
checked = {($poll && $poll->getIsGuestCheckIp()) ? true : false }
label = $aLang.poll.form.fields.is_guest_check_ip}
{* Кол-во вариантов которые может выбрать пользователь *}
{if $poll && $poll->getCountVote()}
{$bDisableChangeType = true}
{/if}
<p class="ls-mb-10">{$aLang.poll.form.fields.type.label}:</p>
{component 'field' template='radio'
name = 'poll[type]'
value = 'one'
label = $aLang.poll.form.fields.type.label_one
checked = ! $poll or $poll->getCountAnswerMax() == 1
isDisabled = $bDisableChangeType}
{component 'field' template='radio'
displayInline = true
name = 'poll[type]'
value = 'many'
label = $aLang.poll.form.fields.type.label_many
checked = $poll && $poll->getCountAnswerMax() > 1
isDisabled = $bDisableChangeType}
{component 'field' template='text'
displayInline = true
name = 'poll[count_answer_max]'
value = ($poll) ? $poll->getCountAnswerMax() : 2
classes = 'ls-width-50'
isDisabled = $bDisableChangeType}
{* Варианты ответов *}
<div class="fieldset m-0">
<header class="fieldset-header">
<h3 class="fieldset-title">{$aLang.poll.form.answers_title}</h3>
</header>
<div class="fieldset-body">
<ul class="ls-poll-form-answer-list js-poll-form-answer-list">
{if $poll}
{$aAnswers = $poll->getAnswers()}
{foreach $aAnswers as $oAnswer}
{component 'poll' template='form-item'
item = $oAnswer
index = $oAnswer@index
allowUpdate = $poll->isAllowUpdate()
allowRemove = $poll->isAllowUpdate() && ! $oAnswer->getCountVote()}
{/foreach}
{else}
{component 'poll' template='form-item' showRemove=false}
{component 'poll' template='form-item' showRemove=false}
{/if}
</ul>
</div>
{if ! $poll or $poll->isAllowUpdate()}
<footer class="fieldset-footer">
{component 'button'
type = 'button'
text = $aLang.common.add
attributes = [ 'title' => '[Ctrl + Enter]' ]
classes = 'js-poll-form-answer-add'}
</footer>
{/if}
</div>
{* Скрытые поля *}
{if $poll}
{component 'field' template='hidden' name='poll_id' value=$poll->getId()}
{else}
{component 'field' template='hidden' name='target[type]' value=$sTargetType}
{component 'field' template='hidden' name='target[id]' value=$sTargetId}
{/if}
{component 'field' template='hidden' name='target[tmp]' value=$sTargetTmp}
</form>
{* Шаблон ответа для добавления с помощью js *}
{component 'poll' template='form-item' isTemplate=true}