section improvements, area elements mostly
This commit is contained in:
@@ -11,6 +11,7 @@ class Section
|
||||
has_many :lists
|
||||
has_many :orders
|
||||
has_many :section_elements
|
||||
has_many :section_areas
|
||||
|
||||
attr_protected :supplier_id
|
||||
|
||||
@@ -99,7 +100,7 @@ class Section
|
||||
@for_tables_as_json = h
|
||||
end
|
||||
|
||||
def arrange_tables_in_grid
|
||||
def arrange_tables_in_grid(tables = self.tables)
|
||||
w = width
|
||||
h = height
|
||||
n = tables.size
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
class SectionArea
|
||||
include SimplyStored::Couch
|
||||
include ActiveModel::SerializerSupport
|
||||
property :title
|
||||
property :width, type: Float, default: 2
|
||||
property :height, type: Float, default: 2
|
||||
property :position_x, type: Float, default: 0
|
||||
property :position_y, type: Float, default: 0
|
||||
property :rounded, type: :boolean, default: false
|
||||
belongs_to :section
|
||||
belongs_to :supplier
|
||||
|
||||
view :by_supplier_id, key: :supplier_id
|
||||
|
||||
def self.for_supplier(supplier)
|
||||
find_all_by_supplier_id(supplier.id)
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user