Change deprecated *_filter methods to *_action
This commit is contained in:
parent
bee671c90e
commit
2100c738af
39 changed files with 66 additions and 66 deletions
|
|
@ -1,5 +1,5 @@
|
|||
class Admin::BaseController < ApplicationController
|
||||
before_filter :authenticate_admin
|
||||
before_action :authenticate_admin
|
||||
|
||||
def index
|
||||
@user = current_user
|
||||
|
|
|
|||
|
|
@ -7,9 +7,9 @@ class ApplicationController < ActionController::Base
|
|||
helper_method :available_locales
|
||||
|
||||
protect_from_forgery
|
||||
before_filter :authenticate, :set_user_last_activity, :store_controller, :items_per_page
|
||||
after_filter :remove_controller
|
||||
around_filter :set_time_zone, :set_currency
|
||||
before_action :authenticate, :set_user_last_activity, :store_controller, :items_per_page
|
||||
after_action :remove_controller
|
||||
around_action :set_time_zone, :set_currency
|
||||
|
||||
|
||||
# Returns the controller handling the current request.
|
||||
|
|
@ -30,7 +30,7 @@ class ApplicationController < ActionController::Base
|
|||
# To disable a controller in the plugin, you can use this as a `before_action`:
|
||||
#
|
||||
# class MypluginController < ApplicationController
|
||||
# before_filter -> { require_plugin_enabled FoodsoftMyplugin }
|
||||
# before_action -> { require_plugin_enabled FoodsoftMyplugin }
|
||||
# end
|
||||
#
|
||||
def require_plugin_enabled(plugin)
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ class ArticleCategoriesController < ApplicationController
|
|||
|
||||
inherit_resources # Build default REST Actions via plugin
|
||||
|
||||
before_filter :authenticate_article_meta
|
||||
before_action :authenticate_article_meta
|
||||
|
||||
def create
|
||||
create!(:notice => I18n.t('article_categories.create.notice')) { article_categories_path }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# encoding: utf-8
|
||||
class ArticlesController < ApplicationController
|
||||
before_filter :authenticate_article_meta, :find_supplier
|
||||
before_action :authenticate_article_meta, :find_supplier
|
||||
|
||||
def index
|
||||
if params['sort']
|
||||
|
|
|
|||
|
|
@ -1,12 +1,12 @@
|
|||
# Controller concern to handle foodcoop scope
|
||||
#
|
||||
# Includes a +before_filter+ for selecting foodcoop from url.
|
||||
# Includes a +before_action+ for selecting foodcoop from url.
|
||||
#
|
||||
module Concerns::FoodcoopScope
|
||||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_filter :select_foodcoop
|
||||
before_action :select_foodcoop
|
||||
end
|
||||
|
||||
private
|
||||
|
|
|
|||
|
|
@ -2,7 +2,7 @@ module Concerns::Locale
|
|||
extend ActiveSupport::Concern
|
||||
|
||||
included do
|
||||
before_filter :set_locale
|
||||
before_action :set_locale
|
||||
end
|
||||
|
||||
def explicitly_requested_language
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
# encoding: utf-8
|
||||
class DeliveriesController < ApplicationController
|
||||
|
||||
before_filter :find_supplier, :exclude => :fill_new_stock_article_form
|
||||
|
||||
before_action :find_supplier, :exclude => :fill_new_stock_article_form
|
||||
|
||||
def index
|
||||
@deliveries = @supplier.deliveries.order('delivered_on DESC')
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
class ErrorsController < ApplicationController
|
||||
include Gaffe::Errors
|
||||
|
||||
skip_before_filter :authenticate
|
||||
skip_before_action :authenticate
|
||||
|
||||
layout :current_layout
|
||||
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class Finance::BankTransactionsController < ApplicationController
|
||||
before_filter :authenticate_finance
|
||||
before_action :authenticate_finance
|
||||
inherit_resources
|
||||
|
||||
def index
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class Finance::BaseController < ApplicationController
|
||||
before_filter :authenticate_finance
|
||||
before_action :authenticate_finance
|
||||
|
||||
def index
|
||||
@financial_transactions = FinancialTransaction.includes(:ordergroup).order('created_on DESC').limit(8)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
class Finance::FinancialLinksController < Finance::BaseController
|
||||
before_filter :find_financial_link, except: [:create]
|
||||
before_action :find_financial_link, except: [:create]
|
||||
|
||||
def show
|
||||
@items = @financial_link.bank_transactions.map do |bt|
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# encoding: utf-8
|
||||
class Finance::FinancialTransactionsController < ApplicationController
|
||||
before_filter :authenticate_finance
|
||||
before_filter :find_ordergroup, :except => [:new_collection, :create_collection, :index_collection]
|
||||
before_action :authenticate_finance
|
||||
before_action :find_ordergroup, :except => [:new_collection, :create_collection, :index_collection]
|
||||
inherit_resources
|
||||
# belongs_to :ordergroup
|
||||
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
class Finance::InvoicesController < ApplicationController
|
||||
|
||||
before_filter :find_invoice, only: [:show, :edit, :update, :destroy]
|
||||
before_filter :ensure_can_edit, only: [:edit, :update, :destroy]
|
||||
before_action :find_invoice, only: [:show, :edit, :update, :destroy]
|
||||
before_action :ensure_can_edit, only: [:edit, :update, :destroy]
|
||||
|
||||
def index
|
||||
@invoices = Invoice.includes(:supplier, :deliveries, :orders).order('date DESC').page(params[:page]).per(@per_page)
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
class Foodcoop::WorkgroupsController < ApplicationController
|
||||
|
||||
before_filter :authenticate_membership_or_admin,
|
||||
before_action :authenticate_membership_or_admin,
|
||||
:except => [:index]
|
||||
|
||||
def index
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
class GroupOrderArticlesController < ApplicationController
|
||||
|
||||
before_filter :authenticate_finance
|
||||
before_filter :find_group_order_article, except: [:new, :create]
|
||||
before_action :authenticate_finance
|
||||
before_action :find_group_order_article, except: [:new, :create]
|
||||
|
||||
layout false # We only use this controller to server js snippets, no need for layout rendering
|
||||
|
||||
|
|
|
|||
|
|
@ -2,10 +2,10 @@
|
|||
# Management actions that require the "orders" role are handled by the OrdersController.
|
||||
class GroupOrdersController < ApplicationController
|
||||
# Security
|
||||
before_filter :ensure_ordergroup_member
|
||||
before_filter :ensure_open_order, :only => [:new, :create, :edit, :update, :order, :stock_order, :saveOrder]
|
||||
before_filter :ensure_my_group_order, only: [:show, :edit, :update]
|
||||
before_filter :enough_apples?, only: [:new, :create]
|
||||
before_action :ensure_ordergroup_member
|
||||
before_action :ensure_open_order, :only => [:new, :create, :edit, :update, :order, :stock_order, :saveOrder]
|
||||
before_action :ensure_my_group_order, only: [:show, :edit, :update]
|
||||
before_action :enough_apples?, only: [:new, :create]
|
||||
|
||||
# Index page.
|
||||
def index
|
||||
|
|
@ -66,7 +66,7 @@ class GroupOrdersController < ApplicationController
|
|||
private
|
||||
|
||||
# Returns true if @current_user is member of an Ordergroup.
|
||||
# Used as a :before_filter by OrdersController.
|
||||
# Used as a :before_action by OrdersController.
|
||||
def ensure_ordergroup_member
|
||||
@ordergroup = @current_user.ordergroup
|
||||
if @ordergroup.nil?
|
||||
|
|
|
|||
|
|
@ -1,8 +1,8 @@
|
|||
class InvitesController < ApplicationController
|
||||
|
||||
before_filter :authenticate_membership_or_admin_for_invites
|
||||
before_filter -> { require_config_disabled :disable_invite }
|
||||
|
||||
before_action :authenticate_membership_or_admin_for_invites
|
||||
before_action -> { require_config_disabled :disable_invite }
|
||||
|
||||
def new
|
||||
@invite = Invite.new(:user => @current_user, :group => @group)
|
||||
end
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
# encoding: utf-8
|
||||
class LoginController < ApplicationController
|
||||
skip_before_filter :authenticate # no authentication since this is the login page
|
||||
before_filter :validate_token, :only => [:new_password, :update_password]
|
||||
skip_before_action :authenticate # no authentication since this is the login page
|
||||
before_action :validate_token, :only => [:new_password, :update_password]
|
||||
|
||||
# Display the form to enter an email address requesting a token to set a new password.
|
||||
def forgot_password
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
class OrderArticlesController < ApplicationController
|
||||
|
||||
before_filter :authenticate_finance_or_orders
|
||||
before_action :authenticate_finance_or_orders
|
||||
|
||||
layout false # We only use this controller to serve js snippets, no need for layout rendering
|
||||
|
||||
|
|
|
|||
|
|
@ -5,9 +5,9 @@
|
|||
class OrdersController < ApplicationController
|
||||
include Concerns::SendOrderPdf
|
||||
|
||||
before_filter :authenticate_pickups_or_orders
|
||||
before_filter :authenticate_orders, except: [:receive, :receive_on_order_article_create, :receive_on_order_article_update, :show]
|
||||
before_filter :remove_empty_article, only: [:create, :update]
|
||||
before_action :authenticate_pickups_or_orders
|
||||
before_action :authenticate_orders, except: [:receive, :receive_on_order_article_create, :receive_on_order_article_update, :show]
|
||||
before_action :remove_empty_article, only: [:create, :update]
|
||||
|
||||
# List orders
|
||||
def index
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
class PickupsController < ApplicationController
|
||||
|
||||
before_filter :authenticate_pickups
|
||||
before_action :authenticate_pickups
|
||||
|
||||
def index
|
||||
@orders = Order.finished_not_closed.order('pickup DESC').group_by { |o| o.pickup }
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
class SessionsController < ApplicationController
|
||||
|
||||
skip_before_filter :authenticate
|
||||
skip_before_action :authenticate
|
||||
layout 'login'
|
||||
|
||||
def new
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# Foodcoop-specific styling
|
||||
class StylesController < ApplicationController
|
||||
skip_before_filter :authenticate
|
||||
skip_before_action :authenticate
|
||||
|
||||
# renders foodcoop css, or 404 if not configured
|
||||
#
|
||||
|
|
|
|||
|
|
@ -1,6 +1,6 @@
|
|||
# encoding: utf-8
|
||||
class SuppliersController < ApplicationController
|
||||
before_filter :authenticate_suppliers, :except => [:index, :list]
|
||||
before_action :authenticate_suppliers, :except => [:index, :list]
|
||||
helper :deliveries
|
||||
|
||||
def index
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue