From 7f8a8e9e26a40cb9f2c2b8eabb0ed378998400d4 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Fri, 7 Sep 2012 15:45:18 +0200 Subject: [PATCH] better lists history --- app/controllers/user_controller.rb | 7 +------ app/views/user/history_list.html.slim | 2 ++ app/views/user/list_history.html.slim | 2 +- config/locales/en.yml | 2 +- 4 files changed, 5 insertions(+), 8 deletions(-) diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 9cb4453b..4dce251d 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -6,7 +6,6 @@ class UserController < ApplicationController def home handle_message_params - render layout: 'phone' end # POST /user/create_list {table_id: 1234} @@ -52,7 +51,6 @@ class UserController < ApplicationController respond_to do |format| format.html do handle_message_params - render layout: 'phone' end format.json do products = list.supplier.products @@ -124,7 +122,6 @@ class UserController < ApplicationController @table = Table.find(params[:table_id]) respond_to do |format| format.html do - render layout: 'phone' end format.json do products = @table.supplier.products @@ -143,7 +140,6 @@ class UserController < ApplicationController respond_to do |format| format.html do redirect_to(root_path, alert: t('messages.there_is_no_list_active')) and return unless list.present? - render layout: 'phone' end format.json do 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 def list_history @lists = List.for_user(current_user, page: params[:page], per_page: params[:per_page].presence || 14) - render layout: 'phone' + @lists.include_relation(:supplier) 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) respond_to do |format| format.html do - render layout: 'phone' end format.json do render json: @list.with_orders_as_json diff --git a/app/views/user/history_list.html.slim b/app/views/user/history_list.html.slim index 744fd549..61ef430c 100644 --- a/app/views/user/history_list.html.slim +++ b/app/views/user/history_list.html.slim @@ -2,6 +2,8 @@ dl.dl-horizontal dt= List.human_attribute_name(:created_at) dd= l @list.created_at, format: :short + dt= Supplier.model_name.human + dd= @list.supplier.name .well table#history-list-table.table thead diff --git a/app/views/user/list_history.html.slim b/app/views/user/list_history.html.slim index ef458df0..049ac106 100644 --- a/app/views/user/list_history.html.slim +++ b/app/views/user/list_history.html.slim @@ -2,4 +2,4 @@ = paginate @lists ul - 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) diff --git a/config/locales/en.yml b/config/locales/en.yml index 62e126b5..4a88d09d 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -89,7 +89,7 @@ en: title: Active %{list} needs_payment: Check please! history_list: - title: Previous %{list} + title: Closed %{list} show_products: # The title gets products: Product.model_name.human_plural that can be used: e.g.: Showing %{products} title: Menu