Marcus
Well-known member
From this suggestion: http://xenforo.com/community/threads/user-interface-hide-poll-options-when-creating-a-thread.1362/ Vote for it if you want to implement it to the core. This template modification will add a phrased "Add poll" button between "Add file" and "Preview"
which turns on the then deactivated poll options.
Like this post if you install this modification.
New installation advice from Morgain for template thread_create:
Old installation advice: In template thread_create replace everything after <!-- slot: after_editor --> with
which turns on the then deactivated poll options.
Like this post if you install this modification.
New installation advice from Morgain for template thread_create:
I got it to work nicely but it always makes me nervous to replace a large amount of code all at once.
So I went through it and made notes on exactly where to insert 3 bits of new code.
FIRST
Rich (BB code):<input type="submit" value="{xen:phrase create_thread}" accesskey="s" class="button primary" /> <xen:include template="attachment_upload_button" /> <!– ADD –> <input type="button" value="{xen:phrase post_poll}" class="button DisableOnSubmit JsOnly" id="button_post_poll") /> <!– END ADD –>
SECOND
Rich (BB code):<xen:hook name="thread_create_fields_extra" params="{xen:array 'forum={$forum}'}" /> <!– ADD –> <div id="post_poll" style="display:none"> <!– END ADD –>]
THIRD
Rich (BB code):<input type="submit" value="{xen:phrase create_thread}" class="button primary" /> <input type="button" value="{xen:phrase preview}..." class="button PreviewButton JsOnly" /> </dd> </dl> <!– ADD –> </div> <script>$('#button_post_poll').click(function() { $('#post_poll').slideToggle(); });</script> <!– END ADD –> <input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" /> </form> <xen:comment><xen:include template="editor" /></xen:comment>
Old installation advice: In template thread_create replace everything after <!-- slot: after_editor --> with
Code:
<!-- slot: after_editor -->
<dl class="ctrlUnit submitUnit">
<dt></dt>
<dd>
<input type="submit" value="{xen:phrase create_thread}" accesskey="s" class="button primary" />
<xen:include template="attachment_upload_button" />
<input type="button" value="{xen:phrase post_poll}" class="button DisableOnSubmit JsOnly" id="button_post_poll") />
<input type="button" value="{xen:phrase preview}..." class="button PreviewButton JsOnly" />
</dd>
</dl>
<xen:if is="{$attachmentParams}">
<dl class="ctrlUnit AttachedFilesUnit">
<dt><label for="ctrl_uploader">{xen:phrase attached_files}:</label></dt>
<dd><xen:include template="attachment_editor" /></dd>
</dl>
<!-- slot: after_attachment -->
</xen:if>
<xen:if is="{$visitor.user_id}">
<fieldset>
<dl class="ctrlUnit">
<dt>{xen:phrase options}:</dt>
<dd><ul>
<li><xen:include template="helper_thread_watch_input" /></li>
</ul></dd>
</dl>
<xen:include template="thread_fields_status" />
</fieldset>
<!-- slot: after_options -->
</xen:if>
<xen:hook name="thread_create_fields_extra" params="{xen:array 'forum={$forum}'}" />
<div id="post_poll" style="display:none">
<h3 class="textHeading">{xen:phrase post_poll}</h3>
<dl class="ctrlUnit">
<dt><label for="ctrl_poll_question">{xen:phrase question}:</label></dt>
<dd><input type="text" name="poll[question]" class="textCtrl" id="ctrl_poll_question" maxlength="100" /></dd>
</dl>
<dl class="ctrlUnit">
<dt>{xen:phrase possible_responses}:</dt>
<dd>
<ul class="PollResponseContainer">
<li><input type="text" name="poll[responses][]" class="textCtrl" placeholder="{xen:phrase poll_choice}..." maxlength="100" /></li>
<li><input type="text" name="poll[responses][]" class="textCtrl" placeholder="{xen:phrase poll_choice}..." maxlength="100" /></li>
</ul>
<input type="button" value="{xen:phrase add_additional_response}" class="button smallButton FieldAdder" data-source="ul.PollResponseContainer li" data-maxfields="{$xenOptions.pollMaximumResponses}" />
</dd>
</dl>
<!-- slot: after_poll_responses -->
<dl class="ctrlUnit">
<dt></dt>
<dd>
<ul>
<li><label for="ctrl_poll_multiple"><input type="checkbox" name="poll[multiple]" value="1" id="ctrl_poll_multiple" /> {xen:phrase allow_selection_of_multiple_responses}</label></li>
<li><label for="ctrl_poll_public_votes"><input type="checkbox" name="poll[public_votes]" value="1" id="ctrl_poll_public_votes" /> {xen:phrase display_votes_publicly}</label></li>
<li><label for="ctrl_poll_close"><input type="checkbox" name="poll[close]" value="1" class="Disabler" id="ctrl_poll_close" /> {xen:phrase close_this_poll_after}:</label>
<ul id="ctrl_poll_close_Disabler">
<li>
<input type="text" size="5" name="poll[close_length]" value="7" class="textCtrl autoSize" />
<select name="poll[close_units]" class="textCtrl autoSize">
<option value="hours">{xen:phrase hours}</option>
<option value="days" selected="selected">{xen:phrase days}</option>
<option value="weeks">{xen:phrase weeks}</option>
<option value="months">{xen:phrase months}</option>
</select>
</li>
</ul>
</li>
</ul>
</dd>
</dl>
</xen:hook>
<dl class="ctrlUnit submitUnit">
<dt></dt>
<dd>
<input type="submit" value="{xen:phrase create_thread}" class="button primary" />
<input type="button" value="{xen:phrase preview}..." class="button PreviewButton JsOnly" />
</dd>
</dl>
</div>
<script>$('#button_post_poll').click(function() {
$('#post_poll').slideToggle();
});</script>
<input type="hidden" name="_xfToken" value="{$visitor.csrf_token_page}" />
</form>
<xen:comment><xen:include template="editor" /></xen:comment>