mirror of
https://github.com/Oreolek/ifhub.club.git
synced 2024-06-30 21:45:01 +03:00
Fixes #496 Доработать форму создания опросов
This commit is contained in:
parent
44ea88d14d
commit
f67e6a8636
|
@ -159,10 +159,14 @@
|
|||
* @param {jQuery} list Список ответов
|
||||
*/
|
||||
answerAdd: function( list ) {
|
||||
var answers = list.find( this.option( 'selectors.form.item' ) );
|
||||
|
||||
// Ограничиваем кол-во добавляемых ответов
|
||||
if ( list.find( this.option( 'selectors.form.item' ) ).length == this.option( 'max' ) ) {
|
||||
if ( answers.length == this.option( 'max' ) ) {
|
||||
ls.msg.error( null, ls.lang.get( 'poll.notices.error_answers_max' ) );
|
||||
return;
|
||||
} else if ( answers.length == 2 ) {
|
||||
answers.find( this.option( 'selectors.form.item_remove' ) ).show();
|
||||
}
|
||||
|
||||
var item = $( this.option( 'selectors.form.item' ) + '[data-is-template=true]' ).clone().removeAttr( 'data-is-template' ).show();
|
||||
|
@ -178,10 +182,10 @@
|
|||
* @param {jQuery} button Кнопка удаления
|
||||
*/
|
||||
answerRemove: function( list, button ) {
|
||||
if ( list.find( this.option( 'selectors.form.item' ) ).length == 1 ) {
|
||||
// TODO: Fix text
|
||||
ls.msg.error( null, ls.lang.get( 'poll.notices.error_answers_max' ) );
|
||||
return;
|
||||
var answers = list.find( this.option( 'selectors.form.item' ) );
|
||||
|
||||
if ( answers.length == 3 ) {
|
||||
answers.find( this.option( 'selectors.form.item_remove' ) ).hide();
|
||||
}
|
||||
|
||||
button.closest( this.option( 'selectors.form.item' ) ).fadeOut(200, function () {
|
||||
|
|
|
@ -24,6 +24,6 @@
|
|||
|
||||
{* Кнопка удаления *}
|
||||
{if $bPollIsAllowRemove|default:true}
|
||||
<i class="icon-remove poll-form-answer-item-remove js-poll-form-answer-item-remove" title="{$aLang.common.remove}"></i>
|
||||
<i class="icon-remove poll-form-answer-item-remove js-poll-form-answer-item-remove" title="{$aLang.common.remove}" {if ! $smarty.local.showRemove|default:true}style="display: none"{/if}></i>
|
||||
{/if}
|
||||
</li>
|
|
@ -63,7 +63,8 @@
|
|||
bPollIsAllowRemove = $oPoll->isAllowUpdate() && ! $oAnswer->getCountVote()}
|
||||
{/foreach}
|
||||
{else}
|
||||
{include './poll.form.item.tpl'}
|
||||
{include './poll.form.item.tpl' showRemove=false}
|
||||
{include './poll.form.item.tpl' showRemove=false}
|
||||
{/if}
|
||||
</ul>
|
||||
</div>
|
||||
|
|
Loading…
Reference in a new issue