Add section area color and demo menu export

This commit is contained in:
2015-09-30 17:55:47 +02:00
parent 81d4545104
commit 6588a97560
21 changed files with 372 additions and 15 deletions
@@ -11,12 +11,16 @@ App.SectionAreaComponent = Ember.Component.extend DragNDrop.Draggable,
not @get('section.editmode') and @get('section_area.height') > @get('section_area.width')
right_half: Ember.computed 'section_area.position_x', 'section_area.width', 'section_area.section.width', ->
@get('section_area.position_x') + (@get('section_area.width') / 2) > (@get('section_area.section.width') / 2)
style: Ember.computed 'offsetX', 'offsetY', 'pixelWidth', 'pixelHeight', ->
style: Ember.computed 'offsetX', 'offsetY', 'pixelWidth', 'pixelHeight', 'section_area.color', ->
background_color = @get('section_area.color')
color = if App.CssObject.isColorDark(background_color) then 'white' else 'black'
App.CssObject.create(
width: @get('pixelWidth')
height: @get('pixelHeight')
left: @get('offsetX')
top: @get('offsetY')
"background-color": background_color
color: color
"line-height": @get('pixelHeight')
).toString()
draggable: (-> if @get('section.editmode') then true else false ).property('section.editmode')
@@ -0,0 +1,18 @@
App.modals.SectionAreaController = App.modals.BaseController.extend
colors: (->
# taken from http://www.somacon.com/p142.php
[
'#AAAAAA'
'#458B74'
'#838B8B'
'#8B7D6B'
'#00008B'
'#8B2323'
'#8A2BE2'
'#458B00'
'#EEAD0E'
]
).property()
actions:
setColor: (color)->
@set 'model.color', color
@@ -6,6 +6,7 @@ App.SectionArea = DS.Model.extend Ember.Validations.Mixin,
position_x: attr 'number', defaultValue: 0
position_y: attr 'number', defaultValue: 0
rounded: attr 'boolean', defaultValue: false
color: attr 'string', defaultValue: '#AAAAAA'
section: DS.belongsTo('section', async: false)
validations:
title: {presence: true}
@@ -8,3 +8,18 @@ App.CssObject = Ember.Object.extend
v = "#{v}px" if @isNumeric.test(v)
ret += "#{k}:#{v};"
ret.htmlSafe()
App.CssObject.reopenClass
rgb_to_numeric: (rgb_hex)->
#http://stackoverflow.com/questions/12043187/how-to-check-if-hex-color-is-too-black
rgb_hex = rgb_hex.substring(1)
rgb = parseInt(rgb_hex, 16)
r = (rgb >> 16) & 0xff
g = (rgb >> 8) & 0xff
b = (rgb >> 0) & 0xff
[r, g, b]
isColorDark: (rgb_hex)->
return false unless rbg_hex.match /#[0-9a-zA-Z]{6}/
[r, g, b] = @rgb_to_numeric(rgb_hex)
luma = 0.2126 * r + 0.7152 * g + 0.0722 * b # per ITU-R BT.709
luma < 40
@@ -1 +1 @@
span.fa.fa-random
= table-number list.table.number
@@ -15,7 +15,6 @@ if list.active
.display-row
.display-label=t 'models.table'
.display-field
= table-number list.table.number
= button-change-list-table list=list
.display-row
.display-label &nbsp;
@@ -1,7 +1,12 @@
h3= tables.length
h4=t 'modal.change_list_table.subtitle' current_table_number=model.table.number
.user-info-container
each model.users as |user|
= user.avatar_tag
each sections as |section|
h3= section.title
ul.change-list-table-section-tables
each section.sorted_tables as |table|
unless table.active_list
li: a{action "moveToTable" table}= table-number table.number
hr
button.modal-close{action "close"}=t 'modal.change_list_table.close_button'
@@ -19,6 +19,12 @@ p= t 'section_area.modal.explanation'
.form-row.rounded
.form-label= t 'attributes.section_area.rounded'
.form-field= boolean-switch value=model.rounded
.form-row.color
.form-label= t 'attributes.employee.color'
.form-field.full
span.current-color= colorbox model.color
each colors as |color|
a{action "setColor" color}= colorbox color
hr
button.modal-close{action "close"}=t 'section_area.modal.close_button'
button.modal-confirm.right{action "save"} disabled=model.isInvalid
@@ -17,8 +17,8 @@
if(!Modernizr.cssanimations){
window.location = "/unsupported-browser";
}
var Qstorage = localStorage;
$.extend($translations.en, <%= I18n.t('supplier', locale: :en).to_json %>);
$.extend($translations.nl, <%= I18n.t('supplier', locale: :nl).to_json %>);
@@ -19,6 +19,7 @@ td.boolean
.change-list-table-button
+button($bg: $warning-color, $padding: $button-tny)
margin: 0
margin-bottom: 8px
.change-list-table-section-tables
list-style: none
+clearfix
@@ -1,6 +1,5 @@
.section-area-container
position: absolute
background-color: #aaa
text-align: center
&.rounded
border-radius: 999px
@@ -30,7 +30,7 @@ module Suppliers
private
def section_area_params
params.require(:section_area).permit %i[title width height position_x position_y section_id rounded]
params.require(:section_area).permit %i[title width height position_x position_y section_id rounded color]
end
end
end
+1
View File
@@ -7,6 +7,7 @@ class SectionArea
property :position_x, type: Float, default: 0
property :position_y, type: Float, default: 0
property :rounded, type: :boolean, default: false
property :color
belongs_to :section
belongs_to :supplier
@@ -1,5 +1,5 @@
class Suppliers::SectionAreaSerializer
include Qwaiter::SupplierBaseSerializer
attributes :title, :width, :height, :position_x, :position_y, :rounded
attributes :title, :width, :height, :position_x, :position_y, :rounded, :color
has_one :section, serializer: Suppliers::SectionSerializer
end
+2
View File
@@ -198,6 +198,8 @@ en:
close: OK
change_list_table:
title: Change the ${models.table} of the ${models.list}
subtitle: 'The current ${model.table} number is # %{current_table_number}'
close_button: Close
supplier_status_info:
title: "%{name} info"
header: The icons at the top right corner contain information about the current orders
+1
View File
@@ -199,6 +199,7 @@ nl:
close: OK
change_list_table:
title: Verander de ${models.table} van de ${models.list}
close_button: Sluiten
supplier_status_info:
title: "%{name} info"
header: The icons at the top right corner contain information about the current orders
+1 -1
View File
@@ -112,7 +112,7 @@ Qwaiter::Application.routes.draw do
# DEVELOPMENT ONLY
get '/qr' => 'dashboard#qr'
get '/demo_both' => 'dashboard#demo_both'
get '/demo-both' => 'dashboard#demo_both'
get :tests, to: 'test_squad#tests' unless Rails.env.production?
# SUPPLIER
+287
View File
@@ -0,0 +1,287 @@
---
- FEATURED:
- :name: Send me a mozo!
:description:
:price: 0.0
:product_variants: []
- ONTBIJT & ZOET:
- :name: Croissant
:description: Met jam & kaas
:price: 4.95
:product_variants: []
- :name: Cereals
:description: Met boerenyoghurt
:price: 4.5
:product_variants: []
- :name: Uitsmijter Titus
:description: Drie eitjes met naar keuze ham, kaas of fricandeau op speltbrood,
extra item
:price: 6.0
:product_variants: []
- :name: Seizoenstaart
:description:
:price: 5.0
:product_variants: []
- :name: Dudok Appeltaart
:description:
:price: 5.0
:product_variants: []
- :name: Cheesecake
:description:
:price: 5.0
:product_variants: []
- LUNCH - TOT 17:00:
- :name: Algen Bolletje Schapenkaas
:description: Spaanse Schapenkaas met appelstroop dressing
:price: 8.5
:product_variants: []
- :name: Panini Ham Kaas
:description: ''
:price: 4.3
:product_variants: []
- :name: Panini met Kip
:description: Met pesto
:price: 6.5
:product_variants: []
- :name: Vitello Tonat
:description: Met tonijnmayonaise, kappertjes, rode ui, oregano en rucola op speltbrood
:price: 9.5
:product_variants: []
- :name: Serranoham
:description: 24 maanden gerijpte Serranoham en truffelmayonaise op speltbrood
:price: 8.0
:product_variants: []
- :name: Van Dobben Kroketten
:description: Twee kroketten op speltbrood
:price: 7.0
:product_variants: []
- :name: Uitsmijter Mozo
:description: Drie eitjes met naar keuze ham, kaas of fricandeau op speltbrood
:price: 6.0
:product_variants: []
- :name: Algen Bolletje Mozzarella
:description: Met tomaat en basilicum pesto dressing
:price: 8.5
:product_variants: []
- :name: Special
:description: Uitgelegd door uw ober
:price: 7.5
:product_variants: []
- Beer:
- :name: La Chouffe
:description: Vanavond niet beschikbaar
:price: 4.1
:product_variants:
- Zonder schuim5
- Met schuim
- VOORGERECHTEN:
- :name: Tonijn Tartaar
:description: Vers gemarineerd met Granny Smith appel en marshmellow van sojasaus
:price: 12.5
:product_variants: []
- :name: Noordzee Krab
:description: Met tomaat, avocado en miso mayo
:price: 15.5
:product_variants: []
- :name: Coquilles
:description: Met zomer artisjok, kokkels en zwarte olijf
:price: 16.5
:product_variants: []
- :name: Vitello Tonato
:description: Met tonijnmayonaise, kappertjes, rode ui, oregano en rucola
:price: 10.5
:product_variants: []
- :name: Kreeft
:description: Lauwwarme halve kreeft met citrus structureren en venkel
:price: 18.5
:product_variants: []
- :name: Tortellini
:description: Tortellini van paddestoelen
:price: 14.5
:product_variants: []
- :name: Plateau Antipasti
:description: Dagelijks wisselende vegetarische-, vis- en vleesspecialiteiten
:price: 11.5
:product_variants: []
- :name: Visplateau Mozo
:description: Wisselende visspecialiteiten met o.a. schaal en schelpdiertjes
:price: 11.5
:product_variants: []
- SALADE:
- :name: Salade met Sognefjord zalm
:description: Met waterkers, rucola en wasabi-gember dressing
:price: 14.5
:product_variants: []
- :name: Zee Salade
:description: Groene salade, lamsoor, wakame, zeekraal en groene asperge
:price: 13.5
:product_variants: []
- :name: Salade Mozzarella
:description: Met tomaat, rucola en basilicum pesto dressing
:price: 13.5
:product_variants: []
- BIJGERECHTEN:
- :name: Diversen
:description:
:price: 3.5
:product_variants: []
- HOOFDGERECHTEN:
- :name: Visplateau
:description: Wisselende visspecialiteiten met o.a. schaal en schelpdiertjes
:price: 22.5
:product_variants: []
- :name: Black Angus Rib-eye
:description: Van de Green Egg met gepofte aardappel, salsa van avocado, appel
en Hollandse garnalen
:price: 27.95
:product_variants: []
- :name: Paddestoelen Tortellini
:description: Met seizoensgroenten en zongedroogde tomaat
:price: 16.5
:product_variants: []
- :name: Bio Burger
:description: Van 100% rundvlees met tomaat, ijsbergsla en truffel mayo
:price: 14.5
:product_variants: []
- :name: Kreeft Thermidor
:description: Hele kreeft gegratineerd met Thermidorsaus en seizoensgroenten
:price: 29.5
:product_variants: []
- :name: Tonijnsteak
:description: Met venkel, zeegroenten en sesam dressing
:price: 17.5
:product_variants: []
- :name: Tofu
:description: Gemarineerde Tofu met seizoensgroenten en teriyaki saus
:price: 15.5
:product_variants: []
- :name: Kalfskotelet
:description: Van de Green Egg met gepofte aardappel, salsa van avocado, appel
en Hollandse garnalen
:price: 24.5
:product_variants: []
- :name: Vis van de grill
:description: Toegelicht door het personeel
:price: 17.5
:product_variants: []
- VOOR DE KLEINTJES:
- :name: Pasta Pesto
:description:
:price: 6.5
:product_variants: []
- :name: Pannenkoek
:description:
:price: 4.95
:product_variants: []
- :name: Kroket / Kipnuggets / Fish fingers
:description: Geserveerd met frietjes
:price: 6.5
:product_variants: []
- DESSERTS:
- :name: Aarbeien ijs
:description:
:price: 6.0
:product_variants: []
- :name: Chocolade ijs
:description:
:price: 6.0
:product_variants: []
- :name: Ben & Jerry's
:description: ''
:price: 5.0
:product_variants: []
- :name: Espresso 43
:description:
:price: 4.3
:product_variants: []
- :name: Cheesecake
:description:
:price: 5.0
:product_variants: []
- :name: Crêpes Suzette
:description: Warm pannenkoekje met sinaasappelsaus en ijs
:price: 6.5
:product_variants: []
- :name: Kaasplankje
:description: Variatie van drie kazen
:price: 9.95
:product_variants: []
- :name: Dudok Appeltaart
:description: ''
:price: 5.0
:product_variants: []
- :name: Seizoenstaart
:description: "(vraag Titus Crew)"
:price: 0.0
:product_variants: []
- BIJ DE BORREL:
- :name: Brood met smeersels
:description: Kruidenboter, Tapenade en Aioli
:price: 5.75
:product_variants: []
- :name: Kaasplankje
:description: Variatie van drie kazen
:price: 9.95
:product_variants: []
- :name: Visplateau Titus
:description: Wisselende visspecialiteiten met o.a. schaal en schelpdiertjes
:price: 11.5
:product_variants: []
- :name: Mini Loempia's
:description:
:price: 5.5
:product_variants: []
- :name: Vlammetjes
:description:
:price: 6.5
:product_variants: []
- :name: Torpedo Garnalen
:description:
:price: 6.5
:product_variants: []
- :name: Bittergarnituur
:description:
:price: 17.5
:product_variants: []
- :name: Bitterballen Van Dobben
:description:
:price: 5.5
:product_variants: []
- :name: Plateau Antipasti
:description: Dagelijks wisselende vegetarische-, vis- en vleesspecialiteiten
:price: 11.5
:product_variants: []
- :name: Plateau Mediterranee
:description: Mix van drie diverse vleessoorten en Perla Verde olijven
:price: 9.5
:product_variants: []
- :name: Nacho's
:description: Uit de oven, met kaas, tomaten, chilibonen en sour cream
:price: 5.5
:product_variants: []
- :name: Olijven
:description: Spaanse Perla Verda en zwarte Aragon olijven
:price: 3.5
:product_variants: []
- NATTÛH OESTÂHS:
- :name: Seizoensoester
:description:
:price: 2.85
:product_variants: []
- :name: Zeeuwse Creuses
:description:
:price: 3.2
:product_variants: []
- :name: Zeeuwse Platte
:description:
:price: 4.1
:product_variants: []
- BIER:
- :name: La Chouffe
:description:
:price: 4.2
:product_variants: []
- :name: Heininken Vaasje
:description:
:price: 2.6
:product_variants: []
+19
View File
@@ -0,0 +1,19 @@
namespace :supplier do
task export_menu: :environment do
supplier_name = ARGV[1]
raise "Please supply a suppliers' name as argument" unless supplier_name.present?
supplier = Supplier.find_by_name(supplier_name)
raise "Cannot find supplier with name #{supplier_name}" unless supplier.present?
object = supplier.product_categories.sort_by(&:position).map do |pc|
{ pc.name => pc.products.map{ |product|
{
name: product.name.to_s.strip.presence,
description: product.description.presence,
price: product.price,
product_variants: product.product_variants.map(&:name)
}}
}
end
puts object.to_yaml
end
end
@@ -0,0 +1,3 @@
test "CssObject isColorDark", ->
#expect 10
equal App.CssObject.isColorDark('#FFFFFF'), false
+2 -6
View File
@@ -19,11 +19,10 @@ Supplier
- Testing
- Change list table
- Set product_category day from false to true
- Product order check for product being active
User
----
- Fix data model with consistent synchronous and asynchronous relations
- Implement https://github.com/EddyVerbruggen/Custom-URL-scheme with mozo:// scheme
- test met veel producten
- remove active orders on list close
@@ -31,13 +30,10 @@ User
- rename "I am signed in as a user" to "there is a signed in user" in
the specs
- Kom in aanmerking voor vaste klanten acties!
- Add supplier info page
Bugs
----
- obtain token does not refetch the current list after credentials are set
<!-- - nothing!!! -->
General