Sha256: 5fa1508f05a3512f18a2e8b3554ed2c55bb6faa4009d184c2d71c0e3131b0d59
Contents?: true
Size: 1.11 KB
Versions: 3
Compression:
Stored size: 1.11 KB
Contents
= KingFormat Define fields being of type date, currency or percent. When the fields are shown within KingList/KingForm views, their format is detected and the output is automatically formatted. Default formats of date and currency fields can be set or they take the current I18n.locale into account. KingFormat consists of two different formatting helper regions: == Model This is where you define the type of fields/attributes. Of course the model should somehow respond to those method names. class Document has_money_fields :gross_total, :net_total has_date_fields :created_at, :date has_percent_fields :discount ... end == View & Helper Output any model value through the function strfval() to ensure a consistent output. Further on you find select values for money-symbols and date formatting. A simple HAML example, without hussles: - dl_for(current_object) do |f| = f.show :net_total = f.show :gross_total = f.show :date = f.show :discount = f.show :net_total, :value=>strfval(current_object, :net_total) Copyright (c) 2009-2010 Georg Leciejewski, released under the MIT license
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
king_views-1.2.0 | king_format/README.rdoc |
king_views-1.1.6 | king_format/README.rdoc |
king_views-1.1.5 | king_format/README.rdoc |