refactor and fixes for mobile
This commit is contained in:
@@ -4,10 +4,6 @@ class DashboardController < ApplicationController
|
||||
def home
|
||||
|
||||
end
|
||||
def phone_home
|
||||
flash.now[:notice] = t('messages.the_list_has_been_closed', list: List.model_name.human) if params[:list_closed].present?
|
||||
render layout: 'phone'
|
||||
end
|
||||
|
||||
# Testing action
|
||||
def select_qrcode
|
||||
@@ -15,41 +11,6 @@ class DashboardController < ApplicationController
|
||||
render layout: 'phone'
|
||||
end
|
||||
|
||||
def order_active_products_list
|
||||
respond_to do |format|
|
||||
format.html do
|
||||
redirect_to(root_path, alert: t('messages.cannot_order_without_list_id')) and return if params[:list_id].blank?
|
||||
@list = List.find(params[:list_id])
|
||||
redirect_to(root_path, alert: t('messages.cannot_order_on_non_active_list')) and return unless @list.active?
|
||||
@list.place_order current_user, params[:products]
|
||||
redirect_to root_path, notice: t('messages.order_is_placed')
|
||||
end
|
||||
format.js do
|
||||
render js: js_alert(t('messages.cannot_order_without_list_id')) and return if params[:list_id].blank?
|
||||
@list = List.find(params[:list_id])
|
||||
render js: js_alert(t('messages.cannot_order_on_non_active_list')) and return unless @list.active?
|
||||
@list.place_order current_user, params[:products]
|
||||
render js: js_notice( t('messages.order_is_placed') )
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
# GET /suppliers/1/product_list
|
||||
# GET /suppliers/1/product_list.json
|
||||
def product_list
|
||||
@supplier = active_list.supplier
|
||||
respond_to do |format|
|
||||
format.html # show.html.erb
|
||||
format.json do
|
||||
products = active_list.supplier.products
|
||||
products.include_relation(:product_categories)
|
||||
products.sort_by!{|p| p.product_category.try(:position) || 90000}
|
||||
h = products.inject({}){|h, p| n = p.product_category.try(:name) || 'other'; h[n] ||= []; h[n] << p; h}
|
||||
render json: h
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
|
||||
def supplier_home
|
||||
redirect_to active_orders_supplier_path(Supplier.first)
|
||||
|
||||
Reference in New Issue
Block a user