table management fixes

This commit is contained in:
2013-01-12 13:34:00 +01:00
parent f6b28f84f0
commit b02951aaec
17 changed files with 164 additions and 76 deletions
@@ -49,11 +49,13 @@ private
message = args.first || ''
{ok: false, message: message}.merge(options).to_json
end
alias json_alert js_alert
def js_notice(*args)
options = args.extract_options!
message = args.first || ''
{ok: true, message: message}.merge(options).to_json
end
alias json_notice js_notice
# Return the hostname of the event server
def event_host
@@ -132,11 +132,11 @@ module Suppliers
def arrange_tables
@section = Section.find_by_supplier_id_and_id!(current_supplier.id, params[:id])
case params[:option]
when 'distributed' then @section.arrange_tables_in_grid
when 'by_row' then @section.arrange_tables_in_rows_of(params[:row_count].to_i)
when 'by_column' then @section.arrange_tables_in_columns_of(params[:column_count].to_i)
when 'distributed' then render(json: (@section.arrange_tables_in_grid ? {ok: true} : json_alert('messages.could_not_arrange_tables_distributed')))
when 'by_row' then render(json: (@section.arrange_tables_in_rows_of(params[:row_count].to_i) ? {ok: true} : json_alert('messages.could_not_arrange_tables_by_row')))
when 'by_column' then render(json: (@section.arrange_tables_in_columns_of(params[:column_count].to_i) ? {ok: true} : json_alert('messages.could_not_arrange_tables_by_column')))
else render(json: json_alert('messages.could_not_arrange_tables'))
end
render json: {ok: true}
end
end
end