Sha256: 19def45af6e30c9cce7eb76ec568be8c59dd71a5c62ad5b80c40c2f47483bb63
Contents?: true
Size: 1001 Bytes
Versions: 2
Compression:
Stored size: 1001 Bytes
Contents
module LogsHelper def cell(value) if @mode == :edit "<input type='text' value='#{h value}' />" else "<div>#{h value}</div>" end end # returns [Date(2009/8/1), nil, nil, Income, ..] def make_table_data(account) condition = { :conditions => {:date => @month_range}, } items = [ account.expenses.all(condition), account.incomes.all(condition), account.moves_from.all(condition), account.moves_to.all(condition), ].flatten(1) @month_range.map{|today| todays, items = items.partition{|m| m.date == today} positions = todays.map(&:position) max_position = (positions.empty?) ? 0 : positions.max (0..max_position).map{|i| day = (i==0) ? today : :no_date [ today, i, i == max_position, @cat_all.map{|cat| todays.find{|m| m.category == cat && m.position == i} }.unshift(day) ] } }.flatten(1) end end
Version data entries
2 entries across 2 versions & 2 rubygems
Version | Path |
---|---|
yhara-moneyrail-0.0.2 | app/helpers/logs_helper.rb |
moneyrail-0.0.2 | app/helpers/logs_helper.rb |