#51 : make empty vote different from 'No'

This commit is contained in:
ecmu 2016-03-19 10:30:49 +01:00
parent 8216bcbaa6
commit c857eac91c
2 changed files with 40 additions and 12 deletions

View File

@ -51,8 +51,11 @@
</div> </div>
</td> </td>
{foreach $slots as $id=>$slot} {* Parcourt "slots" et non "choices" pour prendre en compte aussi les colonnes non renseignées *} {$id=0} {* #51 : Parcoure les slots/moments pour y inclure les nouveaux items sans vote }
{assign var='choice' value=$vote->choices[$id]} {foreach $slots as $slot}
{foreach $slot->moments as $moment}
{$choice=$vote->choices[$id]}
<td class="bg-info" headers="C{$id}"> <td class="bg-info" headers="C{$id}">
<ul class="list-unstyled choice"> <ul class="list-unstyled choice">
@ -79,7 +82,11 @@
</li> </li>
</ul> </ul>
</td> </td>
{$id=$id + 1}
{/foreach}
{/foreach} {/foreach}
<td style="padding:5px"><button type="submit" class="btn btn-success btn-xs" name="save" value="{$vote->id|html}" title="{__('Poll results', 'Save the choices')} {$vote->name|html}">{__('Generic', 'Save')}</button></td> <td style="padding:5px"><button type="submit" class="btn btn-success btn-xs" name="save" value="{$vote->id|html}" title="{__('Poll results', 'Save the choices')} {$vote->name|html}">{__('Generic', 'Save')}</button></td>
</tr> </tr>
{elseif !$hidden} {* Voted line *} {elseif !$hidden} {* Voted line *}
@ -87,8 +94,10 @@
<th class="bg-info">{$vote->name|html}</th> <th class="bg-info">{$vote->name|html}</th>
{foreach $slots as $id=>$slot} {$id=0} {* #51 : Parcoure les slots/moments pour y inclure les nouveaux items sans vote }
{assign var='choice' value=$vote->choices[$id]} {foreach $slots as $slot}
{foreach $slot->moments as $moment}
{$choice=$vote->choices[$id]}
{if $choice=='2'} {if $choice=='2'}
<td class="bg-success text-success" headers="C{$id}"><i class="glyphicon glyphicon-ok"></i><span class="sr-only">{__('Generic', 'Yes')}</span></td> <td class="bg-success text-success" headers="C{$id}"><i class="glyphicon glyphicon-ok"></i><span class="sr-only">{__('Generic', 'Yes')}</span></td>
@ -96,10 +105,12 @@
<td class="bg-warning text-warning" headers="C{$id}">(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span></td> <td class="bg-warning text-warning" headers="C{$id}">(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span></td>
{elseif $choice=='0'} {elseif $choice=='0'}
<td class="bg-danger text-danger" headers="C{$id}"><i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span></td> <td class="bg-danger text-danger" headers="C{$id}"><i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span></td>
{else} {else} {* #51 : default value for unselected vote (new dates) *}
<td class="" headers="C{$id}">?<span class="sr-only">{__('Generic', 'Unknown')}</span></td> <td class="" headers="C{$id}">?<span class="sr-only">{__('Generic', 'Unknown')}</span></td>
{/if} {/if}
{$id=$id + 1}
{/foreach}
{/foreach} {/foreach}
{if $active && !$expired && {if $active && !$expired &&
@ -155,11 +166,14 @@
</label> </label>
</li> </li>
<li class="no"> <li class="no">
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value="0" checked/> <input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value="0" />
<label class="btn btn-default btn-xs startunchecked" for="n-choice-{$id}" title="{__('Poll results', 'Vote no for')|html} {$slot->title|html}"> <label class="btn btn-default btn-xs startunchecked" for="n-choice-{$id}" title="{__('Poll results', 'Vote no for')|html} {$slot->title|html}">
<i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span> <i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span>
</label> </label>
</li> </li>
<li style='display:none'> {* #51 : default value for unselected vote *}
<input type="radio" id="n-choice-{$id}" name="choices[{$id}]" value=" " checked/>
</li>
</ul> </ul>
</td> </td>
{/foreach} {/foreach}

View File

@ -99,8 +99,11 @@
</div> </div>
</td> </td>
{foreach $slots as $k=>$slot} {$k=0} {* #51 : Parcoure les slots/moments pour y inclure les nouveaux items sans vote }
{assign var='choice' value=$vote->choices[$k]} {foreach $slots as $slot}
{foreach $slot->moments as $moment}
{$choice=$vote->choices[$k]}
<td class="bg-info" headers="M{$headersM[$k]} D{$headersD[$k]} H{$headersH[$k]}"> <td class="bg-info" headers="M{$headersM[$k]} D{$headersD[$k]} H{$headersH[$k]}">
<ul class="list-unstyled choice"> <ul class="list-unstyled choice">
@ -127,7 +130,11 @@
</li> </li>
</ul> </ul>
</td> </td>
{$k=$k + 1}
{/foreach}
{/foreach} {/foreach}
<td style="padding:5px"><button type="submit" class="btn btn-success btn-xs" name="save" value="{$vote->id|html}" title="{__('Poll results', 'Save the choices')} {$vote->name|html}">{__('Generic', 'Save')}</button></td> <td style="padding:5px"><button type="submit" class="btn btn-success btn-xs" name="save" value="{$vote->id|html}" title="{__('Poll results', 'Save the choices')} {$vote->name|html}">{__('Generic', 'Save')}</button></td>
</tr> </tr>
@ -138,8 +145,10 @@
<th class="bg-info">{$vote->name|html}</th> <th class="bg-info">{$vote->name|html}</th>
{foreach $slots as $k=>$slot} {$k=0} {* #51 : Parcoure les slots/moments pour y inclure les nouveaux items sans vote }
{assign var='choice' value=$vote->choices[$k]} {foreach $slots as $slot}
{foreach $slot->moments as $moment}
{$choice=$vote->choices[$k]}
{if $choice=='2'} {if $choice=='2'}
<td class="bg-success text-success" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}"><i class="glyphicon glyphicon-ok"></i><span class="sr-only">{__('Generic', 'Yes')}</span></td> <td class="bg-success text-success" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}"><i class="glyphicon glyphicon-ok"></i><span class="sr-only">{__('Generic', 'Yes')}</span></td>
@ -147,10 +156,12 @@
<td class="bg-warning text-warning" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}">(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span></td> <td class="bg-warning text-warning" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}">(<i class="glyphicon glyphicon-ok"></i>)<span class="sr-only">{__('Generic', 'Ifneedbe')}</span></td>
{elseif $choice=='0'} {elseif $choice=='0'}
<td class="bg-danger text-danger" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}"><i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span></td> <td class="bg-danger text-danger" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}"><i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span></td>
{else} {else} {* #51 : default value for unselected vote (new dates) *}
<td class="" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}">?<span class="sr-only">{__('Generic', 'Unknown')}</span></td> <td class="" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}">?<span class="sr-only">{__('Generic', 'Unknown')}</span></td>
{/if} {/if}
{$k=$k + 1}
{/foreach}
{/foreach} {/foreach}
{if $active && !$expired && {if $active && !$expired &&
@ -207,11 +218,14 @@
</label> </label>
</li> </li>
<li class="no"> <li class="no">
<input type="radio" id="n-choice-{$i}" name="choices[{$i}]" value="0" checked/> <input type="radio" id="n-choice-{$i}" name="choices[{$i}]" value="0" />
<label class="btn btn-default btn-xs startunchecked" for="n-choice-{$i}" title="{__('Poll results', 'Vote no for')|html} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}"> <label class="btn btn-default btn-xs startunchecked" for="n-choice-{$i}" title="{__('Poll results', 'Vote no for')|html} {$slot->day|date_format:$date_format.txt_short|html} - {$moment|html}">
<i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span> <i class="glyphicon glyphicon-ban-circle"></i><span class="sr-only">{__('Generic', 'No')}</span>
</label> </label>
</li> </li>
<li style='display:none'> {* #51 : default value for unselected vote *}
<input type="radio" id="n-choice-{$i}" name="choices[{$i}]" value=" " checked/>
</li>
</ul> </ul>
</td> </td>
{$i = $i+1} {$i = $i+1}