Move user to local storage part one, should work already
This commit is contained in:
@@ -101,11 +101,11 @@ class UserController < ApplicationController
|
||||
end
|
||||
|
||||
def list_products_for_table
|
||||
@table = Table.find(params[:table_id])
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
end
|
||||
format.json do
|
||||
@table = Table.find(params[:table_id])
|
||||
h = ProductCategory.for_user(current_user, table: @table)
|
||||
render json: h
|
||||
end
|
||||
@@ -114,8 +114,8 @@ class UserController < ApplicationController
|
||||
|
||||
# GET /user/join_occupied_table
|
||||
def join_occupied_table
|
||||
redirect_to user_root_path(message: 'table_not_found') and return unless params[:table_id].present?
|
||||
@table = Table.find(params[:table_id])
|
||||
#redirect_to user_root_path(message: 'table_not_found') and return unless params[:table_id].present?
|
||||
#@table = Table.find(params[:table_id])
|
||||
end
|
||||
|
||||
# POST /user/join_occupied_table
|
||||
@@ -219,11 +219,11 @@ class UserController < ApplicationController
|
||||
# Displays the closed lists of the user
|
||||
# GET /user/list_history
|
||||
def list_history
|
||||
@lists = List.for_user(current_user, page: params[:page], per_page: params[:per_page].presence || 14)
|
||||
@lists.include_relation(:supplier)
|
||||
respond_to do |format|
|
||||
format.html {}
|
||||
format.json do
|
||||
@lists = List.for_user(current_user, page: params[:page], per_page: params[:per_page].presence || 14)
|
||||
@lists.include_relation(:supplier)
|
||||
render json: @lists.inject(lists: [], current_page: @lists.current_page, num_pages: @lists.num_pages, total_count: @lists.total_count){|h, l| h[:lists] << l.as_json.merge(supplier_name: l.supplier.name); h}
|
||||
end
|
||||
end
|
||||
@@ -233,22 +233,23 @@ class UserController < ApplicationController
|
||||
# Displays a closed list of the user
|
||||
# GET /user/list_history/:list_id
|
||||
def history_list
|
||||
@list = List.find(params[:list_id])
|
||||
if params[:list_closed].present? && current_user.active_list_id == @list.id
|
||||
current_user.list_is_closed!
|
||||
flash.now[:notice] = t('messages.the_list_has_been_closed', list: List.model_name.human)
|
||||
end
|
||||
redirect_to user_root_path, alert: t('messages.illegal_history_list_attempt') and return unless @list.user_ids.include?(current_user.id)
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
end
|
||||
format.json do
|
||||
@list = List.find(params[:list_id])
|
||||
if params[:list_closed].present? && current_user.active_list_id == @list.id
|
||||
current_user.list_is_closed!
|
||||
flash.now[:notice] = t('messages.the_list_has_been_closed', list: List.model_name.human)
|
||||
end
|
||||
redirect_to user_root_path, alert: t('messages.illegal_history_list_attempt') and return unless @list.user_ids.include?(current_user.id)
|
||||
render json: @list.with_orders_as_json.merge(supplier_name: @list.supplier.name)
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
# POST /user/order_selected_products.json
|
||||
def order_selected_products
|
||||
if list.present?
|
||||
@list = list
|
||||
|
||||
Reference in New Issue
Block a user