section improvements, area elements mostly

This commit is contained in:
2015-03-03 16:43:57 +01:00
parent 196f998c38
commit c038ca3954
40 changed files with 679 additions and 55 deletions
@@ -124,14 +124,16 @@ module Suppliers
@section = Section.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
number_start = params[:number_start].to_i
number_end = params[:number_end].to_i
added_tables = []
for table_number in number_start..number_end
next if table_number.zero?
table = Table.new(number: table_number)
table.supplier = current_supplier
table.section = @section
table.save
added_tables << table
end
@section.arrange_tables_in_grid
@section.arrange_tables_in_grid added_tables
table_json = ActiveModel::ArraySerializer.new(@section.tables, each_serializer: SupplierTableSerializer, root: false).as_json
render json: {tables: table_json}
end