From f08d19a50b357f0c9fabf1b271b765689b9622d5 Mon Sep 17 00:00:00 2001 From: Benjamin ter Kuile Date: Sun, 13 Jan 2013 12:21:30 +0100 Subject: [PATCH] major updates to security and hacking logick --- Gemfile | 1 + Gemfile.lock | 3 + .../images/supplier/settings/iens-example.png | Bin 0 -> 16316 bytes .../javascripts/supplier/translations.js.erb | 1 + app/assets/javascripts/user/quser.js.coffee | 14 +- .../stylesheets/supplier/darkstrap.sass | 12 +- app/controllers/user_controller.rb | 69 ++++++---- app/models/supplier.rb | 6 + app/models/user.rb | 2 +- app/views/supplier/edit.html.slim | 64 ++++++--- .../application/_error_messages.html.slim | 7 + config/locales/en.yml | 115 +--------------- config/locales/models.en.yml | 34 +++++ config/locales/models.nl.yml | 40 ++++++ config/locales/nl.yml | 127 +----------------- config/locales/supplier.en.yml | 61 +++++++++ config/locales/supplier.nl.yml | 61 +++++++++ config/locales/user.en.yml | 29 ++++ config/locales/user.nl.yml | 29 ++++ 19 files changed, 379 insertions(+), 296 deletions(-) create mode 100644 app/assets/images/supplier/settings/iens-example.png create mode 100644 app/views/suppliers/application/_error_messages.html.slim create mode 100644 config/locales/models.en.yml create mode 100644 config/locales/models.nl.yml create mode 100644 config/locales/supplier.en.yml create mode 100644 config/locales/supplier.nl.yml create mode 100644 config/locales/user.en.yml create mode 100644 config/locales/user.nl.yml diff --git a/Gemfile b/Gemfile index 1a3f16ed..ae832ad1 100644 --- a/Gemfile +++ b/Gemfile @@ -52,6 +52,7 @@ group :development do gem 'pry-remote' gem 'rspec-rails' gem 'guard-rspec' + gem 'quiet_assets' gem 'thin' end diff --git a/Gemfile.lock b/Gemfile.lock index 04e31264..3d81aa9b 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -155,6 +155,8 @@ GEM pry-remote (0.1.6) pry (~> 0.9) slop (~> 3.0) + quiet_assets (1.0.1) + railties (~> 3.1) rack (1.4.1) rack-cache (1.2) rack (>= 0.4) @@ -274,6 +276,7 @@ DEPENDENCIES mustache pry pry-remote + quiet_assets rack-cors rails (= 3.2.9) rb-fsevent diff --git a/app/assets/images/supplier/settings/iens-example.png b/app/assets/images/supplier/settings/iens-example.png new file mode 100644 index 0000000000000000000000000000000000000000..f06cf4568d56f04adea51cfc5c81de7c7098b905 GIT binary patch literal 16316 zcmV;tKSRKYP)4Tx09XmFS!Y-j&9d&9jf5rVjO3iNi>mdKqA z@mrh^(by5e90)!c=x1*ATV5RzW#I5z-WC*P?u1|#gfki#ZRY$N&qs$i>m!&4k#B~C zTT=LlpI{D>w~Z}=nGh`O6KRO}o-!7!nh@yZ`kQ0r>t|$)U}P1+Zsc%>Km5SR7{@>I zgoHptn?L+uq6H=1bO=9_NJh|(J#evKs3~RKU5NZjM3f!HPRdvVq)?mRbAf05$tDyI zMZWGAxiepiZGlmNPG*Q4u^Gh>MRuZakU64w{DVx)5scV|k`E-C{gLZMgzl_qq%X>e z9PL2ygD`^q{YcIfA5!F*zC)phQR3eRREEb5Sb4M z2cgJG7NGyrf_aY_#=ONm!%Smd{E;C&fAc^P@I~-ny8fjo)jpeaydFzdtC2{J;8m|J~z1Z88C~ zhzA1xFy!mx7vwkp^#5nZSYxaa)(mTcl|ZGVZlZco_fU^eZKx(7fa*Xsqxw;IDfqWt ze?}o95{g$S9*zW-h!_1p^v*BRpYi_9OVNKberuqUq*DP7NG}oyLE3`;9>HbD>Y)G7 z5{)ptkr9ItuI1nH_-z+j6!ESK+5oMM_!;prnhnhbWYEfp$Mw;=NDNdE=|55Y_u0q* z{~d3~?93$uyhr8{7UdTgg{&oD7#OFwA=bCQp&w1A?#f)b$Yy%Y`r z-yL@LRETZx9~m(e0ChzGs15#+g(GXTz7TmF&io@2MV>QG4FGO9_(YRq{?do0+%U+F zPLDhloPZAq0dd45ia-@;0X<+0EPyR=0`6cRvW5de7-DfOI0TM>G>`>yK_NH`%0VTl z0aw8d&;;7RJ@5cL21DQ(cnPM#JMa-KffcX;K@biiK+F&)#1Dx;Qjj8~4(UL~kQL+r zxkFx107Qb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list = $('

    ').appendTo(container) if wrapper.num_pages && wrapper.num_pages > 1 for i in [1..wrapper.num_pages] @@ -224,7 +226,7 @@ class Quser li.addClass('active') else callback = ((i)-> - -> + -> Qstorage.page = i window.Quser.load_list_history() )(i) @@ -240,9 +242,7 @@ class Quser Mustache.to_html($(selector).html(), locs) build_list_table: (body, foot, res) -> body.find('tr').remove() - if !res.orders && !res.orders.length - Qwaiter.alert('No orders in list') - return + return unless res.orders m_obj = res body.append @mustache('#active-list-order-template', new Order(order)) for order in m_obj.orders $('.list-total-amount').html(currency(m_obj.total_amount)) @@ -265,9 +265,9 @@ class Quser return if res['message'] && !res['ok'] - redirect_to 'user_root', {message: res['message']} - else - redirect_to res.location || 'list_products' if res['ok'] + redirect_to res.location || 'user_root', $.extend({message: res['message']}, res.location_params) + else if res.ok + redirect_to res.location || 'list_products', $.extend({message: res['message']}, res.location_params) build_product_list: -> total = 0.0 h = {products: []} diff --git a/app/assets/stylesheets/supplier/darkstrap.sass b/app/assets/stylesheets/supplier/darkstrap.sass index 0f9486b0..eaef076d 100644 --- a/app/assets/stylesheets/supplier/darkstrap.sass +++ b/app/assets/stylesheets/supplier/darkstrap.sass @@ -9,11 +9,12 @@ // =Forms // =Tables // =Pagination +// =Accordion // =Misc $color: #c6c6c6 $bg: #2f2f2f -$link: #0088cc +$link: #FAA732 $warning: #faa732 $success: #5bb75b @@ -39,6 +40,10 @@ $input-color: white body background: $bg color: $color + a + color: $link + &:hover + color: lighten($link, 10%) //=Breadcrumbs ======================================= .breadcrumb @@ -264,6 +269,11 @@ legend .progress @extend .well +//=Accordion +.accordion-group + .accordion-heading + background-color: rgba(200, 200, 200, 0.3) + //=Misc ======================================== blockquote border-left-color: #111 diff --git a/app/controllers/user_controller.rb b/app/controllers/user_controller.rb index 4c0ae973..c6c29efd 100644 --- a/app/controllers/user_controller.rb +++ b/app/controllers/user_controller.rb @@ -1,6 +1,6 @@ class UserController < ApplicationController before_filter :allow_mobile - before_filter :user_authentication, except: [:obtain_token, :index] + before_filter :user_authentication, :unless => ->(c){ %w(obtain_token index).include?(c.action_name) || c.request.format.symbol == :html } # , except: [:obtain_token, :index] layout 'phone' def user_authentication @@ -50,34 +50,37 @@ class UserController < ApplicationController # POST /user/create_list {table_id: 1234} #DEPRICATED def create_list + render nothing: true and return unless current_user.present? @table = Table.find(params[:table_id]) if @table.occupied? respond_to do |format| - format.html { redirect_to root_path, alert: t('table.is_occupied') } - format.json { render json: js_alert(t('messages.table_is_occupied'))} + format.html { redirect_to user_root_path, alert: t('messages.table_is_occupied') } + format.json { render json: json_alert('messages.table_is_occupied')} end else if @list = List.from_table( @table, current_user ) end respond_to do |format| format.html { redirect_to user_list_products_path } - format.json { render json: js_notice('table_created')} + format.json { render json: json_notice('messages.new_list_created')} end end end + # GET /user/table_info.json def table_info - @table = Table.find(params[:table_id]) - res = {} - res[:occupied] = @table.occupied? - res[:reserved] = @table.reserved? - res[:supplier_closed] = @table.supplier.closed? - if list.present? - res[:other_supplier] = true if list.supplier_id != @table.supplier_id - res[:current_table_id] = list.table_id - end respond_to do |format| format.json do + render json: json_alert('messages.table_not_found') and return unless params[:table_id].present? + @table = Table.find(params[:table_id]) + res = {} + res[:occupied] = @table.occupied? + res[:reserved] = @table.reserved? + res[:supplier_closed] = @table.supplier.closed? + if list.present? + res[:other_supplier] = true if list.supplier_id != @table.supplier_id + res[:current_table_id] = list.table_id + end render json: res end end @@ -113,6 +116,7 @@ class UserController < ApplicationController format.html do end format.json do + render json: json_alert('messages.table_not_found') and return unless params[:table_id].present? @table = Table.find(params[:table_id]) h = ProductCategory.for_user(current_user, table: @table) render json: h @@ -128,6 +132,7 @@ class UserController < ApplicationController # POST /user/join_occupied_table def request_to_join_occupied_table + render json: json_alert('messages.table_not_found') and return unless params[:table_id].present? @table = Table.find(params[:table_id]) if @list = @table.active_list @list.send_table_join_request_for_user! current_user @@ -135,20 +140,24 @@ class UserController < ApplicationController render nothing: true end + # POST /user/reject_join_request?user_id=1 def reject_join_request - return unless params[:user_id] + render js: '' and return unless params[:user_id].present? list && list.reject_join_request_for_user!(params[:user_id]) render js: '' end + + # POST /user/approve_join_request?user_id=1 def approve_join_request - return unless params[:user_id] + render js: '' and return unless params[:user_id].present? @user = User.find(params[:user_id]) list && list.approve_join_request_for_user!(@user) render nothing: true end - # POST /user/check_table_join_status table_id:12345 + # POST /user/check_table_join_status.json table_id:12345 def check_table_join_status + render json: json_alert('messages.table_not_found') and return unless params[:table_id].present? @table = Table.find(params[:table_id]) if @list = @table.active_list if @list.user_ids.include?(current_user.id) @@ -169,7 +178,7 @@ class UserController < ApplicationController def active_list respond_to do |format| format.html do - redirect_to(root_path, alert: t('messages.there_is_no_list_active')) and return unless list.present? + redirect_to(user_root_path, alert: t('messages.there_is_no_list_active')) and return unless list.present? end format.json do render json: js_alert(t('messages.the_list_has_been_closed')) and return unless list.present? @@ -205,7 +214,7 @@ class UserController < ApplicationController def needs_help respond_to do |format| format.json do - render json: {list_active: false} and return unless list.present? + render json: json_alert('messages.no_active_list', list_active: false) and return unless list.present? list.needs_help! render json: list.as_json.merge(list_active: list.active?) end @@ -216,7 +225,7 @@ class UserController < ApplicationController def list_needs_payment respond_to do |format| format.json do - render json: {list_active: false} and return unless list.present? + render json: json_alert('messages.no_active_list', list_active: false) and return unless list.present? list.needs_payment! render json: list.as_json.merge(list_active: list.active?) end @@ -246,11 +255,11 @@ class UserController < ApplicationController end format.json do @list = List.find(params[:list_id]) + render json: json_alert('messages.illegal_history_list_attempt') and return unless @list.user_ids.include?(current_user.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 @@ -262,10 +271,10 @@ class UserController < ApplicationController if list.present? @list = list else - render json: js_alert('table_not_found') and return unless params[:table_id].present? + render json: json_alert('messages.table_not_found') and return unless params[:table_id].present? @table = Table.find(params[:table_id]) if @table.occupied? - render json: js_alert('table_is_occupied') + render json: json_alert('messages.table_is_occupied', location: :join_occupied_table, location_params: {table_id: @table.id}) else if @list = List.from_table( @table, current_user ) else @@ -275,19 +284,20 @@ class UserController < ApplicationController end respond_to do |format| format.html do - redirect_to(root_path, alert: t('messages.cannot_order_on_non_active_list')) and return unless @list.active? + redirect_to(user_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') + redirect_to user_root_path, notice: t('messages.order_is_placed') end - format.js do - render js: js_alert(t('messages.cannot_order_on_non_active_list')) and return unless @list.active? + format.json do + render json: json_alert('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'), location: :active_list) + render json: json_notice('messages.order_is_placed', location: :active_list) end end end + def move_table - return unless list.present? + render json: json_alert('messages.no_active_list', list_active: false) and return unless list.present? @table = Table.find(params[:table_id]) if @table.occupied? render json: {occupied: true} @@ -298,11 +308,14 @@ class UserController < ApplicationController end private + def handle_message_params flash.now[:notice] = t('messages.the_list_has_been_closed', list: List.model_name.human) if params[:list_closed].present? flash.now[:notice] = t("messages.#{params[:message]}", list: List.model_name.human, supplier: Supplier.model_name.human) if params[:message].present? && params[:message] =~ /^\w+$/ end + # General handler of json responses. Will be able to set some additional communication data. + # By default a response is ok. def json_response(obj = {}) obj[:ok] = true unless obj.has_key?(:ok) obj diff --git a/app/models/supplier.rb b/app/models/supplier.rb index 8a1d5c3c..6f56a510 100644 --- a/app/models/supplier.rb +++ b/app/models/supplier.rb @@ -6,6 +6,8 @@ class Supplier property :name property :open, type: :boolean, default: false property :night_offset, type: Float + + #LOCATION property :lat, type: Float, default: 52.08062426379751 property :lng, type: Float, default: 4.312562942504883 @@ -15,6 +17,9 @@ class Supplier property :wifi_type property :wifi_password + #REVIEWS + property :iens_profile + #has_many :orders, through: :lists has_many :products, dependent: :destroy has_many :product_categories, dependent: :destroy @@ -29,6 +34,7 @@ class Supplier view :by_email, key: :email validates :name, presence: true + validates :iens_profile, numericality: true def location=(val) lat, lng = val.strip.split(/[ ,]+/).map(&:to_f) diff --git a/app/models/user.rb b/app/models/user.rb index 9a1412f9..353666ac 100644 --- a/app/models/user.rb +++ b/app/models/user.rb @@ -3,7 +3,7 @@ class User include Devise::Orm::SimplyStored property :active_list_id - devise :database_authenticatable, :recoverable, :rememberable, :trackable, :registerable, :token_authenticatable + devise :database_authenticatable, :recoverable, :rememberable, :trackable, :token_authenticatable # , :registerable has_and_belongs_to_many :lists, storing_keys: false has_many :orders diff --git a/app/views/supplier/edit.html.slim b/app/views/supplier/edit.html.slim index 83f6156e..0cd4dc01 100644 --- a/app/views/supplier/edit.html.slim +++ b/app/views/supplier/edit.html.slim @@ -2,7 +2,7 @@ = javascript_include_tag 'https://maps.googleapis.com/maps/api/js?v=3.exp&sensor=false' = form_for @supplier, url: supplier_update_settings_path, html: {class: 'form-horizontal'} do |f| - = render 'error_messages', target: current_supplier + = render 'suppliers/application/error_messages', target: current_supplier .control-group class=(@supplier.errors[:name].any? ? 'error' : nil) = f.label :name, class: 'control-label' .controls @@ -11,27 +11,47 @@ = f.label :email, class: 'control-label' .controls = f.text_field :email, class: 'text_field' - .control-group class=(@supplier.errors[:location].any? ? 'error' : nil) - = f.label :location, class: 'control-label' - .controls - = f.text_field :location, class: 'location_picker' - .control-group class=(@supplier.errors[:offer_wifi].any? ? 'error' : nil) - = f.label :offer_wifi, class: 'control-label' - .controls - = f.check_box :offer_wifi, class: 'checkbox' - .control-group class=(@supplier.errors[:wifi_ssid].any? ? 'error' : nil) - = f.label :wifi_ssid, class: 'control-label' - .controls - = f.text_field :wifi_ssid, class: 'text_field' - .control-group class=(@supplier.errors[:wifi_type].any? ? 'error' : nil) - = f.label :wifi_type, class: 'control-label' - .controls - = f.select :wifi_type, options_for_select([['web', 'web40'], ['WPA2 Personal', 'wpa2personal']], @supplier.wifi_type) - .control-group class=(@supplier.errors[:wifi_password].any? ? 'error' : nil) - = f.label :wifi_password, class: 'control-label' - .controls - = f.text_field :wifi_password, class: 'text_field' - + #settings-sections.accordion + .accordion-group + .accordion-heading + a.accordion-toggle data-toggle="collapse" data-parent="#settings-sections" href="#settings-location" data-t="attributes.supplier.location" + #settings-location.accordion-body.collapse.in + .accordion-inner + .control-group class=(@supplier.errors[:location].any? ? 'error' : nil) + = f.label :location, class: 'control-label' + .controls + = f.text_field :location, class: 'location_picker' + .accordion-group + .accordion-heading + a.accordion-toggle data-toggle="collapse" data-parent="#settings-sections" href="#settings-wifi" data-t="attributes.supplier.offer_wifi" + #settings-wifi.accordion-body.collapse + .control-group class=(@supplier.errors[:offer_wifi].any? ? 'error' : nil) + = f.label :offer_wifi, class: 'control-label' + .controls + = f.check_box :offer_wifi, class: 'checkbox' + .control-group class=(@supplier.errors[:wifi_ssid].any? ? 'error' : nil) + = f.label :wifi_ssid, class: 'control-label' + .controls + = f.text_field :wifi_ssid, class: 'text_field' + .control-group class=(@supplier.errors[:wifi_type].any? ? 'error' : nil) + = f.label :wifi_type, class: 'control-label' + .controls + = f.select :wifi_type, options_for_select([['web', 'web40'], ['WPA2 Personal', 'wpa2personal']], @supplier.wifi_type) + .control-group class=(@supplier.errors[:wifi_password].any? ? 'error' : nil) + = f.label :wifi_password, class: 'control-label' + .controls + = f.text_field :wifi_password, class: 'text_field' + .accordion-group + .accordion-heading + a.accordion-toggle data-toggle="collapse" data-parent="#settings-sections" href="#settings-reviews" data-t="settings.reviews.title" + #settings-reviews.accordion-body.collapse class=(@supplier.errors[:iens_profile].any? ? 'in' : nil) + .control-group class=(@supplier.errors[:iens_profile].any? ? 'error' : nil) + = f.label :iens_profile, class: 'control-label', data: {t: 'attributes.supplier.iens_profile'} + .controls + = f.text_field :iens_profile, class: 'text_field' + ' + = image_tag 'supplier/settings/iens-example.png', title: 'supplier.settings.reviews.explanation' + .form-actions = f.submit nil, class: 'btn btn-primary' ' diff --git a/app/views/suppliers/application/_error_messages.html.slim b/app/views/suppliers/application/_error_messages.html.slim new file mode 100644 index 00000000..5c3a5704 --- /dev/null +++ b/app/views/suppliers/application/_error_messages.html.slim @@ -0,0 +1,7 @@ +-if target.errors.any? + .alert.alert-error + button type="button" class="close" data-dismiss="alert" × + h4 data-t="helpers.forms.errors.title" data-t-attributes=%[{"count":#{target.errors.count}}] = t('helpers.forms.errors.title', :count => target.errors.count) + ul + - for message in target.errors.full_messages + li= message diff --git a/config/locales/en.yml b/config/locales/en.yml index 811429bd..afca83fc 100644 --- a/config/locales/en.yml +++ b/config/locales/en.yml @@ -31,7 +31,9 @@ en: no_records: There are no items present messages: cannot_order_on_non_active_list: You cannot place an order on a closed list + no_active_list: There is no active 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 @@ -62,119 +64,6 @@ en: table: is_occupied: This table is occupied has_no_section: "Not placed" - activemodel: - models: - user: User - supplier: Restaurant - table: Table - list: List - product: Product - order: Order - product_category: Product category - section: Section - plural: - user: Users - supplier: Restaurants - table: Tables - list: Lists - product: Products - order: Orders - product_category: Product categories - section: Sections - attributes: - product: - price: Price - list: - created_at: Created - state: Status - needs_help: Needs attention - needs_payment: Wants to pay - closed_at: Closed at - supplier: - messages: - could_not_arrange_tables: 'The tables could not be arranged' - could_not_arrange_tables_distributed: 'The tables could not be arranged. Does the ${models.section|downcase} have a width and a height?' - could_not_arrange_tables_by_row: 'The tables could not be arranged. Does the ${models.section|downcase} have a width and a height?' - could_not_arrange_tables_by_column: 'The tables could not be arranged. Does the ${models.section|downcase} have a width and a height?' - menu: - active_lists: Active lists - active_lists: - title: Active list - price: Price - active_orders: - title: Active %{orders} - price: Price - close: Close the shop - you_are_currently_closed_alert: 'You are currently closed and not able to take orders' - mark_as_open_button: 'Open up the place!' - table_number: Table - tables: - qr_codes: - link: Qr codes sheet - lists: - show: - title: Show %{list} - section: - first_section_title: Room - show: - title: 'Show ${models.section|downcase}' - manage_tables: - link: 'Manage tables' - title: "Manage tables for ${models.section|downcase}: %{title}" - tables_view: - link: 'Tables view' - add_tables: - button_label: Add tables - modal: - title: Add tables - body_header: "" - number_start: From number - number_end: Till number - close_button: Close - add_button: Add - arrange_tables: - button_label: Arrange tables - by_row_no_row_count: 'Please fill in a positive number representing the number of ${models.plural.table|downcase} per row' - by_column_no_column_count: 'Please fill in a positive number representing the number of ${models.plural.table|downcase} per column' - modal: - title: Arrange tables - body_header: "" - distributed: Distributed - by_row: By row - by_row_count: of - by_column: By column - by_column_count: of - close_button: Close - arrange_button: Distribute - - user: - active_list: - title: Active list - needs_payment: Check please! - history_list: - title: Closed list - list_history: - title: Closed lists - show_products: - # The title gets products: Product.model_name.human_plural that can be used: e.g.: Showing %{products} - title: Menu - join_occupied_table: - title: This table is occupied - join_this_table: Join this table - show_the_products: Show me the menu - back: Back - home: - scan_qr: Scan qr code - show_active_list: Show my orders - show_active_list_products: Go to the menu - basket: - total: Total - product_category: - other_name: Overig - obtain_token: - title: Authenticate Qwaiter - obtain: Authenticate - invalid_combination: The email password combination is incorrect general: boolean: boolean_yes: "Yes" diff --git a/config/locales/models.en.yml b/config/locales/models.en.yml new file mode 100644 index 00000000..a40767a7 --- /dev/null +++ b/config/locales/models.en.yml @@ -0,0 +1,34 @@ + activemodel: + models: + user: User + supplier: Restaurant + table: Table + list: List + product: Product + order: Order + product_category: Product category + section: Section + plural: + user: Users + supplier: Restaurants + table: Tables + list: Lists + product: Products + order: Orders + product_category: Product categories + section: Sections + attributes: + product: + price: Price + list: + created_at: Created + state: Status + needs_help: Needs attention + needs_payment: Wants to pay + closed_at: Closed at + supplier: + name: Name + email: 'Email' + password: 'Password' + password_confirmation: 'Confirmation' + iens_profile: Iens profile id diff --git a/config/locales/models.nl.yml b/config/locales/models.nl.yml new file mode 100644 index 00000000..ccfc3f13 --- /dev/null +++ b/config/locales/models.nl.yml @@ -0,0 +1,40 @@ +nl: + activemodel: + models: + user: Gebruiker + supplier: Restaurant + table: Tafel + list: Lijst + product: Product + order: Bestelling + product_category: Product categorie + section: Afdeling + plural: + user: Gebruikers + supplier: Restaurants + table: Tafels + list: Lijsten + product: Producten + order: Bestellingen + product_category: Product categorieen + section: Afdelingen + attributes: + product: + price: Prijs + list: + created_at: Aangemaakt + state: Status + needs_help: Vraag actief + needs_payment: Rekening gevraagd + closed_at: Afgesloten op + price: Prijs + section: + title: Titel + width: Breedte + height: Lengte + supplier: + name: Naam + email: 'E-mail' + password: 'Wachtwoord' + password_confirmation: 'Bevestiging' + iens_profile: Iens profiel id diff --git a/config/locales/nl.yml b/config/locales/nl.yml index 49253e21..fbf92c2f 100644 --- a/config/locales/nl.yml +++ b/config/locales/nl.yml @@ -21,7 +21,7 @@ nl: cancel: Terug forms: errors: - title: Er zijn een problemen opgetreden (%{count}) + title: 'De actie kon niet worden uitgevoerd. %{count} fout(en)' submit: create: '%{model} toevoegen' update: '%{model} bewaren' @@ -30,7 +30,9 @@ nl: no_records: Er zijn geen items aanwezig messages: cannot_order_on_non_active_list: Je kan niet bestellen op een gesloten lijst + no_active_list: Er is momenteel geen lijst actief order_is_placed: Je bestelling is in goede orde aangekomen + new_list_created: Een nieuwe ${models.list} is aangemaakt the_list_has_been_closed: De lijst is afgesloten illegal_history_list_attempt: Je probeert een lijst op te vragen die niet van jou is table_not_found: De gezochte tafel kan niet worden gevonden of is niet opgegeven @@ -61,129 +63,6 @@ nl: table: is_occupied: Deze tafel is bezet has_no_section: "Niet geplaatst" - activemodel: - models: - user: Gebruiker - supplier: Restaurant - table: Tafel - list: Lijst - product: Product - order: Bestelling - product_category: Product categorie - section: Afdeling - plural: - user: Gebruikers - supplier: Restaurants - table: Tafels - list: Lijsten - product: Producten - order: Bestellingen - product_category: Product categorieen - section: Afdelingen - attributes: - product: - price: Prijs - list: - created_at: Aangemaakt - state: Status - needs_help: Vraag actief - needs_payment: Rekening gevraagd - closed_at: Afgesloten op - price: Prijs - section: - title: Titel - width: Breedte - height: Lengte - supplier: - name: Naam - email: 'E-mail' - password: 'Wachtwoord' - password_confirmation: 'Bevestiging' - supplier: - messages: - could_not_arrange_tables: 'De ${models.plural.table} konden niet worden gepositioneerd' - could_not_arrange_tables_distributed: 'De ${models.plural.table} konden niet worden gepositioneerd. Heeft de ${models.section|downcase} een hoogte en breedte?' - could_not_arrange_tables_by_row: 'De ${models.plural.table} konden niet worden gepositioneerd. Heeft de ${models.section|downcase} een hoogte en breedte?' - could_not_arrange_tables_by_column: 'De ${models.plural.table} konden niet worden gepositioneerd. Heeft de ${models.section|downcase} een hoogte en breedte?' - menu: - active_lists: Actieve %{lists} - active_lists: - title: Actieve %{lists} - price: Prijs - active_orders: - title: Actieve %{orders} - price: Prijs - close: De zaak afsluiten voor bestellingen - you_are_currently_closed_alert: 'Je bent momenteel gesloten en kan geen orders ontvangen' - mark_as_open_button: 'Open de zaak!' - table_number: Tafel - tables: - qr_codes: - link: Qr codes - lists: - show: - title: "%{list} tonen" - section: - first_section_title: Ruimte - show: - title: 'Toon ${models.section|downcase}' - manage_tables: - link: 'Tafels beheren' - title: "Tafels beheren voor ${models.section|downcase}: %{title}" - tables_view: - link: Tafel overzicht - add_tables: - button_label: Voeg tafels toe - modal: - title: Voeg tafels toe - body_header: "" - number_start: Vanaf nummer - number_end: Tot nummer - close_button: Sluiten - add_button: Voeg toe - arrange_tables: - button_label: Positioneer tafels - by_row_no_row_count: 'Geef een positief getal voor het aantal ${models.plural.table|downcase} per rij' - by_column_no_column_count: 'Geef een positief getal voor het aantal ${models.plural.table|downcase} per kolom' - modal: - title: Positioneer tafels - body_header: "" - distributed: Verspreid - by_row: Per rij - by_row_count: van - by_column: Per kolom - by_column_count: van - close_button: Sluiten - arrange_button: Positioneer - - user: - active_list: - title: Actieve lijst - needs_payment: Rekening vragen! - history_list: - title: Afgesloten lijst - list_history: - title: Afgesloten lijsten - show_products: - # The title gets products: Product.model_name.human_plural that can be used: e.g.: Showing %{products} - title: Menu - join_occupied_table: - title: Deze tafel is bezet - join_this_table: Ik wil ook bestellen bij deze tafel - show_the_products: Laat me het menu zien - back: Terug - home: - scan_qr: Scan qr code - show_active_list: Toon mijn bestellingen - show_active_list_products: Ga naar het menu - basket: - total: Totaal - product_category: - other_name: Overig - obtain_token: - title: Aanmelden bij Qwaiter - obtain: Aanmelden - invalid_combination: De inloggegevens zijn onjuist general: boolean: boolean_yes: "Ja" diff --git a/config/locales/supplier.en.yml b/config/locales/supplier.en.yml new file mode 100644 index 00000000..3adf9998 --- /dev/null +++ b/config/locales/supplier.en.yml @@ -0,0 +1,61 @@ +en: + supplier: + messages: + could_not_arrange_tables: 'The tables could not be arranged' + could_not_arrange_tables_distributed: 'The tables could not be arranged. Does the ${models.section|downcase} have a width and a height?' + could_not_arrange_tables_by_row: 'The tables could not be arranged. Does the ${models.section|downcase} have a width and a height?' + could_not_arrange_tables_by_column: 'The tables could not be arranged. Does the ${models.section|downcase} have a width and a height?' + menu: + active_lists: Active lists + active_lists: + title: Active list + price: Price + active_orders: + title: Active %{orders} + price: Price + close: Close the shop + you_are_currently_closed_alert: 'You are currently closed and not able to take orders' + mark_as_open_button: 'Open up the place!' + table_number: Table + tables: + qr_codes: + link: Qr codes sheet + lists: + show: + title: Show %{list} + section: + first_section_title: Room + show: + title: 'Show ${models.section|downcase}' + manage_tables: + link: 'Manage tables' + title: "Manage tables for ${models.section|downcase}: %{title}" + tables_view: + link: 'Tables view' + add_tables: + button_label: Add tables + modal: + title: Add tables + body_header: "" + number_start: From number + number_end: Till number + close_button: Close + add_button: Add + arrange_tables: + button_label: Arrange tables + by_row_no_row_count: 'Please fill in a positive number representing the number of ${models.plural.table|downcase} per row' + by_column_no_column_count: 'Please fill in a positive number representing the number of ${models.plural.table|downcase} per column' + modal: + title: Arrange tables + body_header: "" + distributed: Distributed + by_row: By row + by_row_count: of + by_column: By column + by_column_count: of + close_button: Close + arrange_button: Distribute + settings: + reviews: + title: Reviews + explanation: Fill in your Iens id. You can find this id in the web location of your profile diff --git a/config/locales/supplier.nl.yml b/config/locales/supplier.nl.yml new file mode 100644 index 00000000..29955804 --- /dev/null +++ b/config/locales/supplier.nl.yml @@ -0,0 +1,61 @@ +nl: + supplier: + messages: + could_not_arrange_tables: 'De ${models.plural.table} konden niet worden gepositioneerd' + could_not_arrange_tables_distributed: 'De ${models.plural.table} konden niet worden gepositioneerd. Heeft de ${models.section|downcase} een hoogte en breedte?' + could_not_arrange_tables_by_row: 'De ${models.plural.table} konden niet worden gepositioneerd. Heeft de ${models.section|downcase} een hoogte en breedte?' + could_not_arrange_tables_by_column: 'De ${models.plural.table} konden niet worden gepositioneerd. Heeft de ${models.section|downcase} een hoogte en breedte?' + menu: + active_lists: Actieve %{lists} + active_lists: + title: Actieve %{lists} + price: Prijs + active_orders: + title: Actieve %{orders} + price: Prijs + close: De zaak afsluiten voor bestellingen + you_are_currently_closed_alert: 'Je bent momenteel gesloten en kan geen orders ontvangen' + mark_as_open_button: 'Open de zaak!' + table_number: Tafel + tables: + qr_codes: + link: Qr codes + lists: + show: + title: "%{list} tonen" + section: + first_section_title: Ruimte + show: + title: 'Toon ${models.section|downcase}' + manage_tables: + link: 'Tafels beheren' + title: "Tafels beheren voor ${models.section|downcase}: %{title}" + tables_view: + link: Tafel overzicht + add_tables: + button_label: Voeg tafels toe + modal: + title: Voeg tafels toe + body_header: "" + number_start: Vanaf nummer + number_end: Tot nummer + close_button: Sluiten + add_button: Voeg toe + arrange_tables: + button_label: Positioneer tafels + by_row_no_row_count: 'Geef een positief getal voor het aantal ${models.plural.table|downcase} per rij' + by_column_no_column_count: 'Geef een positief getal voor het aantal ${models.plural.table|downcase} per kolom' + modal: + title: Positioneer tafels + body_header: "" + distributed: Verspreid + by_row: Per rij + by_row_count: van + by_column: Per kolom + by_column_count: van + close_button: Sluiten + arrange_button: Positioneer + settings: + reviews: + title: Reviews + explanation: Vul hier je iens id in. Deze kan je halen uit de url van je iens profiel diff --git a/config/locales/user.en.yml b/config/locales/user.en.yml new file mode 100644 index 00000000..4d5fe4ff --- /dev/null +++ b/config/locales/user.en.yml @@ -0,0 +1,29 @@ +en: + user: + active_list: + title: Active list + needs_payment: Check please! + history_list: + title: Closed list + list_history: + title: Closed lists + show_products: + # The title gets products: Product.model_name.human_plural that can be used: e.g.: Showing %{products} + title: Menu + join_occupied_table: + title: This table is occupied + join_this_table: Join this table + show_the_products: Show me the menu + back: Back + home: + scan_qr: Scan qr code + show_active_list: Show my orders + show_active_list_products: Go to the menu + basket: + total: Total + product_category: + other_name: Overig + obtain_token: + title: Authenticate Qwaiter + obtain: Authenticate + invalid_combination: The email password combination is incorrect diff --git a/config/locales/user.nl.yml b/config/locales/user.nl.yml new file mode 100644 index 00000000..ce012fd5 --- /dev/null +++ b/config/locales/user.nl.yml @@ -0,0 +1,29 @@ +nl: + user: + active_list: + title: Actieve lijst + needs_payment: Rekening vragen! + history_list: + title: Afgesloten lijst + list_history: + title: Afgesloten lijsten + show_products: + # The title gets products: Product.model_name.human_plural that can be used: e.g.: Showing %{products} + title: Menu + join_occupied_table: + title: Deze tafel is bezet + join_this_table: Ik wil ook bestellen bij deze tafel + show_the_products: Laat me het menu zien + back: Terug + home: + scan_qr: Scan qr code + show_active_list: Toon mijn bestellingen + show_active_list_products: Ga naar het menu + basket: + total: Totaal + product_category: + other_name: Overig + obtain_token: + title: Aanmelden bij Qwaiter + obtain: Aanmelden + invalid_combination: De inloggegevens zijn onjuist