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"
classNameBindings: ['rounded:round']
click: ->
@set 'value', !@get('value')
# UniqueId is used to connect the label and the checkbox to eachother in the template
setUniqueId: (->@set 'switchId', "switch-#{Math.round(Math.random()*1000)}").on('init')
@@ -19,8 +19,11 @@ App.MySelectComponent = Ember.Component.extend
didRender: ->
# Set select to current value if can be found
key = @get('optionValuePath')
index = @get('content').mapBy(key).indexOf(@get("selection.#{key}"))
if @get('identity')
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
@$('select:first').prop('selectedIndex', index)
@@ -1,6 +1,6 @@
.form-row.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
.small-12.medium-6.columns
unless model.supplier.week_starts_on_monday
@@ -28,7 +28,7 @@
if model.supplier.week_starts_on_monday
.form-row.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
.row
.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
float: right
margin-right: 10px
cursor: pointer
.dropdown-trigger.gravatar
display: inline-block
overflow: hidden
+7
View File
@@ -22,6 +22,13 @@ module ApplicationHelper
super(*args)
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
case Rails.env
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'
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'){
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'){
doc.user_ids && doc.user_ids.forEach(function(uid){
emit([doc.supplier_id, uid], 1);
})
}
}], reduce_function: '_sum'
}|, reduce_function: '_sum'
view :for_user_view, type: :custom, map_function: %|function(doc){
if(doc.ruby_class == 'List' && doc.user_ids && doc.user_ids.length){
@@ -1,8 +1,12 @@
class Users::ProductCategorySerializer
FEATURED_NAMES = %w[
featured
]
include Qwaiter::UserBaseSerializer
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,
:position
attribute(:collapsed){ FEATURED_NAMES.exclude? object.name.to_s.downcase }
has_many :products, serializer: Users::ProductSerializer
has_one :supplier, serializer: Users::SupplierSerializer
end