end of day commit

This commit is contained in:
2015-02-25 18:56:45 +01:00
parent c2435695bf
commit 3da5d8eb41
29 changed files with 132 additions and 27 deletions
+1
View File
@@ -36,6 +36,7 @@ group :assets do
gem 'uglifier', '>= 1.0.3'
#gem "emblem-source", github: "machty/emblem.js"
gem 'emblem-source', '0.3.18'
gem 'emblem-rails'
gem 'ember-validations-rails'
+2 -1
View File
@@ -198,7 +198,7 @@ GEM
emblem-rails (0.2.2)
barber-emblem (~> 0.1.1)
ember-rails (>= 0.14.0)
emblem-source (0.4.0)
emblem-source (0.3.18)
erubis (2.7.0)
eventmachine (1.0.7)
execjs (2.3.0)
@@ -470,6 +470,7 @@ DEPENDENCIES
ember-validations-rails
ember_script-rails!
emblem-rails
emblem-source (= 0.3.18)
factory_girl_rails
faye
font-awesome-rails
@@ -5,5 +5,8 @@
#= require_directory .
#= require_self
$ ->
# Responsive menu
$('.menu-secondary-toggle').click -> $('.nav.secondary').toggleClass('active')
# Foundation javascript support
$(document).foundation()
@@ -8,7 +8,7 @@ App.Table = DS.Model.extend
occupied: attr 'boolean'
section: DS.belongsTo('section')
product_orders: DS.hasMany('product_order')
#active_list: DS.belongsTo('list')
active_list: DS.belongsTo('list')
#active_list: (->
#@get('list')
#).property('list')
@@ -1,6 +1,6 @@
# http://emberjs.com/guides/models/defining-a-store/
DS.RESTAdapter.reopen
namespace: 'waiter'
#DS.RESTAdapter.reopen
#namespace: 'waiter'
App.ApplicationSerializer = DS.ActiveModelSerializer
App.CustomAdapter = DS.RESTAdapter.extend
@@ -9,5 +9,8 @@ App.CustomAdapter = DS.RESTAdapter.extend
pathForType: (type)->
decamelized = Ember.String.decamelize(type)
Ember.String.pluralize(decamelized)
App.Store = DS.Store.extend
adapter: App.CustomAdapter
#App.Store = DS.Store.extend
#adapter: App.CustomAdapter
App.ApplicationStore = DS.Store.extend
adapter: DS.ActiveModelAdapter.extend
namespace: 'waiter'
@@ -5,5 +5,5 @@ each product_category in controller
ul.product_category-products
each product in product_category.products
li
a{action addProduct product } href="#" = product.name
a{action "addProduct" product } href="#" = product.name
@@ -22,6 +22,8 @@
position: relative
list-style: none
float: left
&.contact
float: right
a
border: 0
color: white
@@ -0,0 +1,16 @@
class ContactFormsController < ApplicationController
def create
@contact_form = Cmtool::ContactForm.new(contact_form_params)
if @contact_form.save
redirect_to root_path, notice: t('contact_form.submitted')
else
redirect_to go_to_path('contact', locale: I18n.locale), alert: @contact_form.errors.full_messages.join(', ')
end
end
private
def contact_form_params
params.require(:contact_form).permit!
end
end
@@ -0,0 +1,3 @@
class Waiter::ApplicationController < Suppliers::ApplicationController
layout 'waiter'
end
@@ -0,0 +1,6 @@
class Waiter::DashboardController < Waiter::ApplicationController
skip_load_and_authorize_resource
def index
end
end
+2 -2
View File
@@ -5,10 +5,10 @@ class WaiterController < ApplicationController
end
def sections
json = '{"tables":[{"id":"0903d04a003991835f9f32d1821ee05c","number":102,"width":2.0,"height":2.0,"position_x":14.242294520547945,"position_y":3.1862955032119915,"section_id":"1a9d4cc551dac96f87a21c97ba1e710b","occupied":true,"active_list_id":"1cef487ec268169687f481cb828924c2"},{"id":"0903d04a003991835f9f32d1821efb50","number":100,"width":2.0,"height":2.0,"position_x":6.5,"position_y":6.5,"section_id":"1a9d4cc551dac96f87a21c97ba1e710b","occupied":false,"active_list_id":null},{"id":"1a9d4cc551dac96f87a21c97ba3d15fa","number":11,"width":2.0,"height":2.0,"position_x":6.5,"position_y":1.5,"section_id":"1a9d4cc551dac96f87a21c97ba1e710b","occupied":false,"active_list_id":null},{"id":"0903d04a003991835f9f32d1821ededd","number":103,"width":2.0,"height":2.0,"position_x":9.0,"position_y":6.5,"section_id":"222fcd43b55e397d11d92ccb601e70dc","occupied":false,"active_list_id":null},{"id":"0903d04a003991835f9f32d1821eee07","number":101,"width":2.0,"height":2.0,"position_x":2.3333333333333335,"position_y":6.5,"section_id":"222fcd43b55e397d11d92ccb601e70dc","occupied":false,"active_list_id":null},{"id":"1a9d4cc551dac96f87a21c97ba3d0dbd","number":12,"width":2.0,"height":2.0,"position_x":9.854452054794521,"position_y":2.7054794520547945,"section_id":"222fcd43b55e397d11d92ccb601e70dc","occupied":false,"active_list_id":null},{"id":"1a9d4cc551dac96f87a21c97ba3d2221","number":10,"width":2.0,"height":2.0,"position_x":6.4811643835616435,"position_y":2.0034246575342465,"section_id":"222fcd43b55e397d11d92ccb601e70dc","occupied":false,"active_list_id":null},{"id":"1a9d4cc551dac96f87a21c97ba3d2cf7","number":1,"width":2.0,"height":2.0,"position_x":2.3333333333333335,"position_y":1.5,"section_id":"222fcd43b55e397d11d92ccb601e70dc","occupied":false,"active_list_id":null}],"lists":[{"id":"1cef487ec268169687f481cb828924c2","state":"active","needs_help":true,"needs_payment":false,"is_paid":false,"price":46.8,"table_id":"0903d04a003991835f9f32d1821ee05c","table_number":102,"section_id":"1a9d4cc551dac96f87a21c97ba1e710b","has_active_orders":true,"user_ids":["8afe7cccf1c690e60aa2ace1bf1d8a71"]}],"sections":[{"id":"1a9d4cc551dac96f87a21c97ba1e710b","title":"Ruimte2","path":[[0.0,0.0],[30.0,12.0],[30.0,12.0],[0.0,12.0]],"width":30.0,"height":12.0,"table_ids":["0903d04a003991835f9f32d1821ee05c","0903d04a003991835f9f32d1821efb50","1a9d4cc551dac96f87a21c97ba3d15fa"]},{"id":"222fcd43b55e397d11d92ccb601e70dc","title":"Buiten","path":[[0.0,0.0],[20.0,20.0],[20.0,20.0],[0.0,20.0]],"width":20.0,"height":20.0,"table_ids":["0903d04a003991835f9f32d1821ededd","0903d04a003991835f9f32d1821eee07","1a9d4cc551dac96f87a21c97ba3d0dbd","1a9d4cc551dac96f87a21c97ba3d2221","1a9d4cc551dac96f87a21c97ba3d2cf7"]}]}'
sections = current_supplier.sections.include_relation(:tables)
respond_to do |format|
format.html { redirect_to '/waiter'}
format.json { render json: json }
format.json { render json: sections, each_serializer: Waiter::SectionSerializer }
end
end
@@ -0,0 +1,4 @@
class Waiter::SectionSerializer < Qwaiter::Serializer
self.root = :section
attributes :title, :path, :width, :height
end
@@ -0,0 +1,3 @@
class Waiter::TableSerializer < Qwaiter::Serializer
attributes :number, :width, :height, :position_x, :position_y, :section_id, :needs_help
end
+1 -1
View File
@@ -3,6 +3,6 @@ h2= t('devise.passwords.title')
= devise_error_messages!
= f.row :email do
.form-label= f.label :email, class: 'control-label'
.form-field= f.email_field :email
.form-field= f.email_field :email, autofocus: true
.form-row.form-actions= f.submit t('devise.passwords.button'), class: 'button'
= render "devise/links"
+8 -7
View File
@@ -1,3 +1,4 @@
h1.page-title= t 'devise.registrations.title'
.row
.small-12.columns
ul
@@ -10,28 +11,28 @@
li Download the app on your phone to test as a user
li Scan a qr-code from you restaurant screen with your phone, and you can test ordering products!!!
.row
.large-7.large-offset-1.columns
.large-8.large-offset-1.columns
= form_for @new_supplier do |f|
= f.row :supplier_name
.large-4.columns= f.label :supplier_name
.large-4.columns= f.text_field :supplier_name
.large-4.columns= f.error_message :supplier_name
.large-6.columns= f.text_field :supplier_name, autofocus: true
.large-2.columns= f.error_message :supplier_name
= f.row :email
.large-4.columns= f.label :email
.large-4.columns
.large-6.columns
- if @new_supplier.current_employee.present?
= @new_supplier.current_employee.email
- else
= f.email_field :email
.large-4.columns= f.error_message :email
.large-2.columns= f.error_message :email
- if not @new_supplier.current_employee.present?
= f.row :password
.large-4.columns= f.label :password
.large-4.columns= f.text_field :password
.large-4.columns= f.password_field :password
.large-4.columns= f.error_message :password
= f.row :password_confirmation
.large-4.columns= f.label :password_confirmation
.large-4.columns= f.text_field :password_confirmation
.large-4.columns= f.password_field :password_confirmation
.large-4.columns= f.error_message :password_confirmation
.form-actions
+22
View File
@@ -0,0 +1,22 @@
.row
.large-9.columns
.row: .small-12.columns=raw @page.body
= form_for Cmtool::ContactForm.new, url: contact_forms_path, html: {class: 'contact'} do |f|
.row
.large-4.columns: label Uw naam:
.large-2.columns= f.select :gender, [['Dhr.', 'male'], ['Mevr.', 'female']]
.large-6.columns.end= f.text_field :name
.row
.small-12.columns.end
label Uw vraag of opmerking:*
br
= f.text_area :body, cols: 32, rows: 8
.row
.large-4.columns: label Uw e-mail adres:*
.large-8.columns.end= f.email_field :email
.row
.large-12.columns
= f.submit 'verstuur', class: 'button'
br
span * Verplicht veld
.large-3.columns== @page.sidebar
+1 -1
View File
@@ -6,7 +6,7 @@ h2= t('devise.sign_in.title')
.form-field= f.email_field :email
= f.row :email do
.form-label= f.label :password
.form-field= f.password_field :password
.form-field= f.password_field :password, autofocus: true
.form-row
= f.label :remember_me do
= f.check_box :remember_me
+3 -3
View File
@@ -1,8 +1,8 @@
a.menu-secondary-toggle href="#"
span
ul.nav
li[class=(current_page?(controller: '/pages', action: 'home') ? :active : nil)]= link_to find_page('home').try(:menu_text), locale_root_path
li[class=(current_page?(controller: '/pages', action: 'show', name: 'about') ? :active : nil)]= link_to find_page('about').try(:menu_text), page_path('about')
li[class=(current_page?(controller: '/pages', action: 'home') ? ['home', :active] : ['home'])]= link_to find_page('home').try(:menu_text), locale_root_path
li[class=(current_page?(controller: '/pages', action: 'show', name: 'about') ? ['about', :active] : ['about'])]= link_to find_page('about').try(:menu_text), page_path('about')
ul.nav.secondary
- Page.menu_roots.each do |page|
li[class=(current_page?(controller: '/pages', action: 'show', name: page.name) ? :active : nil)]= link_to page.menu_text, page_path(page.name)
li[class=(current_page?(controller: '/pages', action: 'show', name: page.name) ? [page.name, :active] : [page.name])]= link_to page.menu_text, page_path(page.name)
+1
View File
@@ -13,6 +13,7 @@ en:
title: Change your password
button: Change password
registrations:
title: Sign up for mozo as a restaurant
link: Sign up
links:
prefix: 'OR:'
+10 -3
View File
@@ -3,10 +3,17 @@ nl:
sign_in:
title: Inloggen
remember_me: Mij onthouden
link: Inloggen
button: Inloggen
recoverable:
button: Wachtwoord vergeten
passwords:
title: Wachtwoord vergeten
link: Wachtwoord vergeten
button: Stuur reset
edit:
title: Change your password
button: Change password
registrations:
button: Aanmelden
title: Aanmelden als restaurant
link: Aanmelden
links:
prefix: 'OF:'
+5
View File
@@ -68,6 +68,11 @@ en:
postal_code: Postal code
city: City
country: Country
new_supplier:
supplier_name: Restaurant name
email: E-mail
password: Password
password_confirmation: Password confirmation
table:
number: Number
from_number: From number
+5
View File
@@ -67,6 +67,11 @@ nl:
postal_code: Postcode
city: Stad
country: Land
new_supplier:
supplier_name: Restaurant name
email: E-mail
password: Wachtwoord
password_confirmation: Nogmaals wachtwoord
table:
number: Nummer
from_number: Vanaf nummer
+9 -3
View File
@@ -32,17 +32,20 @@ Qwaiter::Application.routes.draw do
root to: 'users#index'
end
resources :new_suppliers
post '/user_app' => 'dashboard#user_app_log' #TODO: separate high speed app at log.mozo.bar
post '/user_feedback' => 'user#feedback'
#WAITER
get '/waiter' => 'waiter#index' #, controller: 'waiter', action: 'index'
#get '/waiter' => 'waiter#index' #, controller: 'waiter', action: 'index'
get '/waiter/sections' => 'waiter#sections'
get '/waiter/product_categories' => 'waiter#product_categories'
get '/waiter/*rest' => redirect('/waiter') # Ember app refresh
post '/waiter/order_products' => 'waiter#order_products', as: :order_products_waiter
namespace :waiter do
root to: 'dashboard#index'
end
# USER
@@ -172,12 +175,15 @@ Qwaiter::Application.routes.draw do
mount Cmtool::Engine => '/cmtool'
#get '/:locale' => 'pages#home', constraints: {locale: ALLOWED_LOCALES}
# /nl is not matched to pages#home with locale => nl
get '/:locale' => 'pages#home', constraints: {locale: ALLOWED_LOCALES}
#devise_scope :supplier do
#get '/:locale/suppliers/sign_up' => 'registrations#new', constraints: {locale: ALLOWED_LOCALES}
#end
scope '(/:locale)', constraints: {locale: ALLOWED_LOCALES}, defaults: { locale: 'en' } do
root to: 'pages#home'
resources :contact_forms, only: [:create]
resources :new_suppliers
get "/:name" => "pages#show", constraints: {name: /.*/}, as: :go_to
end
end
@@ -0,0 +1,5 @@
Feature: Submitting contact form
Scenario: Website visitor submits contact form
Given there are standard website pages
When I visit '/contact'
@@ -0,0 +1,3 @@
step "there are standard website pages" do
create_site_pages
end
+2
View File
@@ -1,4 +1,6 @@
FactoryGirl.define do
factory :page do
locale 'en'
layout 'theme1'
end
end
+6
View File
@@ -28,6 +28,12 @@ module Features
submit_form
end
def create_site_pages
@home = create :page, name: 'home', layout: 'theme1-home', title: 'Home'
@about = create :page, name: 'about', title: 'About mozo'
@contact = create :page, name: 'contact', title: 'Contact'
end
def submit_form
find("[type=submit]").click
end