provide 'style' option to archive widget to choose between 'select' and 'list' format

This commit is contained in:
friendica 2014-03-23 16:20:44 -07:00
parent ba6765a403
commit 34eb79e6ba
3 changed files with 12 additions and 2 deletions

View File

@ -306,6 +306,7 @@ function widget_archive($arr) {
$wall = ((array_key_exists('wall', $arr)) ? intval($arr['wall']) : 0);
$style = ((array_key_exists('style', $arr)) ? $arr['style'] : 'select');
$url = z_root() . '/' . $a->cmd;
@ -318,6 +319,7 @@ function widget_archive($arr) {
'$title' => t('Archives'),
'$size' => ((count($ret) > 6) ? 6 : count($ret)),
'$url' => $url,
'$style' => $style,
'$dates' => $ret
));
return $o;

View File

@ -2114,7 +2114,7 @@ img.mail-list-sender-photo {
list-style-type: none;
}
#sidebar-group-list ul {
#sidebar-group-list ul, #posted-date-selector {
list-style-type: none;
}

View File

@ -1,9 +1,17 @@
<div id="datebrowse-sidebar" class="widget">
<h3>{{$title}}</h3>
<script>function dateSubmit(dateurl) { window.location.href = dateurl; } </script>
{{if $style == 'list'}}
<ul id="posted-date-selector">
{{foreach $dates as $d}}
<li class="posted-date-li"><a href="#" onclick="dateSubmit('{{$url}}?f=&dend={{$d.1}}&dbegin={{$d.2}}'); return false;">{{$d.0}}</a></li>
{{/foreach}}
</ul>
{{else}}
<select id="posted-date-selector" name="posted-date-select" onchange="dateSubmit($(this).val());" size="{{$size}}">
{{foreach $dates as $d}}
<option value="{{$url}}?dend={{$d.1}}&dbegin={{$d.2}}" >{{$d.0}}</option>
<option value="{{$url}}?f=&dend={{$d.1}}&dbegin={{$d.2}}" >{{$d.0}}</option>
{{/foreach}}
</select>
{{/if}}
</div>