Skip to content

Commit

Permalink
Clean up some list-view stuff
Browse files Browse the repository at this point in the history
  • Loading branch information
dave0 committed Feb 27, 2011
1 parent f509621 commit 23ee5bd
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 91 deletions.
24 changes: 1 addition & 23 deletions templates/pages/league/list.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,27 +3,5 @@
<form method="GET">
{html_options name="season" selected=$current_season->id options=$seasons onChange="form.submit()"}
</form>
<table id="leagues">
<thead>
<tr>
<th>Name</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{foreach from=$leagues item=l}
<tr>
<td><a href="{lr_url path="league/view/`$l->league_id`}">{$l->name}</a></td>
<td>{if $l->schedule_type != 'none'}
<a href="{lr_url path="schedule/view/`$l->league_id`}">schedule</a> &nbsp;
<a href="{lr_url path="league/standings/`$l->league_id`}">standings</a> &nbsp;
{/if}
{if session_perm("league/delete/`$l->league_id`")}
<a href="{lr_url path="league/delete/`$l->league_id`}">delete</a> &nbsp;
{/if}
</td>
</tr>
{/foreach}
</tbody>
</table>
{include file="pages/season/components/league_list.tpl"}
{include file=footer.tpl}
71 changes: 71 additions & 0 deletions templates/pages/season/components/league_list.tpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<table id="leagues">
<thead>
<tr>
<th>League Name</th>
<th>Day</th>
<th>Ratio</th>
<th>Status</th>
<th>&nbsp;</th>
</tr>
</thead>
<tbody>
{foreach from=$leagues item=i}
<tr>
<td><a href="{lr_url path="league/view/`$i->league_id`}">{$i->fullname}</a></td>
<td>{$i->day}</td>
<td>{$i->ratio}</td>
<td>{$i->status}</td>
<td>{if $i->schedule_type != 'none'}
<a href="{lr_url path="schedule/view/`$i->league_id`}">schedule</a> &nbsp;
<a href="{lr_url path="league/standings/`$i->league_id`}">standings</a> &nbsp;
{/if}
{if session_perm("league/delete/`$i->league_id`")}
<a href="{lr_url path="league/delete/`$i->league_id`}">delete</a> &nbsp;
{/if}
</td>
</tr>
{/foreach}
</tbody>
</table>
<script type="text/javascript">
{literal}
var daySort = {
'Sunday' : 1,
'Monday' : 2,
'Tuesday' : 3,
'Wednesday' : 4,
'Thursday' : 5,
'Friday' : 6,
'Saturday' : 7,
};
jQuery.fn.dataTableExt.oSort['day-of-week-desc'] = function(a,b) {
var x = daySort[ a.replace(/^Sunday,/g,"").replace(/,Saturday$/,"")+'' ];
var y = daySort[ b.replace(/^Sunday,/g,"").replace(/,Saturday$/,"")+'' ];
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['day-of-week-asc'] = function(a,b) {
var x = daySort[ a.replace(/^Sunday,/g,"").replace(/,Saturday$/,"")+'' ];
var y = daySort[ b.replace(/^Sunday,/g,"").replace(/,Saturday$/,"")+'' ];
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
$(document).ready(function() {
$('#leagues').dataTable( {
bPaginate: false,
bAutoWidth: false,
sDom: 'lfrtip',
bFilter: false,
bInfo: false,
bJQueryUI: true,
aaSorting: [[ 1, "asc" ]],
aoColumns: [
{ "sType" : "html" },
{ "sType" : "day-of-week" },
null,
null,
{ bSortable : false }
]
} );
})
{/literal}
</script>
7 changes: 0 additions & 7 deletions templates/pages/season/list.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,6 @@
<tr>
<td><a href="{lr_url path="season/view/`$s->id`}">{$s->display_name}</a></td>
<td>
{if session_perm("league/list")}
<a href="{lr_url path="league/list?season=`$s->id`"}">list leagues</a> &nbsp;
{/if}
{if session_perm("season/delete/`$s->id`")}
<a href="{lr_url path="season/delete/`$s->id`}">delete</a> &nbsp;
{/if}
</td>
</tr>
{/foreach}
</tbody>
Expand Down
62 changes: 1 addition & 61 deletions templates/pages/season/view.tpl
Original file line number Diff line number Diff line change
Expand Up @@ -6,65 +6,5 @@
<tr><td>Year:</td><td>{$season->year}</td></tr>
</table>
</div>
<table id="leagues">
<thead>
<tr>
<th>League Name</th>
<th>Day</th>
<th>Ratio</th>
<th>Status</th>
</tr>
</thead>
<tbody>
{foreach from=$leagues item=i}
<tr>
<td><a href="{lr_url path="league/view/`$i->league_id`}">{$i->fullname}</a></td>
<td>{$i->day}</td>
<td>{$i->ratio}</td>
<td>{$i->status}</td>
</tr>
{/foreach}
</tbody>
</table>
<script type="text/javascript">
{literal}
var daySort = {
'Sunday' : 1,
'Monday' : 2,
'Tuesday' : 3,
'Wednesday' : 4,
'Thursday' : 5,
'Friday' : 6,
'Saturday' : 7,
};
jQuery.fn.dataTableExt.oSort['day-of-week-desc'] = function(a,b) {
var x = daySort[ a.replace(/^Sunday,/g,"").replace(/,Saturday$/,"")+'' ];
var y = daySort[ b.replace(/^Sunday,/g,"").replace(/,Saturday$/,"")+'' ];
return ((x < y) ? -1 : ((x > y) ? 1 : 0));
};
jQuery.fn.dataTableExt.oSort['day-of-week-asc'] = function(a,b) {
var x = daySort[ a.replace(/^Sunday,/g,"").replace(/,Saturday$/,"")+'' ];
var y = daySort[ b.replace(/^Sunday,/g,"").replace(/,Saturday$/,"")+'' ];
return ((x < y) ? 1 : ((x > y) ? -1 : 0));
};
$(document).ready(function() {
$('#leagues').dataTable( {
bPaginate: false,
bAutoWidth: false,
sDom: 'lfrtip',
bFilter: false,
bInfo: false,
bJQueryUI: true,
aaSorting: [[ 1, "asc" ]],
aoColumns: [
{ "sType" : "html" },
{ "sType" : "day-of-week" },
null,
null
]
} );
})
{/literal}
</script>
{include file="pages/season/components/league_list.tpl"}
{include file=footer.tpl}

0 comments on commit 23ee5bd

Please sign in to comment.