Skip to content
Browse files

Accepted imports with commas, we convert it to dots

  • Loading branch information...
1 parent 71d5f1f commit b52a8041d5531da76a8a5be8bbfed9775e8e5fc9 Roger Campos committed Mar 17, 2012
Showing with 9 additions and 1 deletion.
  1. +8 −0 app/models/entry.rb
  2. +1 −1 app/views/entries/index.html.haml
View
8 app/models/entry.rb
@@ -93,6 +93,14 @@ def previous_entries
account.entries.ordered.where(Entry.arel_table[:cashed_at].lt(cashed_at).or(Entry.arel_table[:cashed_at].eq(cashed_at).and(Entry.arel_table[:order].lt(order))))
end
+ def import=(value)
+ if value.is_a?(String)
+ super(value.gsub(",", "."))
+ else
+ super
+ end
+ end
+
class << self
def recalculate_for(acc)
list = acc.entries.unverified.reversed
View
2 app/views/entries/index.html.haml
@@ -27,7 +27,7 @@
- if @can_write
#entry-form
= simple_form_for @entry do |f|
- - date = @entry.cashed_at.nil? ? "" : @entry.cashed_at
+ - date = @entry.cashed_at.nil? ? Date.today : @entry.cashed_at
.left= f.input :concept, :label => false, :placeholder => "Escriu el concepte"
.left= f.input :import, :label => false, :placeholder => "0"
.left= f.input :cashed_at, :as => :string, :label => false, :placeholder => Date.today, :input_html => { :value => date, :class => "datepicker" }

0 comments on commit b52a804

Please sign in to comment.
Something went wrong with that request. Please try again.