C&V test improvements

This commit is contained in:
2015-09-23 17:14:53 +02:00
parent 735ed9b70d
commit 81d4545104
12 changed files with 33 additions and 14 deletions
@@ -3,6 +3,5 @@ App.BooleanSwitchComponent = Ember.Component.extend
classNames: "switch" classNames: "switch"
classNameBindings: ['rounded:round'] classNameBindings: ['rounded:round']
click: -> # UniqueId is used to connect the label and the checkbox to eachother in the template
@set 'value', !@get('value')
setUniqueId: (->@set 'switchId', "switch-#{Math.round(Math.random()*1000)}").on('init') setUniqueId: (->@set 'switchId', "switch-#{Math.round(Math.random()*1000)}").on('init')
@@ -19,8 +19,11 @@ App.MySelectComponent = Ember.Component.extend
didRender: -> didRender: ->
# Set select to current value if can be found # Set select to current value if can be found
key = @get('optionValuePath') if @get('identity')
index = @get('content').mapBy(key).indexOf(@get("selection.#{key}")) key = @get('optionValuePath')
index = @get('content').mapBy(key).indexOf(@get("selection.#{key}")) # Ember 2.0.1 cannot find real objects yet
else
index = @get('content').indexOf(@get('selection'))
if index > -1 if index > -1
@$('select:first').prop('selectedIndex', index) @$('select:first').prop('selectedIndex', index)
@@ -1,6 +1,6 @@
.form-row.name .form-row.name
.form-label.half=t 'attributes.product_category.name' .form-label.half=t 'attributes.product_category.name'
.form-field.half= input valueBinding="model.name" action="save" .form-field.half= input value=model.name action="save"
.row .row
.small-12.medium-6.columns .small-12.medium-6.columns
unless model.supplier.week_starts_on_monday unless model.supplier.week_starts_on_monday
@@ -28,7 +28,7 @@
if model.supplier.week_starts_on_monday if model.supplier.week_starts_on_monday
.form-row.sunday .form-row.sunday
.form-label.half= t 'date.day_name.sunday' .form-label.half= t 'date.day_name.sunday'
.form-field.half= boolean-switch valueBinding=model.active_on_sunday .form-field.half= boolean-switch value=model.active_on_sunday
.small-12.medium-6.columns .small-12.medium-6.columns
.row .row
.small-12.columns.text-center= boolean-button value=model.full_day reverse=true text_path="product_category.modal.active_between.top" .small-12.columns.text-center= boolean-button value=model.full_day reverse=true text_path="product_category.modal.active_between.top"
@@ -109,6 +109,7 @@ header.top-menu
.current-employee-nav .current-employee-nav
float: right float: right
margin-right: 10px margin-right: 10px
cursor: pointer
.dropdown-trigger.gravatar .dropdown-trigger.gravatar
display: inline-block display: inline-block
overflow: hidden overflow: hidden
+7
View File
@@ -22,6 +22,13 @@ module ApplicationHelper
super(*args) super(*args)
end end
def user_root_path
case Rails.env
when 'development' then 'http://localhost:4200/'
else '/user/index.html'
end
end
def user_dynamic_data_host def user_dynamic_data_host
case Rails.env case Rails.env
when 'test' then "$data_host = data_host = 'http://#{request.host}:#{request.port}';".html_safe when 'test' then "$data_host = data_host = 'http://#{request.host}:#{request.port}';".html_safe
+4 -4
View File
@@ -52,19 +52,19 @@ class List
} }
}|, reduce_function: '_sum' }|, reduce_function: '_sum'
view :active_for_supplier_and_section_view, type: :custom, map_function: %[function(doc){ view :active_for_supplier_and_section_view, type: :custom, map_function: %|function(doc){
if(doc.ruby_class == 'List' && doc.state == 'active'){ if(doc.ruby_class == 'List' && doc.state == 'active'){
emit([doc.supplier_id, doc.section_id], 1); emit([doc.supplier_id, doc.section_id], 1);
} }
}], reduce_function: '_sum' }|, reduce_function: '_sum'
view :active_users_view, type: :custom, map_function: %[function(doc){ view :active_users_view, type: :custom, map_function: %|function(doc){
if(doc.ruby_class == 'List' && doc.state == 'active'){ if(doc.ruby_class == 'List' && doc.state == 'active'){
doc.user_ids && doc.user_ids.forEach(function(uid){ doc.user_ids && doc.user_ids.forEach(function(uid){
emit([doc.supplier_id, uid], 1); emit([doc.supplier_id, uid], 1);
}) })
} }
}], reduce_function: '_sum' }|, reduce_function: '_sum'
view :for_user_view, type: :custom, map_function: %|function(doc){ view :for_user_view, type: :custom, map_function: %|function(doc){
if(doc.ruby_class == 'List' && doc.user_ids && doc.user_ids.length){ if(doc.ruby_class == 'List' && doc.user_ids && doc.user_ids.length){
@@ -1,8 +1,12 @@
class Users::ProductCategorySerializer class Users::ProductCategorySerializer
FEATURED_NAMES = %w[
featured
]
include Qwaiter::UserBaseSerializer include Qwaiter::UserBaseSerializer
attributes :name, :supplier_id, :active_on_sunday, :active_on_monday, :active_on_tuesday, :active_on_wednesday, attributes :name, :supplier_id, :active_on_sunday, :active_on_monday, :active_on_tuesday, :active_on_wednesday,
:active_on_thursday, :active_on_friday, :active_on_saturday, :full_day, :start_from, :end_on, :active_on_thursday, :active_on_friday, :active_on_saturday, :full_day, :start_from, :end_on,
:position :position
attribute(:collapsed){ FEATURED_NAMES.exclude? object.name.to_s.downcase }
has_many :products, serializer: Users::ProductSerializer has_many :products, serializer: Users::ProductSerializer
has_one :supplier, serializer: Users::SupplierSerializer has_one :supplier, serializer: Users::SupplierSerializer
end end
+2
View File
@@ -175,6 +175,8 @@ en:
body_header: '' body_header: ''
move_to_top: Move to top move_to_top: Move to top
move_below_label: "Place below ${models.product_category|downcase}" move_below_label: "Place below ${models.product_category|downcase}"
products:
title: Sort ${models.plural.product|downcase}
product: product:
new: 'New ${model.product|downcase}' new: 'New ${model.product|downcase}'
destroy_confirmation: Are you sure you want to delete ${models.product|downcase} %{name} destroy_confirmation: Are you sure you want to delete ${models.product|downcase} %{name}
+1 -1
View File
@@ -55,7 +55,7 @@ Qwaiter::Application.routes.draw do
# USER # USER
#default_url_options format: 'html' #default_url_options format: 'html'
#get '/user/index' => 'user#index', as: :user_root #get '/user/index' => 'user#index', as: :user_root
get '/user' => 'user#index' #get '/user/index.html#' => 'user#index', as: :user_root
#get '/user/active_list(.:format)' => 'user#active_list', as: :user_active_list #get '/user/active_list(.:format)' => 'user#active_list', as: :user_active_list
#get '/user/list_info' => 'user#list_info', as: :user_list_info, via: [:get, :options] #get '/user/list_info' => 'user#list_info', as: :user_list_info, via: [:get, :options]
#post '/user/needs_help' => 'user#needs_help', as: :user_needs_help #post '/user/needs_help' => 'user#needs_help', as: :user_needs_help
+2 -2
View File
@@ -12,8 +12,8 @@ counters:
volumes: volumes:
- ./config:/usr/src/app/config - ./config:/usr/src/app/config
command: development command: development
links: #links:
- db #- db
faye: faye:
build: faye build: faye
net: host net: host
+1 -1
View File
@@ -23,7 +23,7 @@ module Features
def user_visit(path) def user_visit(path)
#visit File.join("http://localhost:3/") #visit File.join("http://localhost:3/")
visit File.join("/user/index.html#", path) visit File.join(user_root_path, path)
end end
def login_employee_as(email) def login_employee_as(email)
+3
View File
@@ -16,6 +16,9 @@ Supplier
- Add qr print functionality offering to send the stickers - Add qr print functionality offering to send the stickers
- Use modernizr svg to determine svg handling capabilities - Use modernizr svg to determine svg handling capabilities
- Add spec for switching from non-manager supplier to other supplier - Add spec for switching from non-manager supplier to other supplier
- Testing
- Change list table
- Set product_category day from false to true
User User