Active model serializer deprication smash
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
||||
GIT
|
||||
remote: git://github.com/bterkuile/cmtool.git
|
||||
revision: ba76940007a7ef373b651f1053cc1e516e186140
|
||||
revision: e937070277ae7d44e37de85864f91a1fc779f093
|
||||
specs:
|
||||
cmtool (1.0.0)
|
||||
bourbon
|
||||
@@ -342,7 +342,7 @@ GEM
|
||||
activesupport (>= 4.2.0.beta, < 5.0)
|
||||
nokogiri (~> 1.6.0)
|
||||
rails-deprecated_sanitizer (>= 1.0.1)
|
||||
rails-html-sanitizer (1.0.1)
|
||||
rails-html-sanitizer (1.0.2)
|
||||
loofah (~> 2.0)
|
||||
railties (4.2.0)
|
||||
actionpack (= 4.2.0)
|
||||
|
||||
@@ -35,14 +35,14 @@ private
|
||||
:en
|
||||
end
|
||||
|
||||
def page_path(record, locale: I18n.locale)
|
||||
def go_to_page_path(record, locale: I18n.locale)
|
||||
str = case record
|
||||
when Page then record.name
|
||||
else record
|
||||
end
|
||||
go_to_path(str, locale: locale)
|
||||
main_app.go_to_path(str, locale: locale)
|
||||
end
|
||||
helper_method :page_path
|
||||
helper_method :go_to_page_path
|
||||
#END CMTOOL
|
||||
|
||||
def broadcast_user(uid, event, data = {})
|
||||
|
||||
@@ -174,4 +174,44 @@ module ApplicationHelper
|
||||
options[:onclick] = function
|
||||
link_to title, 'javascript:void(0)', options
|
||||
end
|
||||
|
||||
# Return active or nil based on the given route spec
|
||||
# %li{ class: active_class('users') # true if controller is users, false otherwise
|
||||
# %li{ class: active_class('pages#about') # true if controller is pages and action is about
|
||||
def active_class(*route_specs)
|
||||
options = route_specs.extract_options!
|
||||
active_class = options.delete(:active_class) || 'active'
|
||||
return_class = Array.wrap(options.delete(:default_class))
|
||||
if route_specs.map{|rs| current_route_spec?(rs) }.any?
|
||||
if params.slice(*options.keys) == options.stringify_keys
|
||||
return_class << active_class
|
||||
end
|
||||
end
|
||||
return_class
|
||||
end
|
||||
|
||||
# Check if the current route matches the route given as argument.
|
||||
# The syntax is meant to be a bit similar to specifying routes in
|
||||
# `config/routes.rb`.
|
||||
# current_route_spec?('products') #=> true if controller name is products, false otherwise
|
||||
# current_route_spec?('products#show') #=> true if controller_name is products AND action_name is show
|
||||
# current_route_spec?('#show') #=> true if action_name is show, false otherwise
|
||||
#NOTE: this helper is tested through the active_class helper
|
||||
def current_route_spec?(route_spec)
|
||||
controller, action = route_spec.split('#')
|
||||
if controller and controller_path == controller
|
||||
if action
|
||||
if action_name == action
|
||||
true
|
||||
end
|
||||
else
|
||||
# no action means all actions of controller
|
||||
true
|
||||
end
|
||||
else
|
||||
if action_name == action
|
||||
true
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class Employees::SupplierSerializer < Qwaiter::Serializer
|
||||
self.root = :supplier
|
||||
embed :ids, include: true
|
||||
attributes :open, :name, :lat, :lng, :time_zone, :address, :house_number, :house_number_addition, :postal_code, :city, :country,
|
||||
:facebook_promotion_url, :iens_profile, :week_starts_on_monday, :orders_in_process_count, :orders_placed_count
|
||||
end
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class JoinRequestSerializer < Qwaiter::Serializer
|
||||
embed :ids, include: true
|
||||
attributes :list_id
|
||||
has_one :user, serializer: UserUserSerializer
|
||||
end
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class OrderSerializer < Qwaiter::Serializer
|
||||
embed :ids, include: true
|
||||
attributes :state, :list_id, :section_id, :table_id #, :price
|
||||
|
||||
has_many :product_orders
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class ProductCategorySerializer < Qwaiter::Serializer
|
||||
embed :ids, include: true
|
||||
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
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
# Used for user ember1
|
||||
class ProductOrderSerializer < Qwaiter::Serializer
|
||||
embed :ids
|
||||
attributes :order_id, :product_id, :quantity, :price, :product_name
|
||||
end
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class ProductSerializer < Qwaiter::Serializer
|
||||
embed :ids, include: true
|
||||
attributes :name, :price, :description, :image, :code, :position, :visible, :product_category_id
|
||||
|
||||
def image
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class SectionSerializer < Qwaiter::Serializer
|
||||
embed :ids, include: true
|
||||
attributes :title, :path, :width, :height
|
||||
has_many :tables
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class SupplierExtendedListSerializer < Qwaiter::Serializer
|
||||
# user ids for facebook pictures
|
||||
embed :ids, include: true
|
||||
root 'list'
|
||||
attributes :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price, :table_id, :section_id, :supplier_id, :closed_at #, :has_active_orders
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
class SupplierListSerializer < Qwaiter::Serializer
|
||||
# user ids for facebook pictures
|
||||
self.root = :list
|
||||
embed :ids, include: true
|
||||
attributes :extended_version, :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price,
|
||||
:table_id, :table_number, :section_id, :user_ids, :supplier_id, :closed_at
|
||||
has_many :orders
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class SupplierTableSerializer < Qwaiter::Serializer
|
||||
self.root = :table
|
||||
embed :ids, include: true
|
||||
attributes :number, :width, :height, :position_x, :position_y, :section_id, :needs_help
|
||||
has_one :supplier, serializer: Suppliers::SupplierSerializer
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class Suppliers::ExtendedSectionSerializer < Qwaiter::Serializer
|
||||
root 'section'
|
||||
embed :ids, include: true
|
||||
attributes :title, :path, :width, :height
|
||||
has_many :tables, serializer: Suppliers::ExtendedTableSerializer
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class Suppliers::ExtendedTableSerializer < Qwaiter::Serializer
|
||||
root 'table'
|
||||
embed :ids, include: true
|
||||
attributes :number, :width, :height, :position_x, :position_y, :section_id#, :active_list_id
|
||||
|
||||
#def list_id
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class Suppliers::SupplierSerializer < Qwaiter::Serializer
|
||||
self.root = :supplier
|
||||
embed :ids, include: true
|
||||
attributes :extended_version, :open, :name, :lat, :lng, :time_zone, :address, :house_number, :house_number_addition, :postal_code, :city, :country,
|
||||
:facebook_promotion_url, :iens_profile, :week_starts_on_monday, :orders_in_process_count, :orders_placed_count
|
||||
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
class TableSerializer < Qwaiter::Serializer
|
||||
embed :ids, include: true
|
||||
attributes :number, :width, :height, :position_x, :position_y, :section_id, :occupied #, :alist_id
|
||||
|
||||
#def list_id
|
||||
|
||||
@@ -8,7 +8,6 @@
|
||||
class UserExtendedListSerializer < Qwaiter::Serializer
|
||||
# user ids for facebook pictures
|
||||
self.root = :list
|
||||
embed :ids, include: true
|
||||
attributes :extended_version, :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price,
|
||||
:table_id, :table_number, :section_id, :user_ids, :supplier_id, :closed_at
|
||||
#:supplier_orders_in_process_count, :supplier_orders_placed_count
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class UserExtendedSupplierSerializer < Qwaiter::Serializer
|
||||
self.root = :supplier
|
||||
embed :ids, include: true
|
||||
attributes :extended_version, :open, :name, :orders_in_process_count, :orders_placed_count
|
||||
has_many :product_categories
|
||||
#has_many :products only product in category!!!!!!
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class UserExtendedTableSerializer < Qwaiter::Serializer
|
||||
self.root = :table
|
||||
embed :ids, include: true
|
||||
attributes :number, :width, :height, :position_x, :position_y, :section_id, :occupied, :needs_help
|
||||
has_one :supplier, serializer: UserExtendedSupplierSerializer
|
||||
end
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
class UserListSerializer < Qwaiter::Serializer
|
||||
# user ids for facebook pictures
|
||||
embed :ids, include: true
|
||||
attributes :state, :needs_help, :needs_payment, :user_requests_closing,
|
||||
:is_paid, :price, :table_id, :table_number, :section_id, :user_ids,
|
||||
:cached_supplier_name, :closed_at, :supplier_id, :extended_version
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
a.menu-secondary-toggle href="#"
|
||||
span
|
||||
ul.nav
|
||||
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')
|
||||
li class=active_class('pages#home').push('home') = link_to find_page('home').try(:menu_text), locale_root_path
|
||||
li class=active_class('pages#show', name: 'about').push('about') = link_to find_page('about').try(:menu_text), go_to_page_path('about')
|
||||
ul.nav.secondary
|
||||
- Page.menu_roots.each do |page|
|
||||
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)
|
||||
li class=active_class('pages#show', name: page.name).push(page.name) = link_to page.menu_text, go_to_page_path(page.name)
|
||||
|
||||
@@ -16,7 +16,7 @@ Qwaiter::Application.configure do
|
||||
config.action_controller.action_on_unpermitted_parameters = :log
|
||||
|
||||
# Configure static asset server for tests with Cache-Control for performance.
|
||||
config.serve_static_assets = true
|
||||
config.serve_static_files = true
|
||||
config.static_cache_control = 'public, max-age=3600'
|
||||
|
||||
# Compress JavaScripts and CSS
|
||||
|
||||
Reference in New Issue
Block a user