diff --git a/app/controllers/admin/base_controller.rb b/app/controllers/admin/base_controller.rb index facfa60a..8b520f06 100644 --- a/app/controllers/admin/base_controller.rb +++ b/app/controllers/admin/base_controller.rb @@ -1,5 +1,5 @@ class Admin::BaseController < ApplicationController - before_filter :authenticate_admin + before_action :authenticate_admin def index @user = current_user diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb index 0d097e16..b4c4ea8c 100644 --- a/app/controllers/application_controller.rb +++ b/app/controllers/application_controller.rb @@ -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) diff --git a/app/controllers/article_categories_controller.rb b/app/controllers/article_categories_controller.rb index 54710886..75189f78 100644 --- a/app/controllers/article_categories_controller.rb +++ b/app/controllers/article_categories_controller.rb @@ -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 } diff --git a/app/controllers/articles_controller.rb b/app/controllers/articles_controller.rb index fa681197..2f6b046c 100644 --- a/app/controllers/articles_controller.rb +++ b/app/controllers/articles_controller.rb @@ -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'] diff --git a/app/controllers/concerns/foodcoop_scope.rb b/app/controllers/concerns/foodcoop_scope.rb index bb38c829..37d2aa82 100644 --- a/app/controllers/concerns/foodcoop_scope.rb +++ b/app/controllers/concerns/foodcoop_scope.rb @@ -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 diff --git a/app/controllers/concerns/locale.rb b/app/controllers/concerns/locale.rb index d0e622bc..e8a4c285 100644 --- a/app/controllers/concerns/locale.rb +++ b/app/controllers/concerns/locale.rb @@ -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 diff --git a/app/controllers/deliveries_controller.rb b/app/controllers/deliveries_controller.rb index 102a4201..6f6bce52 100644 --- a/app/controllers/deliveries_controller.rb +++ b/app/controllers/deliveries_controller.rb @@ -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 diff --git a/app/controllers/errors_controller.rb b/app/controllers/errors_controller.rb index 15d11726..14f67084 100644 --- a/app/controllers/errors_controller.rb +++ b/app/controllers/errors_controller.rb @@ -1,7 +1,7 @@ class ErrorsController < ApplicationController include Gaffe::Errors - skip_before_filter :authenticate + skip_before_action :authenticate layout :current_layout diff --git a/app/controllers/finance/bank_transactions_controller.rb b/app/controllers/finance/bank_transactions_controller.rb index 7add74e7..2d409ce0 100644 --- a/app/controllers/finance/bank_transactions_controller.rb +++ b/app/controllers/finance/bank_transactions_controller.rb @@ -1,5 +1,5 @@ class Finance::BankTransactionsController < ApplicationController - before_filter :authenticate_finance + before_action :authenticate_finance inherit_resources def index diff --git a/app/controllers/finance/base_controller.rb b/app/controllers/finance/base_controller.rb index 3ecb0096..7c3668fd 100644 --- a/app/controllers/finance/base_controller.rb +++ b/app/controllers/finance/base_controller.rb @@ -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) diff --git a/app/controllers/finance/financial_links_controller.rb b/app/controllers/finance/financial_links_controller.rb index 231a7e65..68f062e8 100644 --- a/app/controllers/finance/financial_links_controller.rb +++ b/app/controllers/finance/financial_links_controller.rb @@ -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| diff --git a/app/controllers/finance/financial_transactions_controller.rb b/app/controllers/finance/financial_transactions_controller.rb index 82fca9e0..7eff1718 100644 --- a/app/controllers/finance/financial_transactions_controller.rb +++ b/app/controllers/finance/financial_transactions_controller.rb @@ -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 diff --git a/app/controllers/finance/invoices_controller.rb b/app/controllers/finance/invoices_controller.rb index 43a5ba3b..ef43c944 100644 --- a/app/controllers/finance/invoices_controller.rb +++ b/app/controllers/finance/invoices_controller.rb @@ -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) diff --git a/app/controllers/foodcoop/workgroups_controller.rb b/app/controllers/foodcoop/workgroups_controller.rb index 35eb2d50..72f7fb90 100644 --- a/app/controllers/foodcoop/workgroups_controller.rb +++ b/app/controllers/foodcoop/workgroups_controller.rb @@ -1,6 +1,6 @@ class Foodcoop::WorkgroupsController < ApplicationController - before_filter :authenticate_membership_or_admin, + before_action :authenticate_membership_or_admin, :except => [:index] def index diff --git a/app/controllers/group_order_articles_controller.rb b/app/controllers/group_order_articles_controller.rb index 991afa50..3fcba631 100644 --- a/app/controllers/group_order_articles_controller.rb +++ b/app/controllers/group_order_articles_controller.rb @@ -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 diff --git a/app/controllers/group_orders_controller.rb b/app/controllers/group_orders_controller.rb index 536b2035..4d9e73d9 100644 --- a/app/controllers/group_orders_controller.rb +++ b/app/controllers/group_orders_controller.rb @@ -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? diff --git a/app/controllers/invites_controller.rb b/app/controllers/invites_controller.rb index 87215876..b6fee901 100644 --- a/app/controllers/invites_controller.rb +++ b/app/controllers/invites_controller.rb @@ -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 diff --git a/app/controllers/login_controller.rb b/app/controllers/login_controller.rb index 097e7277..73ca00cc 100644 --- a/app/controllers/login_controller.rb +++ b/app/controllers/login_controller.rb @@ -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 diff --git a/app/controllers/order_articles_controller.rb b/app/controllers/order_articles_controller.rb index 68ca79d3..470efd54 100644 --- a/app/controllers/order_articles_controller.rb +++ b/app/controllers/order_articles_controller.rb @@ -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 diff --git a/app/controllers/orders_controller.rb b/app/controllers/orders_controller.rb index 2b66fba9..01707e7b 100644 --- a/app/controllers/orders_controller.rb +++ b/app/controllers/orders_controller.rb @@ -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 diff --git a/app/controllers/pickups_controller.rb b/app/controllers/pickups_controller.rb index 907eeef1..62c07d1b 100644 --- a/app/controllers/pickups_controller.rb +++ b/app/controllers/pickups_controller.rb @@ -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 } diff --git a/app/controllers/sessions_controller.rb b/app/controllers/sessions_controller.rb index 74bae0e7..e89e5771 100644 --- a/app/controllers/sessions_controller.rb +++ b/app/controllers/sessions_controller.rb @@ -1,6 +1,6 @@ class SessionsController < ApplicationController - skip_before_filter :authenticate + skip_before_action :authenticate layout 'login' def new diff --git a/app/controllers/styles_controller.rb b/app/controllers/styles_controller.rb index 98d4dd69..22d4c330 100644 --- a/app/controllers/styles_controller.rb +++ b/app/controllers/styles_controller.rb @@ -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 # diff --git a/app/controllers/suppliers_controller.rb b/app/controllers/suppliers_controller.rb index 2fb20d20..b725eb45 100644 --- a/app/controllers/suppliers_controller.rb +++ b/app/controllers/suppliers_controller.rb @@ -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 diff --git a/plugins/current_orders/app/controllers/current_orders/articles_controller.rb b/plugins/current_orders/app/controllers/current_orders/articles_controller.rb index 5bab8718..4f33f98e 100644 --- a/plugins/current_orders/app/controllers/current_orders/articles_controller.rb +++ b/plugins/current_orders/app/controllers/current_orders/articles_controller.rb @@ -1,8 +1,8 @@ # encoding: utf-8 class CurrentOrders::ArticlesController < ApplicationController - before_filter :authenticate_orders - before_filter :find_order_and_order_article, only: [:index, :show] + before_action :authenticate_orders + before_action :find_order_and_order_article, only: [:index, :show] def index # sometimes need to pass id as parameter for forms diff --git a/plugins/current_orders/app/controllers/current_orders/group_orders_controller.rb b/plugins/current_orders/app/controllers/current_orders/group_orders_controller.rb index 68c84b5c..3ab4fbda 100644 --- a/plugins/current_orders/app/controllers/current_orders/group_orders_controller.rb +++ b/plugins/current_orders/app/controllers/current_orders/group_orders_controller.rb @@ -1,6 +1,6 @@ class CurrentOrders::GroupOrdersController < ApplicationController # Security - before_filter :ensure_ordergroup_member + before_action :ensure_ordergroup_member def index # XXX code duplication lib/foodsoft_current_orders/app/controllers/current_orders/ordergroups_controller.rb diff --git a/plugins/current_orders/app/controllers/current_orders/ordergroups_controller.rb b/plugins/current_orders/app/controllers/current_orders/ordergroups_controller.rb index ddb7f00f..339209ab 100644 --- a/plugins/current_orders/app/controllers/current_orders/ordergroups_controller.rb +++ b/plugins/current_orders/app/controllers/current_orders/ordergroups_controller.rb @@ -1,8 +1,8 @@ # encoding: utf-8 class CurrentOrders::OrdergroupsController < ApplicationController - before_filter :authenticate_orders - before_filter :find_group_orders, only: [:index, :show] + before_action :authenticate_orders + before_action :find_group_orders, only: [:index, :show] def index # sometimes need to pass id as parameter for forms diff --git a/plugins/current_orders/app/controllers/current_orders/orders_controller.rb b/plugins/current_orders/app/controllers/current_orders/orders_controller.rb index b5ee1a33..a84570f2 100644 --- a/plugins/current_orders/app/controllers/current_orders/orders_controller.rb +++ b/plugins/current_orders/app/controllers/current_orders/orders_controller.rb @@ -1,6 +1,6 @@ class CurrentOrders::OrdersController < ApplicationController - before_filter :authenticate_orders, except: :my + before_action :authenticate_orders, except: :my def show @doc_options ||= {} diff --git a/plugins/current_orders/app/controllers/current_orders_controller.rb b/plugins/current_orders/app/controllers/current_orders_controller.rb index 2d0a0d97..c2488ad1 100644 --- a/plugins/current_orders/app/controllers/current_orders_controller.rb +++ b/plugins/current_orders/app/controllers/current_orders_controller.rb @@ -1,6 +1,6 @@ # encoding: utf-8 class CurrentOrdersController < ApplicationController - - before_filter :authenticate_orders + + before_action :authenticate_orders end diff --git a/plugins/discourse/app/controllers/discourse_controller.rb b/plugins/discourse/app/controllers/discourse_controller.rb index e4cb795f..7ad2904a 100644 --- a/plugins/discourse/app/controllers/discourse_controller.rb +++ b/plugins/discourse/app/controllers/discourse_controller.rb @@ -1,6 +1,6 @@ class DiscourseController < ApplicationController - before_filter -> { require_plugin_enabled FoodsoftDiscourse } + before_action -> { require_plugin_enabled FoodsoftDiscourse } protected diff --git a/plugins/discourse/app/controllers/discourse_login_controller.rb b/plugins/discourse/app/controllers/discourse_login_controller.rb index e5717d2a..c5dfb5e7 100644 --- a/plugins/discourse/app/controllers/discourse_login_controller.rb +++ b/plugins/discourse/app/controllers/discourse_login_controller.rb @@ -1,7 +1,7 @@ class DiscourseLoginController < DiscourseController - before_filter -> { require_config_disabled :discourse_sso } - skip_before_filter :authenticate + before_action -> { require_config_disabled :discourse_sso } + skip_before_action :authenticate def initiate discourse_url = FoodsoftConfig[:discourse_url] diff --git a/plugins/discourse/app/controllers/discourse_sso_controller.rb b/plugins/discourse/app/controllers/discourse_sso_controller.rb index 9bab89dc..f11397a4 100644 --- a/plugins/discourse/app/controllers/discourse_sso_controller.rb +++ b/plugins/discourse/app/controllers/discourse_sso_controller.rb @@ -1,6 +1,6 @@ class DiscourseSsoController < DiscourseController - before_filter -> { require_config_enabled :discourse_sso } + before_action -> { require_config_enabled :discourse_sso } def sso raise I18n.t('discourse.sso.invalid_signature') unless valid_signature? diff --git a/plugins/documents/app/controllers/documents_controller.rb b/plugins/documents/app/controllers/documents_controller.rb index acca52e8..aaf23ac7 100644 --- a/plugins/documents/app/controllers/documents_controller.rb +++ b/plugins/documents/app/controllers/documents_controller.rb @@ -1,7 +1,7 @@ require 'filemagic' class DocumentsController < ApplicationController - before_filter -> { require_plugin_enabled FoodsoftDocuments } + before_action -> { require_plugin_enabled FoodsoftDocuments } def index if params["sort"] diff --git a/plugins/messages/app/controllers/message_threads_controller.rb b/plugins/messages/app/controllers/message_threads_controller.rb index 43756fa0..22a18e28 100644 --- a/plugins/messages/app/controllers/message_threads_controller.rb +++ b/plugins/messages/app/controllers/message_threads_controller.rb @@ -1,6 +1,6 @@ class MessageThreadsController < ApplicationController - before_filter -> { require_plugin_enabled FoodsoftMessages } + before_action -> { require_plugin_enabled FoodsoftMessages } def index @groups = Group.order(:name) diff --git a/plugins/messages/app/controllers/messages_controller.rb b/plugins/messages/app/controllers/messages_controller.rb index 71be748e..d0581df1 100644 --- a/plugins/messages/app/controllers/messages_controller.rb +++ b/plugins/messages/app/controllers/messages_controller.rb @@ -1,6 +1,6 @@ class MessagesController < ApplicationController - before_filter -> { require_plugin_enabled FoodsoftMessages } + before_action -> { require_plugin_enabled FoodsoftMessages } # Renders the "inbox" action. def index diff --git a/plugins/printer/app/controllers/printer_controller.rb b/plugins/printer/app/controllers/printer_controller.rb index e9ae2c5c..2ac8dc08 100644 --- a/plugins/printer/app/controllers/printer_controller.rb +++ b/plugins/printer/app/controllers/printer_controller.rb @@ -2,9 +2,9 @@ class PrinterController < ApplicationController include Concerns::SendOrderPdf include Tubesock::Hijack - skip_before_filter :authenticate - before_filter :authenticate_printer - before_filter -> { require_plugin_enabled FoodsoftPrinter } + skip_before_action :authenticate + before_action :authenticate_printer + before_action -> { require_plugin_enabled FoodsoftPrinter } def socket hijack do |tubesock| diff --git a/plugins/printer/app/controllers/printer_jobs_controller.rb b/plugins/printer/app/controllers/printer_jobs_controller.rb index 75312b0c..4a4002bc 100644 --- a/plugins/printer/app/controllers/printer_jobs_controller.rb +++ b/plugins/printer/app/controllers/printer_jobs_controller.rb @@ -1,7 +1,7 @@ class PrinterJobsController < ApplicationController include Concerns::SendOrderPdf - before_filter -> { require_plugin_enabled FoodsoftPrinter } + before_action -> { require_plugin_enabled FoodsoftPrinter } def index jobs = PrinterJob.includes(:printer_job_updates) diff --git a/plugins/uservoice/lib/foodsoft_uservoice.rb b/plugins/uservoice/lib/foodsoft_uservoice.rb index d8942d89..3ad9a85c 100644 --- a/plugins/uservoice/lib/foodsoft_uservoice.rb +++ b/plugins/uservoice/lib/foodsoft_uservoice.rb @@ -10,7 +10,7 @@ module FoodsoftUservoice module LoadUservoice def self.included(base) # :nodoc: base.class_eval do - before_filter :add_uservoice_script + before_action :add_uservoice_script protected diff --git a/plugins/wiki/app/controllers/pages_controller.rb b/plugins/wiki/app/controllers/pages_controller.rb index 06c6a6a4..e8ae9e73 100644 --- a/plugins/wiki/app/controllers/pages_controller.rb +++ b/plugins/wiki/app/controllers/pages_controller.rb @@ -1,13 +1,13 @@ # encoding: utf-8 class PagesController < ApplicationController - before_filter -> { require_plugin_enabled FoodsoftWiki } - before_filter :catch_special_pages, only: [:show, :new] + before_action -> { require_plugin_enabled FoodsoftWiki } + before_action :catch_special_pages, only: [:show, :new] - skip_before_filter :authenticate, :only => :all - before_filter :only => :all do + skip_before_action :authenticate, :only => :all + before_action :only => :all do authenticate_or_token(['wiki', 'all']) end - before_filter do + before_action do content_for :head, view_context.rss_meta_tag end