better lists history

This commit is contained in:
2012-09-07 15:45:18 +02:00
parent 3b29b5b985
commit 7f8a8e9e26
4 changed files with 5 additions and 8 deletions
+1 -6
View File
@@ -6,7 +6,6 @@ class UserController < ApplicationController
def home def home
handle_message_params handle_message_params
render layout: 'phone'
end end
# POST /user/create_list {table_id: 1234} # POST /user/create_list {table_id: 1234}
@@ -52,7 +51,6 @@ class UserController < ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
handle_message_params handle_message_params
render layout: 'phone'
end end
format.json do format.json do
products = list.supplier.products products = list.supplier.products
@@ -124,7 +122,6 @@ class UserController < ApplicationController
@table = Table.find(params[:table_id]) @table = Table.find(params[:table_id])
respond_to do |format| respond_to do |format|
format.html do format.html do
render layout: 'phone'
end end
format.json do format.json do
products = @table.supplier.products products = @table.supplier.products
@@ -143,7 +140,6 @@ class UserController < ApplicationController
respond_to do |format| respond_to do |format|
format.html do format.html do
redirect_to(root_path, alert: t('messages.there_is_no_list_active')) and return unless list.present? redirect_to(root_path, alert: t('messages.there_is_no_list_active')) and return unless list.present?
render layout: 'phone'
end end
format.json do format.json do
render json: list.with_orders_and_join_requests_as_json.merge(supplier_name: list.supplier.name) render json: list.with_orders_and_join_requests_as_json.merge(supplier_name: list.supplier.name)
@@ -199,7 +195,7 @@ class UserController < ApplicationController
# GET /user/list_history # GET /user/list_history
def list_history def list_history
@lists = List.for_user(current_user, page: params[:page], per_page: params[:per_page].presence || 14) @lists = List.for_user(current_user, page: params[:page], per_page: params[:per_page].presence || 14)
render layout: 'phone' @lists.include_relation(:supplier)
end end
## ##
@@ -214,7 +210,6 @@ class UserController < ApplicationController
redirect_to user_root_path, alert: t('messages.illegal_history_list_attempt') and return unless @list.user_ids.include?(current_user.id) 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| respond_to do |format|
format.html do format.html do
render layout: 'phone'
end end
format.json do format.json do
render json: @list.with_orders_as_json render json: @list.with_orders_as_json
+2
View File
@@ -2,6 +2,8 @@
dl.dl-horizontal dl.dl-horizontal
dt= List.human_attribute_name(:created_at) dt= List.human_attribute_name(:created_at)
dd= l @list.created_at, format: :short dd= l @list.created_at, format: :short
dt= Supplier.model_name.human
dd= @list.supplier.name
.well .well
table#history-list-table.table table#history-list-table.table
thead thead
+1 -1
View File
@@ -2,4 +2,4 @@
= paginate @lists = paginate @lists
ul ul
- for list in @lists - for list in @lists
li= link_to l(list.created_at, format: :short), user_history_list_path(list_id: list.id) li= link_to "#{l(list.created_at, format: :short)} - #{list.supplier.name}", user_history_list_path(list_id: list.id)
+1 -1
View File
@@ -89,7 +89,7 @@ en:
title: Active %{list} title: Active %{list}
needs_payment: Check please! needs_payment: Check please!
history_list: history_list:
title: Previous %{list} title: Closed %{list}
show_products: show_products:
# The title gets products: Product.model_name.human_plural that can be used: e.g.: Showing %{products} # The title gets products: Product.model_name.human_plural that can be used: e.g.: Showing %{products}
title: Menu title: Menu