diff --git a/application/frontend/common/js/poll-manage.js b/application/frontend/common/js/poll-manage.js
index fcf91a7b..26b51a85 100644
--- a/application/frontend/common/js/poll-manage.js
+++ b/application/frontend/common/js/poll-manage.js
@@ -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 () {
diff --git a/application/frontend/skin/developer/components/poll/poll.form.item.tpl b/application/frontend/skin/developer/components/poll/poll.form.item.tpl
index f2262240..e71c0064 100644
--- a/application/frontend/skin/developer/components/poll/poll.form.item.tpl
+++ b/application/frontend/skin/developer/components/poll/poll.form.item.tpl
@@ -24,6 +24,6 @@
{* Кнопка удаления *}
{if $bPollIsAllowRemove|default:true}
-
+
{/if}
\ No newline at end of file
diff --git a/application/frontend/skin/developer/components/poll/poll.form.tpl b/application/frontend/skin/developer/components/poll/poll.form.tpl
index 6474e1ef..dfa98276 100644
--- a/application/frontend/skin/developer/components/poll/poll.form.tpl
+++ b/application/frontend/skin/developer/components/poll/poll.form.tpl
@@ -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}