Add weekday selection and client side date formatting

This commit is contained in:
2013-02-19 09:32:24 +01:00
parent 43073e10f8
commit c5f6813765
17 changed files with 89 additions and 12 deletions
+10
View File
@@ -3,6 +3,7 @@ class ProductCategory
property :name
property :position, type: Fixnum, default: 0
property :week_days, type: Array, default: Array.new(7, 1)
belongs_to :supplier
has_and_belongs_to_many :products, storing_keys: true
@@ -14,6 +15,15 @@ class ProductCategory
validates :supplier_id, presence: true
view :by_supplier_id_and_id, key: [:supplier_id, :_id]
#alias orignal_week_days= week_days=
def week_days=(ary)
#write_attribute(:week_days, ary.map(&:to_i))
typecasted_value = ary.map(&:to_i)
#return typecasted_value if @week_days == typecasted_value
week_days_will_change! unless @skip_dirty_tracking || typecasted_value == week_days
@week_days = typecasted_value
end
def self.for_user(user, options = {})
table = options[:table]
raise "ProductCategory.for_user requires a table" unless table.present?
+1
View File
@@ -6,6 +6,7 @@ class Supplier
property :name
property :open, type: :boolean, default: false
property :time_zone, default: 'UTC'
property :night_offset, type: Float
#LOCATION