Skip to content

Commit

Permalink
Working on #2972 Template Conversion to Twig Format (polls.php) (#3004)
Browse files Browse the repository at this point in the history
  • Loading branch information
Starpaul20 authored and euantorano committed Feb 3, 2018
1 parent 067261c commit b8b0e40
Show file tree
Hide file tree
Showing 4 changed files with 450 additions and 301 deletions.
89 changes: 89 additions & 0 deletions inc/views/base/polls/editpoll.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
{% extends 'layouts/master.twig' %}

{% block head %}
<title>{{ mybb.settings.bbname }} - {{ lang.edit_poll }}</title>
{% endblock head %}

{% block body %}
<form action="moderation.php" method="post">
<input type="hidden" name="my_post_key" value="{{ mybb.post_code }}" />
<table border="0" cellspacing="{{ theme.borderwidth }}" cellpadding="{{ theme.tablespace }}" class="tborder">
<tr>
<td class="thead" colspan="3"><strong>{{ lang.delete_poll }}</strong></td>
</tr>
<tr>
<td class="trow1" style="white-space: nowrap"><input type="checkbox" class="checkbox" name="delete" value="1" tabindex="9" /><strong>{{ lang.delete_q }}</strong></td>
<td class="trow1" width="100%">{{ lang.delete_note }}<br /><span class="smalltext">{{ lang.delete_note2|raw }}</span></td>
<td class="trow1" style="white-space: nowrap"><input type="submit" class="button" name="submit" value="{{ lang.delete_poll }}" tabindex="10" /></td>
</tr>
</table>
<input type="hidden" name="action" value="do_deletepoll" />
<input type="hidden" name="tid" value="{{ poll.tid }}" />
</form>
<br />
<form action="polls.php" method="post">
<input type="hidden" name="my_post_key" value="{{ mybb.post_code }}" />
<table border="0" cellspacing="{{ theme.borderwidth }}" cellpadding="{{ theme.tablespace }}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{{ lang.edit_poll }}</strong></td>
</tr>
{{ loginbox|raw }}
<tr>
<td class="trow2"><strong>{{ lang.question }}</strong></td>
<td class="trow2"><input type="text" class="textbox" name="question" size="40" maxlength="240" value="{{ select.question }}" /></td>
</tr>
<tr>
<td class="trow1" valign="top"><strong>{{ lang.num_options }}</strong><br /><span class="smalltext">{{ lang.max_options }} {{ mybb.settings.maxpolloptions }}</span></td>
<td class="trow1"><input type="text" class="textbox" name="numoptions" size="10" value="{{ select.numoptions }}" />&nbsp;<input type="submit" class="button" name="updateoptions" value="{{ lang.update_options }}" /></td>
</tr>
<tr>
<td class="trow2" valign="top"><strong>{{ lang.poll_options }}</strong></td>
<td class="trow2"><span class="smalltext">{{ lang.poll_options_note }}</span>
<table border="0" cellspacing="0" cellpadding="0">
{% for option in optionbits %}
<tr>
<td>{{ lang.option }} {{ option.id }}:&nbsp;</td>
<td><input type="text" class="textbox" name="options[{{ option.id }}]" value="{{ option.value }}" /></td>
<td>{{ lang.votes }}&nbsp;</td>
<td><input type="text" class="textbox" name="votes[{{ option.id }}]" value="{{ option.votes }}" /></td>
</tr>
{% endfor %}
</table>
</td>
</tr>
<tr>
<td class="trow1" valign="top"><strong>{{ lang.options }}</strong></td>
<td class="trow1"><span class="smalltext">
<label><input type="checkbox" class="checkbox" name="postoptions[multiple]" value="1"{% if select.postoptions.multiple %} checked="checked"{% endif %} />&nbsp;{{ lang.option_multiple|raw }}</label><br />
<span id="maxOptions" style="display: none"><strong>{{ lang.option_multiple_maxoptions }}</strong> <input type="text" class="textbox" name="maxoptions" value="{{ select.maxoptions }}" /><br /></span>
<script type="text/javascript">
//<!--
if($("input[name='postoptions[multiple]']").is(":checked")) {
$("#maxOptions").css("display", "");
}
$("input[name='postoptions[multiple]']").click(function() {
if($(this).is(":checked")) {
$("#maxOptions").css("display", "");
} else {
$("#maxOptions").css("display", "none");
}
});
// -->
</script>
<label><input type="checkbox" class="checkbox" name="postoptions[public]" value="1"{% if select.postoptions.public %} checked="checked"{% endif %} />&nbsp;{{ lang.option_public|raw }}</label><br />
<label><input type="checkbox" class="checkbox" name="postoptions[closed]" value="1"{% if select.postoptions.closed %} checked="checked"{% endif %} />&nbsp;{{ lang.option_closed|raw }}</label>
</span>
</td>
</tr>
<tr>
<td class="trow2" valign="top"><strong>{{ lang.poll_timeout }}</strong><br /><span class="smalltext">{{ lang.timeout_note }}</span></td>
<td class="trow2"><input type="text" class="textbox" name="timeout" value="{{ select.timeout }}" /> {{ lang.days_after }} {{ poll.polldate }}</td>
</tr>
</table>
<br />
<div align="center"><input type="submit" class="button" name="submit" value="{{ lang.update_poll }}" /></div>
<input type="hidden" name="action" value="do_editpoll" />
<input type="hidden" name="pid" value="{{ poll.pid }}" />
</form>
{% endblock body %}
70 changes: 70 additions & 0 deletions inc/views/base/polls/newpoll.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
{% extends 'layouts/master.twig' %}

{% block head %}
<title>{{ mybb.settings.bbname }} - {{ lang.post_new_poll }}</title>
{% endblock head %}

{% block body %}
<form action="polls.php" method="post">
<input type="hidden" name="my_post_key" value="{{ mybb.post_code }}" />
<table border="0" cellspacing="{{ theme.borderwidth }}" cellpadding="{{ theme.tablespace }}" class="tborder">
<tr>
<td class="thead" colspan="2"><strong>{{ lang.post_new_poll }}</strong></td>
</tr>
{{ loginbox|raw }}
<tr>
<td class="trow2"><strong>{{ lang.question }}</strong></td>
<td class="trow2"><input type="text" class="textbox" name="question" size="40" maxlength="240" value="{{ select.question }}" /></td>
</tr>
<tr>
<td class="trow1" valign="top"><strong>{{ lang.num_options }}</strong><br /><span class="smalltext">{{ lang.max_options }} {{ mybb.settings.maxpolloptions }}</span></td>
<td class="trow1"><input type="text" class="textbox" name="polloptions" size="10" value="{{ select.polloptions }}" />&nbsp;<input type="submit" class="button" name="updateoptions" value="{{ lang.update_options }}" /></td>
</tr>
<tr>
<td class="trow2" valign="top"><strong>{{ lang.poll_options }}</strong></td>
<td class="trow2"><span class="smalltext">{{ lang.poll_options_note }}</span>
<table border="0" cellspacing="0" cellpadding="0">
{% for option in optionbits %}
<tr>
<td>{{ lang.option }} {{ option.id }}:&nbsp;</td>
<td><input type="text" class="textbox" name="options[{{ option.id }}]" value="{{ option.value }}" size="25" /></td>
</tr>
{% endfor %}
</table>
</td>
</tr>
<tr>
<td class="trow1" valign="top"><strong>{{ lang.options }}</strong></td>
<td class="trow1"><span class="smalltext">
<label><input type="checkbox" class="checkbox" name="postoptions[multiple]" value="1"{% if select.postoptions.multiple %} checked="checked"{% endif %} />&nbsp;{{ lang.option_multiple|raw }}</label><br />
<span id="maxOptions" style="display: none"><strong>{{ lang.option_multiple_maxoptions }}</strong> <input type="text" class="textbox" name="maxoptions" value="0" /><br /></span>
<script type="text/javascript">
//<!--
if($("input[name='postoptions[multiple]']").is(":checked")) {
$("#maxOptions").css("display", "");
}
$("input[name='postoptions[multiple]']").click(function() {
if($(this).is(":checked")) {
$("#maxOptions").css("display", "");
} else {
$("#maxOptions").css("display", "none");
}
});
// -->
</script>
<label><input type="checkbox" class="checkbox" name="postoptions[public]" value="1"{% if select.postoptions.public %} checked="checked"{% endif %} />&nbsp;{{ lang.option_public|raw }}</label>
</span>
</td>
</tr>
<tr>
<td class="trow2" valign="top"><strong>{{ lang.poll_timeout }}</strong><br /><span class="smalltext">{{ lang.timeout_note }}</span></td>
<td class="trow2"><input type="text" class="textbox" name="timeout" value="{{ select.timeout }}" /> {{ lang.days }}</td>
</tr>
</table>
<br />
<div align="center"><input type="submit" class="button" name="submit" value="{{ lang.post_new_poll }}" /></div>
<input type="hidden" name="action" value="do_newpoll" />
<input type="hidden" name="tid" value="{{ thread.tid }}" />
</form>
{% endblock body %}
33 changes: 33 additions & 0 deletions inc/views/base/polls/showresults.twig
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{% extends 'layouts/master.twig' %}

{% block head %}
<title>{{ mybb.settings.bbname }} - {{ lang.poll_results }}</title>
{% endblock head %}

{% block body %}
<table border="0" cellspacing="{{ theme.borderwidth }}" cellpadding="{{ theme.tablespace }}" class="tborder tfixed">
<colgroup>
<col style="width: 35%;" />
<col style="width: 50%" />
<col style="width: 7%" />
</colgroup>
<tr>
<td class="thead" colspan="4" style="text-align: center;"><strong>{{ poll.question }}</strong></td>
</tr>
{% for polloption in polloptions %}
<tr>
<td class="{{ polloption.optionbg }} scaleimages" style="text-align: right;">{{ polloption.option|raw }}{{ polloption.votestar }}</td>
<td class="{{ polloption.optionbg }}">
<div class="pollbar" style="width: {{ polloption.imagewidth }}%" title="{{ polloption.percent }}%"><span class="percent">{{ polloption.percent }}%</span></div>{{ polloption.userlist|raw }}
</td>
<td class="{{ polloption.optionbg }}" style="text-align: center;">{{ polloption.votes }}</td>
<td class="{{ polloption.optionbg }}" style="text-align: center;">{{ polloption.percent }}%</td>
</tr>
{% endfor %}
<tr>
<td class="tfoot" colspan="2" style="text-align: right;"><strong>{{ lang.poll_total }}</strong></td>
<td class="tfoot" style="text-align: center;"><strong>{{ poll.numvotes }} {{ lang.poll_votes }}</strong></td>
<td class="tfoot" style="text-align: center;"><strong>{{ poll.totpercent }}</strong></td>
</tr>
</table>
{% endblock body %}

0 comments on commit b8b0e40

Please sign in to comment.