diff --git a/app/assets/javascripts/user/app/models/list.js.coffee b/app/assets/javascripts/user/app/models/list.js.coffee index fca22a61..7853fae0 100644 --- a/app/assets/javascripts/user/app/models/list.js.coffee +++ b/app/assets/javascripts/user/app/models/list.js.coffee @@ -16,7 +16,6 @@ App.List = DS.Model.extend table: DS.belongsTo('table') join_requests: DS.hasMany('join_request') users: DS.hasMany('user') - supplier_name: (-> @get('cached_supplier_name') or @get('supplier.name')).property('cached_supplier_name', 'supplier.name') is_extended_version: -> @get('extended_version') diff --git a/app/assets/javascripts/user/app/templates/lists/index.emblem b/app/assets/javascripts/user/app/templates/lists/index.emblem index 164b68c7..01303622 100644 --- a/app/assets/javascripts/user/app/templates/lists/index.emblem +++ b/app/assets/javascripts/user/app/templates/lists/index.emblem @@ -1,6 +1,7 @@ .row h2=t 'models.plural.list' - each list in lists: = view "list-index" contentBinding='list' + each list in lists + = view "list-index" content=list .clearfix if hasMore button{action "showMore"}=t 'lists.show_more' diff --git a/app/assets/javascripts/user/app/templates/lists/list_entry.emblem b/app/assets/javascripts/user/app/templates/lists/list_entry.emblem index 652a1a7d..cfc5d299 100644 --- a/app/assets/javascripts/user/app/templates/lists/list_entry.emblem +++ b/app/assets/javascripts/user/app/templates/lists/list_entry.emblem @@ -1,3 +1,3 @@ span.created_at=time list.created_at span.price.currency= currency list.price -span.name= list.supplier_name +span.name= list.cached_supplier_name diff --git a/app/controllers/users/lists_controller.rb b/app/controllers/users/lists_controller.rb index eabf4356..f245ad24 100644 --- a/app/controllers/users/lists_controller.rb +++ b/app/controllers/users/lists_controller.rb @@ -22,6 +22,7 @@ module Users def show list = List.find(params[:id]) + render json: {}, status: :not_found and return unless list.present? && Array.wrap(list.user_ids).include?(current_user.id) [list].include_relation(supplier: {product_categories: :products}, orders: :product_orders) # table also when it is a real array :) render json: list, serializer: UserExtendedListSerializer end diff --git a/app/serializers/user_extended_list_serializer.rb b/app/serializers/user_extended_list_serializer.rb index 9337c28c..4612eb68 100644 --- a/app/serializers/user_extended_list_serializer.rb +++ b/app/serializers/user_extended_list_serializer.rb @@ -9,12 +9,16 @@ class UserExtendedListSerializer < Qwaiter::Serializer # user ids for facebook pictures self.root = :list attributes :extended_version, :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price, - :table_id, :table_number, :section_id, :user_ids, :supplier_id, :closed_at + :table_id, :table_number, :section_id, :user_ids, :supplier_id, :closed_at, :cached_supplier_name #:supplier_orders_in_process_count, :supplier_orders_placed_count def has_active_orders object.has_active_orders? end + + def cached_supplier_name + object.supplier.name + end has_many :orders #has_many :product_categories has_one :table, serializer: UserExtendedTableSerializer # this one add a lot of stuff diff --git a/app/views/users/sessions/new.html.slim b/app/views/users/sessions/new.html.slim index bda31ea2..e68cfa01 100644 --- a/app/views/users/sessions/new.html.slim +++ b/app/views/users/sessions/new.html.slim @@ -12,8 +12,8 @@ h2= t('devise.sessions.title') = f.label :remember_me do = f.check_box :remember_me |  - = t('devise.sessions.remember_me') + = t('devise.sign_in.remember_me') .control-group .controls - = f.submit t('devise.sessions.button'), class: 'btn btn-primary' + = f.submit t('devise.sign_in.button'), class: 'button' = render "links" diff --git a/config/locales/en.yml b/config/locales/en.yml index 788fc460..c5a077b3 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -4,18 +4,10 @@ en: hello: "Hello world" page: not_found: "404 The page you were looking for could not be found" - menu: - home: Home - about: About - bars_restaurants: 'Bars & Restaurants' - clients: Gebruikers - enquete: Enquete - cartoon: Cartoon - contact: Contact helpers: links: are_you_sure: 'Are you sure?' - place_order: Place order + place_order: Place ${models.order} show_active_list: Show %{list} edit: Edit show: Show @@ -37,22 +29,22 @@ en: title: Actions #depricated, moved to user messages: - cannot_order_on_non_active_list: You cannot place an order on a closed list - no_active_list: There is no active list + cannot_order_on_non_active_list: You cannot place an ${models.order} on a closed ${models.list} + no_active_list: There is no active ${models.list} order_is_placed: Your order has been received in good order new_list_created: A new ${models.list} has been created - the_list_has_been_closed: The list has been closed - illegal_history_list_attempt: The list you want to access is not yours - table_not_found: The requested table cannot be found or is not given - table_is_occupied: The table you want to sit on is already occupied - table_is_reserved: The table you want to sit on is reserved by someone else - table_is_closed: The table you want to sit on is not available for service - supplier_is_closed: The owner of this table is currently not handling orders - join_request_rejected: Your request to join the table has been rejected - join_request_approved: Your request to join the table has been approved - table_is_from_other_supplier: You cannot move to another table when you have an open list - moved_to_another_table: You successfully moved to another table - cannot_identify_table: The application cannot determine the table number + the_list_has_been_closed: The ${models.list} has been closed + illegal_history_list_attempt: The ${models.list} you want to access is not yours + table_not_found: The requested ${models.table} cannot be found or is not given + table_is_occupied: The ${models.table} you want to sit on is already occupied + table_is_reserved: The ${models.table} you want to sit on is reserved by someone else + table_is_closed: The ${models.table} you want to sit on is not available for service + supplier_is_closed: The owner of this ${models.table} is currently not handling orders + join_request_rejected: Your request to join the ${models.table} has been rejected + join_request_approved: Your request to join the ${models.table} has been approved + table_is_from_other_supplier: You cannot move to another ${models.table} when you have an open ${models.list} + moved_to_another_table: You successfully moved to another ${models.table} + cannot_identify_table: The application cannot determine the ${models.table} ${attributes.table.number} action: index: label: Listing %{models} @@ -63,13 +55,13 @@ en: edit: label: Edit %{model} create: - successfull: '%{model} is successfully created' + successfull: '%{model} is successfully created' update: - successfull: '%{model} is successfully updated' + successfull: '%{model} is successfully updated' destroy: - successfull: '%{model} is successfully destroyed' + successfull: '%{model} is successfully destroyed' table: - is_occupied: This table is occupied + is_occupied: This ${models.table} is occupied general: boolean: boolean_yes: "Yes" diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 97b26880..c30e944c 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -3,14 +3,6 @@ nl: page: not_found: "404 de pagina die u probeert te bereiken kan niet worden gevonden" - menu: - home: Home - about: Over mozo.bar - bars_restaurants: 'Horeca' - clients: Gebruikers - enquete: Enquete - cartoon: Cartoon - contact: Contact helpers: links: are_you_sure: 'Weet je dit zeker?'