Supplier adding and arranging tables

This commit is contained in:
2014-07-01 17:46:19 +02:00
parent de576d54d9
commit 639a707679
14 changed files with 24448 additions and 22627 deletions
+1 -1
View File
@@ -22,7 +22,7 @@ class List
attr_protected :supplier_id
validates :table_id, presence: true
#validates :table_id, presence: true, table can be deleted
validates :supplier_id, presence: true
view :by_supplier_id_and_id, key: [:supplier_id, :_id]
+14 -10
View File
@@ -46,28 +46,32 @@ class Section
def width=(val)
val = val.to_f
return val if width == val
self.path[0] ||= [0.0, 0.0]
self.path[1] ||= [0.0, 0.0]
self.path[2] ||= [0.0, 0.0]
self.path[3] ||= [0.0, 0.0]
unless path[1][0] == val && path[2][0] == val
self.path[1][0] = val
self.path[2][0] = val
path_will_change!
end
path[0][0] = 0
path[1][0] = val
path[2][0] = val
path[3][0] = 0
path_will_change!
val
end
def height=(val)
val = val.to_f
return val if height == val
self.path[0] ||= [0.0, 0.0]
self.path[1] ||= [0.0, 0.0]
self.path[2] ||= [0.0, 0.0]
self.path[3] ||= [0.0, 0.0]
unless path[2][1] == val && path[3][1] == val
self.path[2][1] = val
self.path[3][1] = val
path_will_change!
end
path[0][1] = 0
path[1][1] = 0
path[2][1] = val
path[3][1] = val
path_will_change!
val
end
def tables_with_active_list_id