{{js_template|safe}}
<div class="wrapper-comp-settings is-active editor-with-buttons" id="settings-tab">
    <form id="poll-form">
    <ul class="list-input settings-list" id="poll-line-items">
        <li class="field comp-setting-entry is-set">
            <div class="wrapper-comp-setting">
                <label class="label setting-label poll-setting-label" for="poll-display-name">Display Name</label>
                <!-- In the case of surveys, this field will actually be used for block_name. -->
                <input class="input setting-input" name="display_name" id="poll-display-name" value="{{ display_name }}" type="text" />
            </div>
        </li>
        {% if not multiquestion %}
            <li class="field comp-setting-entry is-set">
              <h2><label for="poll-question-editor">Question/Prompt</label></h2>
              <a href="//daringfireball.net/projects/markdown/syntax" target="_blank">Markdown Syntax</a> is supported.
              <div id="poll-question-editor-container">
                <textarea class="input setting-input" name="question" id="poll-question-editor"
                          aria-describedby="poll-question-editor-help">{{question}}</textarea>
              </div>
              <span class="tip setting-help" id="poll-question-editor-help">Enter the prompt for the user.</span>
            </li>
        {% endif %}
        <li class="field comp-setting-entry is-set">
           <h2><label for="poll-feedback-editor">Feedback</label></h2>
           <a href="//daringfireball.net/projects/markdown/syntax" target="_blank">Markdown Syntax</a> is supported.
           <div id="poll-feedback-editor-container">
             <textarea class="input setting-input" name="feedback" id="poll-feedback-editor"
                       aria-describedby="poll-feedback-editor-help">{{feedback}}</textarea>
           </div>
            <span class="tip setting-help" id="poll-feedback-editor-help">
                This text will be displayed for the user as some extra feedback after they have
                submitted their response to the poll.
            </span>
        </li>
        <li class="field comp-setting-entry is-set">
            <div class="wrapper-comp-setting">
                <label class="label setting-label poll-setting-label" for="poll-private-results">Private Results</label>
                <select id="poll-private-results" class="input setting-input" name="private_results"
                        aria-describedby="poll-private-results-help">
                    <!-- So far as I can see, there's not a proper style for checkboxes. LTI module does it this way. -->
                    <option value="true" {% if private_results %} selected{% endif %}>True</option>
                    <option value="false" {% if not private_results %} selected{% endif %}>False</option>
                </select>
            </div>
            <span class="tip setting-help" id="poll-private-results-help">
                If this is set to True, don't display results of the poll to the user.
            </span>
        </li>
        <li class="field comp-setting-entry is-set">
            <div class="wrapper-comp-setting">
                <label class="label setting-label poll-setting-label" for="poll-max-submissions">Maximum Submissions</label>
                <input id="poll-max-submissions" type="number" min="0" step="1" value="{{ max_submissions }}"
                       aria-describedby="poll-max-submissions-help"/>
            </div>
            <span class="tip setting-help" id="poll-max-submissions-help">
                Maximum number of times a user may submit a poll. <strong>Setting this to a value other than 1 will imply that
                'Private Results' should be true.</strong> Setting it to 0 will allow infinite resubmissions.
            </span>
        </li>
        <li class="field comp-setting-entry is-set">
            <p>
                <strong>Notes:</strong>
                If you change an answer's text, all students who voted for that choice will have their votes updated to
                the new text. You'll want to avoid changing an answer from something like 'True' to 'False', accordingly.
                If you delete an answer, any votes for that answer will also be deleted. Students whose choices are deleted
                may vote again, but will not lose course progress.
            </p>
            {%  if multiquestion %}
                <p>
                    Questions must be similarly cared for. If a question's text is changed, any votes for that question will remain.
                    If a question is deleted, any student who previously took the survey will be permitted to retake it, but will not
                    lose course progress.
                </p>
            {% endif %}
        </li>
        <li id="poll-answer-marker"></li>
        <li id="poll-answer-end-marker"></li>
        <li id="poll-question-marker"></li>
        <li id="poll-question-end-marker"></li>
    </ul>
    <div class="xblock-actions">
        <ul>
            <li class="action-item" id="poll-add-answer">
                <a href="#" class="button action-button" class="poll-add-item-link" onclick="return false;">Add Answer</a>
            </li>
            {% if multiquestion %}
                <li class="action-item" id="poll-add-question">
                    <a href="#" class="button action-button" class="poll-add-item-link" onclick="return false;">Add Question</a>
                </li>
            {% endif %}
            <li class="action-item">
                <input id="poll-submit-options" type="submit" class="button action-primary save-button" value="Save" onclick="return false;" />
            </li>
            <li class="action-item">
                <a href="#" class="button cancel-button">Cancel</a>
            </li>
        </ul>
    </div>
    </form>
</div>
