Add weekday selection and client side date formatting
This commit is contained in:
@@ -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?
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user