From be754a86286d31b9b4e4f371b6f82ba3a47b2e19 Mon Sep 17 00:00:00 2001 From: Olivier PEREZ <olivier@olivierperez.fr> Date: Mon, 2 Feb 2015 21:14:24 +0100 Subject: [PATCH] Fix accessibility on classical polls --- app/inc/i18n.php | 1 + tpl/part/vote_table_classic.tpl | 4 ++-- tpl/part/vote_table_date.tpl | 11 +++++++---- 3 files changed, 10 insertions(+), 6 deletions(-) diff --git a/app/inc/i18n.php b/app/inc/i18n.php index e62cd7bf..02446c5e 100644 --- a/app/inc/i18n.php +++ b/app/inc/i18n.php @@ -72,6 +72,7 @@ $date_format['txt_full'] = _('%A, den %e. %B %Y'); //summary in choix_date.php a $date_format['txt_short'] = _('%A %e %B %Y'); // radio title $date_format['txt_day'] = _('%a %e'); $date_format['txt_date'] = _('%Y-%m-%d'); +$date_format['txt_year_month'] = _('%B %Y'); if (strtoupper(substr(PHP_OS, 0, 3)) == 'WIN') { //%e can't be used on Windows platform, use %#d instead foreach ($date_format as $k => $v) { $date_format[$k] = preg_replace('#(?<!%)((?:%%)*)%e#', '\1%#d', $v); //replace %e by %#d for windows diff --git a/tpl/part/vote_table_classic.tpl b/tpl/part/vote_table_classic.tpl index 23f5d99e..60f2080b 100644 --- a/tpl/part/vote_table_classic.tpl +++ b/tpl/part/vote_table_classic.tpl @@ -25,7 +25,7 @@ <tr> <th role="presentation"></th> {foreach $slots as $id=>$slot} - <th class="bg-info" id="H{$id}">{$slot->title|html|markdown}</th> + <th class="bg-info" id="C{$id}">{$slot->title|html|markdown}</th> {/foreach} <th></th> </tr> @@ -76,7 +76,7 @@ <th class="bg-info">{$vote->name|html}</th> - {foreach $vote->choices as $choice} + {foreach $vote->choices as $id=>$choice} {if $choice==2} <td class="bg-success text-success" headers="C{$id}"><span class="glyphicon glyphicon-ok"></span><span class="sr-only">{_('Yes')}</span></td> diff --git a/tpl/part/vote_table_date.tpl b/tpl/part/vote_table_date.tpl index c4196cd0..0412a7a2 100644 --- a/tpl/part/vote_table_date.tpl +++ b/tpl/part/vote_table_date.tpl @@ -29,7 +29,7 @@ <tr> <th role="presentation"></th> {foreach $slots as $id=>$slot} - <th colspan="{$slot->moments|count}" class="bg-primary month" id="M{$id}">{$slot->day|date_format:'%B %Y'|html}</th> + <th colspan="{$slot->moments|count}" class="bg-primary month" id="M{$id}">{$slot->day|date_format:$date_format.txt_year_month|html}</th> {for $foo=0 to ($slot->moments|count)-1} {append var='headersM' value=$id} {/for} @@ -40,6 +40,9 @@ <th role="presentation"></th> {foreach $slots as $id=>$slot} <th colspan="{$slot->moments|count}" class="bg-primary day" id="D{$id}">{$slot->day|date_format:$date_format.txt_day|html}</th> + {for $foo=0 to ($slot->moments|count)-1} + {append var='headersD' value=$id} + {/for} {/foreach} <th></th> </tr> @@ -49,7 +52,7 @@ {foreach $slots as $slot} {foreach $slot->moments as $id=>$moment} <th colspan="1" class="bg-info" id="H{$headersDCount}">{$moment|html}</th> - {append var='headersD' value=$headersDCount} + {append var='headersH' value=$headersDCount} {$headersDCount = $headersDCount+1} {/foreach} {/foreach} @@ -72,7 +75,7 @@ {foreach $vote->choices as $k=>$choice} - <td class="bg-info" headers="M{$headersM[$k]} D{$headersD[$k]} H{$k}"> + <td class="bg-info" headers="M{$headersM[$k]} D{$headersD[$k]} H{$headersH[$k]}"> <ul class="list-unstyled choice"> <li class="yes"> <input type="radio" id="y-choice-{$k}" name="choices[{$k}]" value="2" {if $choice==2}checked {/if}/> @@ -145,7 +148,7 @@ {$i = 0} {foreach $slots as $slot} {foreach $slot->moments as $moment} - <td class="bg-info" headers="M{$headersM[$i]} D{$headersD[$i]} H{$i}"> + <td class="bg-info" headers="M{$headersM[$i]} D{$headersD[$i]} H{$headersH[$i]}"> <ul class="list-unstyled choice"> <li class="yes"> <input type="radio" id="y-choice-{$i}" name="choices[{$i}]" value="2" /> -- GitLab