我有一个银行应用程序,显示一个语句表。目前,表格下面的代码有一列年份,旁边是每个月的列,旁边是每个银行帐户的列。我希望改变它,以便每年显示四个季度。我该怎么做呢?
%table
%thead
%tr
%th.year(rowspan=2) Year
%th.accounts{colspan: @customer.accounts.size} Accounts
%tr
- fetch_cu_accounts(@customer.id).each do |account|
%th= account.name
- @today.year.downto(@today.year - 3) do |year|
%tbody
- x = (@today.year == year) ? @today.month : 12
- x.downto(1) do |month|
%tr
- if month == x
%td{rowspan: x}= year
%td
- fetch_cu_accounts(@customer.id).each do |account|
%td
- stmt = account.statement(year, month)
= link_to 'View', url(:statements, :show, id: stmt.to_s)
= link_to image_tag('/icons/document-pdf.png', alt: 'Download PDF'), url(:statements, :show, id: stmt, format: :pdf), class: :pdf