<xf:if is="$question.isInsert()">
	<xf:title>{{ phrase('add_question') }}</xf:title>
<xf:else />
	<xf:title>{{ phrase('edit_question:') }} {$question.question}</xf:title>
</xf:if>

<xf:pageaction if="$question.isUpdate()">
	<xf:button href="{{ link('captcha-questions/delete', $question) }}" icon="delete" overlay="true" />
</xf:pageaction>

<xf:form action="{{ link('captcha-questions/save', $question) }}" ajax="true" class="block">
	<div class="block-container">
		<div class="block-body">
			<xf:textboxrow name="question" value="{{ $question.exists() ? $question.question : '' }}"
				maxlength="{{ max_length($question, 'question') }}"
				label="{{ phrase('question') }}" />

			<xf:formrow rowtype="input"
				label="{{ phrase('correct_answers') }}"
				explain="{{ phrase('captcha_question_answers_explain') }}">

				<ul class="inputList">
					<xf:foreach loop="$question.answers" value="$answer">
						<li class="u-inputSpacer">
							<xf:textbox name="answers[]" value="{$answer}" placeholder="{{ phrase('answer...') }}" />
						</li>
					</xf:foreach>
					<li data-xf-init="field-adder">
						<xf:textbox name="answers[]" value="" placeholder="{{ phrase('answer...') }}" />
					</li>
				</ul>
			</xf:formrow>

			<hr class="formRowSep" />

			<xf:checkboxrow>
				<xf:option name="active" value="1" selected="$question.active"
					label="{{ phrase('question_is_active') }}"
					hint="{{ phrase('inactive_questions_are_not_presented_to_visitors') }}" />
			</xf:checkboxrow>
		</div>
		<xf:submitrow sticky="true" icon="save" />
	</div>
</xf:form>