Skip to content

Commit

Permalink
Conditional year in table
Browse files Browse the repository at this point in the history
  • Loading branch information
pikesley committed Feb 20, 2016
1 parent 58b9e1c commit 7a74895
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 2 deletions.
3 changes: 2 additions & 1 deletion app/views/shared/_index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,6 @@
</div>

<%= render partial: 'shared/table', locals: {
metrics: @metrics
metrics: @metrics,
with_year: true
} %>
6 changes: 5 additions & 1 deletion app/views/shared/_table.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,11 @@
<tr>
<th colspan='4' class='day-marker'> <!-- bootstrap ignores this maybe? -->
<% date = Time.parse(day) %>
<%= date.strftime "%A %B #{date.day.ordinalize}" %>
<% header = date.strftime "%A %B #{date.day.ordinalize}" %>
<% if with_year %>
<% header = date.strftime "%A %B #{date.day.ordinalize} %Y" %>
<% end %>
<%= header %>
</th>
</tr>

Expand Down

0 comments on commit 7a74895

Please sign in to comment.