Active model serializer deprication smash
This commit is contained in:
+2
-2
@@ -1,6 +1,6 @@
|
|||||||
GIT
|
GIT
|
||||||
remote: git://github.com/bterkuile/cmtool.git
|
remote: git://github.com/bterkuile/cmtool.git
|
||||||
revision: ba76940007a7ef373b651f1053cc1e516e186140
|
revision: e937070277ae7d44e37de85864f91a1fc779f093
|
||||||
specs:
|
specs:
|
||||||
cmtool (1.0.0)
|
cmtool (1.0.0)
|
||||||
bourbon
|
bourbon
|
||||||
@@ -342,7 +342,7 @@ GEM
|
|||||||
activesupport (>= 4.2.0.beta, < 5.0)
|
activesupport (>= 4.2.0.beta, < 5.0)
|
||||||
nokogiri (~> 1.6.0)
|
nokogiri (~> 1.6.0)
|
||||||
rails-deprecated_sanitizer (>= 1.0.1)
|
rails-deprecated_sanitizer (>= 1.0.1)
|
||||||
rails-html-sanitizer (1.0.1)
|
rails-html-sanitizer (1.0.2)
|
||||||
loofah (~> 2.0)
|
loofah (~> 2.0)
|
||||||
railties (4.2.0)
|
railties (4.2.0)
|
||||||
actionpack (= 4.2.0)
|
actionpack (= 4.2.0)
|
||||||
|
|||||||
@@ -35,14 +35,14 @@ private
|
|||||||
:en
|
:en
|
||||||
end
|
end
|
||||||
|
|
||||||
def page_path(record, locale: I18n.locale)
|
def go_to_page_path(record, locale: I18n.locale)
|
||||||
str = case record
|
str = case record
|
||||||
when Page then record.name
|
when Page then record.name
|
||||||
else record
|
else record
|
||||||
end
|
end
|
||||||
go_to_path(str, locale: locale)
|
main_app.go_to_path(str, locale: locale)
|
||||||
end
|
end
|
||||||
helper_method :page_path
|
helper_method :go_to_page_path
|
||||||
#END CMTOOL
|
#END CMTOOL
|
||||||
|
|
||||||
def broadcast_user(uid, event, data = {})
|
def broadcast_user(uid, event, data = {})
|
||||||
|
|||||||
@@ -174,4 +174,44 @@ module ApplicationHelper
|
|||||||
options[:onclick] = function
|
options[:onclick] = function
|
||||||
link_to title, 'javascript:void(0)', options
|
link_to title, 'javascript:void(0)', options
|
||||||
end
|
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
|
end
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
class Employees::SupplierSerializer < Qwaiter::Serializer
|
class Employees::SupplierSerializer < Qwaiter::Serializer
|
||||||
self.root = :supplier
|
self.root = :supplier
|
||||||
embed :ids, include: true
|
|
||||||
attributes :open, :name, :lat, :lng, :time_zone, :address, :house_number, :house_number_addition, :postal_code, :city, :country,
|
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
|
:facebook_promotion_url, :iens_profile, :week_starts_on_monday, :orders_in_process_count, :orders_placed_count
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class JoinRequestSerializer < Qwaiter::Serializer
|
class JoinRequestSerializer < Qwaiter::Serializer
|
||||||
embed :ids, include: true
|
|
||||||
attributes :list_id
|
attributes :list_id
|
||||||
has_one :user, serializer: UserUserSerializer
|
has_one :user, serializer: UserUserSerializer
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class OrderSerializer < Qwaiter::Serializer
|
class OrderSerializer < Qwaiter::Serializer
|
||||||
embed :ids, include: true
|
|
||||||
attributes :state, :list_id, :section_id, :table_id #, :price
|
attributes :state, :list_id, :section_id, :table_id #, :price
|
||||||
|
|
||||||
has_many :product_orders
|
has_many :product_orders
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class ProductCategorySerializer < Qwaiter::Serializer
|
class ProductCategorySerializer < Qwaiter::Serializer
|
||||||
embed :ids, include: true
|
|
||||||
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
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
# Used for user ember1
|
# Used for user ember1
|
||||||
class ProductOrderSerializer < Qwaiter::Serializer
|
class ProductOrderSerializer < Qwaiter::Serializer
|
||||||
embed :ids
|
|
||||||
attributes :order_id, :product_id, :quantity, :price, :product_name
|
attributes :order_id, :product_id, :quantity, :price, :product_name
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class ProductSerializer < Qwaiter::Serializer
|
class ProductSerializer < Qwaiter::Serializer
|
||||||
embed :ids, include: true
|
|
||||||
attributes :name, :price, :description, :image, :code, :position, :visible, :product_category_id
|
attributes :name, :price, :description, :image, :code, :position, :visible, :product_category_id
|
||||||
|
|
||||||
def image
|
def image
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class SectionSerializer < Qwaiter::Serializer
|
class SectionSerializer < Qwaiter::Serializer
|
||||||
embed :ids, include: true
|
|
||||||
attributes :title, :path, :width, :height
|
attributes :title, :path, :width, :height
|
||||||
has_many :tables
|
has_many :tables
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
class SupplierExtendedListSerializer < Qwaiter::Serializer
|
class SupplierExtendedListSerializer < Qwaiter::Serializer
|
||||||
# user ids for facebook pictures
|
# user ids for facebook pictures
|
||||||
embed :ids, include: true
|
|
||||||
root 'list'
|
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
|
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
|
class SupplierListSerializer < Qwaiter::Serializer
|
||||||
# user ids for facebook pictures
|
# user ids for facebook pictures
|
||||||
self.root = :list
|
self.root = :list
|
||||||
embed :ids, include: true
|
|
||||||
attributes :extended_version, :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price,
|
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
|
:table_id, :table_number, :section_id, :user_ids, :supplier_id, :closed_at
|
||||||
has_many :orders
|
has_many :orders
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
class SupplierTableSerializer < Qwaiter::Serializer
|
class SupplierTableSerializer < Qwaiter::Serializer
|
||||||
self.root = :table
|
self.root = :table
|
||||||
embed :ids, include: true
|
|
||||||
attributes :number, :width, :height, :position_x, :position_y, :section_id, :needs_help
|
attributes :number, :width, :height, :position_x, :position_y, :section_id, :needs_help
|
||||||
has_one :supplier, serializer: Suppliers::SupplierSerializer
|
has_one :supplier, serializer: Suppliers::SupplierSerializer
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
class Suppliers::ExtendedSectionSerializer < Qwaiter::Serializer
|
class Suppliers::ExtendedSectionSerializer < Qwaiter::Serializer
|
||||||
root 'section'
|
root 'section'
|
||||||
embed :ids, include: true
|
|
||||||
attributes :title, :path, :width, :height
|
attributes :title, :path, :width, :height
|
||||||
has_many :tables, serializer: Suppliers::ExtendedTableSerializer
|
has_many :tables, serializer: Suppliers::ExtendedTableSerializer
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
class Suppliers::ExtendedTableSerializer < Qwaiter::Serializer
|
class Suppliers::ExtendedTableSerializer < Qwaiter::Serializer
|
||||||
root 'table'
|
root 'table'
|
||||||
embed :ids, include: true
|
|
||||||
attributes :number, :width, :height, :position_x, :position_y, :section_id#, :active_list_id
|
attributes :number, :width, :height, :position_x, :position_y, :section_id#, :active_list_id
|
||||||
|
|
||||||
#def list_id
|
#def list_id
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
class Suppliers::SupplierSerializer < Qwaiter::Serializer
|
class Suppliers::SupplierSerializer < Qwaiter::Serializer
|
||||||
self.root = :supplier
|
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,
|
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
|
:facebook_promotion_url, :iens_profile, :week_starts_on_monday, :orders_in_process_count, :orders_placed_count
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,4 @@
|
|||||||
class TableSerializer < Qwaiter::Serializer
|
class TableSerializer < Qwaiter::Serializer
|
||||||
embed :ids, include: true
|
|
||||||
attributes :number, :width, :height, :position_x, :position_y, :section_id, :occupied #, :alist_id
|
attributes :number, :width, :height, :position_x, :position_y, :section_id, :occupied #, :alist_id
|
||||||
|
|
||||||
#def list_id
|
#def list_id
|
||||||
|
|||||||
@@ -8,7 +8,6 @@
|
|||||||
class UserExtendedListSerializer < Qwaiter::Serializer
|
class UserExtendedListSerializer < Qwaiter::Serializer
|
||||||
# user ids for facebook pictures
|
# user ids for facebook pictures
|
||||||
self.root = :list
|
self.root = :list
|
||||||
embed :ids, include: true
|
|
||||||
attributes :extended_version, :state, :needs_help, :needs_payment, :user_requests_closing, :is_paid, :price,
|
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
|
:table_id, :table_number, :section_id, :user_ids, :supplier_id, :closed_at
|
||||||
#:supplier_orders_in_process_count, :supplier_orders_placed_count
|
#:supplier_orders_in_process_count, :supplier_orders_placed_count
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
class UserExtendedSupplierSerializer < Qwaiter::Serializer
|
class UserExtendedSupplierSerializer < Qwaiter::Serializer
|
||||||
self.root = :supplier
|
self.root = :supplier
|
||||||
embed :ids, include: true
|
|
||||||
attributes :extended_version, :open, :name, :orders_in_process_count, :orders_placed_count
|
attributes :extended_version, :open, :name, :orders_in_process_count, :orders_placed_count
|
||||||
has_many :product_categories
|
has_many :product_categories
|
||||||
#has_many :products only product in category!!!!!!
|
#has_many :products only product in category!!!!!!
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
class UserExtendedTableSerializer < Qwaiter::Serializer
|
class UserExtendedTableSerializer < Qwaiter::Serializer
|
||||||
self.root = :table
|
self.root = :table
|
||||||
embed :ids, include: true
|
|
||||||
attributes :number, :width, :height, :position_x, :position_y, :section_id, :occupied, :needs_help
|
attributes :number, :width, :height, :position_x, :position_y, :section_id, :occupied, :needs_help
|
||||||
has_one :supplier, serializer: UserExtendedSupplierSerializer
|
has_one :supplier, serializer: UserExtendedSupplierSerializer
|
||||||
end
|
end
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
class UserListSerializer < Qwaiter::Serializer
|
class UserListSerializer < Qwaiter::Serializer
|
||||||
# user ids for facebook pictures
|
# user ids for facebook pictures
|
||||||
embed :ids, include: true
|
|
||||||
attributes :state, :needs_help, :needs_payment, :user_requests_closing,
|
attributes :state, :needs_help, :needs_payment, :user_requests_closing,
|
||||||
:is_paid, :price, :table_id, :table_number, :section_id, :user_ids,
|
:is_paid, :price, :table_id, :table_number, :section_id, :user_ids,
|
||||||
:cached_supplier_name, :closed_at, :supplier_id, :extended_version
|
:cached_supplier_name, :closed_at, :supplier_id, :extended_version
|
||||||
|
|||||||
@@ -1,8 +1,8 @@
|
|||||||
a.menu-secondary-toggle href="#"
|
a.menu-secondary-toggle href="#"
|
||||||
span
|
span
|
||||||
ul.nav
|
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=active_class('pages#home').push('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#show', name: 'about').push('about') = link_to find_page('about').try(:menu_text), go_to_page_path('about')
|
||||||
ul.nav.secondary
|
ul.nav.secondary
|
||||||
- Page.menu_roots.each do |page|
|
- 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
|
config.action_controller.action_on_unpermitted_parameters = :log
|
||||||
|
|
||||||
# Configure static asset server for tests with Cache-Control for performance.
|
# 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'
|
config.static_cache_control = 'public, max-age=3600'
|
||||||
|
|
||||||
# Compress JavaScripts and CSS
|
# Compress JavaScripts and CSS
|
||||||
|
|||||||
Reference in New Issue
Block a user