mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-16 23:30:12 +01:00
Convert before_filter to before_action
`before_filter` has been removed in future versions of rails. Co-Authored-By: Dan Rice <dnrce@users.noreply.github.com>
This commit is contained in:
parent
dab358cad0
commit
60ae4f6f5f
13 changed files with 39 additions and 39 deletions
|
|
@ -12,13 +12,13 @@ class ApplicationController < ActionController::Base
|
||||||
layout proc{ |controller| controller.mobile? ? "mobile" : "application" }
|
layout proc{ |controller| controller.mobile? ? "mobile" : "application" }
|
||||||
# exempt_from_layout /\.js\.erb$/
|
# exempt_from_layout /\.js\.erb$/
|
||||||
|
|
||||||
before_filter :set_session_expiration
|
before_action :set_session_expiration
|
||||||
before_filter :set_time_zone
|
before_action :set_time_zone
|
||||||
before_filter :set_zindex_counter
|
before_action :set_zindex_counter
|
||||||
before_filter :set_locale
|
before_action :set_locale
|
||||||
append_before_filter :set_group_view_by
|
append_before_action :set_group_view_by
|
||||||
prepend_before_filter :login_required
|
prepend_before_action :login_required
|
||||||
prepend_before_filter :enable_mobile_content_negotiation
|
prepend_before_action :enable_mobile_content_negotiation
|
||||||
|
|
||||||
def set_locale
|
def set_locale
|
||||||
locale = params[:locale] # specifying a locale in the request takes precedence
|
locale = params[:locale] # specifying a locale in the request takes precedence
|
||||||
|
|
@ -119,7 +119,7 @@ class ApplicationController < ActionController::Base
|
||||||
# versions. Unfortunately, I ran into a lot of trouble simply registering a
|
# versions. Unfortunately, I ran into a lot of trouble simply registering a
|
||||||
# new mime type 'text/html' with format :m because :html already is linked to
|
# new mime type 'text/html' with format :m because :html already is linked to
|
||||||
# that mime type and the new registration was forcing all html requests to be
|
# that mime type and the new registration was forcing all html requests to be
|
||||||
# rendered in the mobile view. The before_filter and after_filter hackery
|
# rendered in the mobile view. The before_action and after_filter hackery
|
||||||
# below accomplishs that implementation goal by using a 'fake' mime type
|
# below accomplishs that implementation goal by using a 'fake' mime type
|
||||||
# during the processing and then setting it to 'text/html' in an
|
# during the processing and then setting it to 'text/html' in an
|
||||||
# 'after_filter' -LKM 2007-04-01
|
# 'after_filter' -LKM 2007-04-01
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
class CalendarController < ApplicationController
|
class CalendarController < ApplicationController
|
||||||
skip_before_filter :login_required, :only => [:show]
|
skip_before_action :login_required, :only => [:show]
|
||||||
prepend_before_filter :login_or_feed_token_required, :only => [:show]
|
prepend_before_action :login_or_feed_token_required, :only => [:show]
|
||||||
|
|
||||||
def show
|
def show
|
||||||
@source_view = 'calendar'
|
@source_view = 'calendar'
|
||||||
|
|
|
||||||
|
|
@ -2,10 +2,10 @@ class ContextsController < ApplicationController
|
||||||
|
|
||||||
helper :todos
|
helper :todos
|
||||||
|
|
||||||
before_filter :init, :except => [:index, :create, :destroy, :order]
|
before_action :init, :except => [:index, :create, :destroy, :order]
|
||||||
before_filter :set_context_from_params, :only => [:update, :destroy]
|
before_action :set_context_from_params, :only => [:update, :destroy]
|
||||||
skip_before_filter :login_required, :only => [:index]
|
skip_before_action :login_required, :only => [:index]
|
||||||
prepend_before_filter :login_or_feed_token_required, :only => [:index]
|
prepend_before_action :login_or_feed_token_required, :only => [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@all_contexts = current_user.contexts
|
@all_contexts = current_user.contexts
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
class IntegrationsController < ApplicationController
|
class IntegrationsController < ApplicationController
|
||||||
require 'mail'
|
require 'mail'
|
||||||
|
|
||||||
skip_before_filter :login_required, :only => [:cloudmailin, :search_plugin]
|
skip_before_action :login_required, :only => [:cloudmailin, :search_plugin]
|
||||||
skip_before_filter :verify_authenticity_token, only: [:cloudmailin]
|
skip_before_action :verify_authenticity_token, only: [:cloudmailin]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@page_title = 'TRACKS::Integrations'
|
@page_title = 'TRACKS::Integrations'
|
||||||
|
|
|
||||||
|
|
@ -1,10 +1,10 @@
|
||||||
class LoginController < ApplicationController
|
class LoginController < ApplicationController
|
||||||
|
|
||||||
layout 'login'
|
layout 'login'
|
||||||
skip_before_filter :set_session_expiration
|
skip_before_action :set_session_expiration
|
||||||
skip_before_filter :login_required
|
skip_before_action :login_required
|
||||||
before_filter :login_optional
|
before_action :login_optional
|
||||||
before_filter :get_current_user
|
before_action :get_current_user
|
||||||
|
|
||||||
protect_from_forgery :except => [:check_expiry, :login]
|
protect_from_forgery :except => [:check_expiry, :login]
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ require 'openssl'
|
||||||
|
|
||||||
class MailgunController < ApplicationController
|
class MailgunController < ApplicationController
|
||||||
|
|
||||||
skip_before_filter :login_required, :only => [:mailgun]
|
skip_before_action :login_required, :only => [:mailgun]
|
||||||
before_filter :verify, :only => [:mailgun]
|
before_action :verify, :only => [:mailgun]
|
||||||
protect_from_forgery with: :null_session
|
protect_from_forgery with: :null_session
|
||||||
|
|
||||||
def mailgun
|
def mailgun
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
class NotesController < ApplicationController
|
class NotesController < ApplicationController
|
||||||
|
|
||||||
before_filter :set_source_view
|
before_action :set_source_view
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@all_notes = current_user.notes
|
@all_notes = current_user.notes
|
||||||
|
|
|
||||||
|
|
@ -1,11 +1,11 @@
|
||||||
class ProjectsController < ApplicationController
|
class ProjectsController < ApplicationController
|
||||||
|
|
||||||
helper :application, :todos, :notes
|
helper :application, :todos, :notes
|
||||||
before_filter :set_source_view
|
before_action :set_source_view
|
||||||
before_filter :set_project_from_params, :only => [:update, :destroy, :show, :edit, :set_reviewed]
|
before_action :set_project_from_params, :only => [:update, :destroy, :show, :edit, :set_reviewed]
|
||||||
before_filter :default_context_filter, :only => [:create, :update]
|
before_action :default_context_filter, :only => [:create, :update]
|
||||||
skip_before_filter :login_required, :only => [:index]
|
skip_before_action :login_required, :only => [:index]
|
||||||
prepend_before_filter :login_or_feed_token_required, :only => [:index]
|
prepend_before_action :login_or_feed_token_required, :only => [:index]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@source_view = params['_source_view'] || 'project_list'
|
@source_view = params['_source_view'] || 'project_list'
|
||||||
|
|
|
||||||
|
|
@ -2,8 +2,8 @@ class RecurringTodosController < ApplicationController
|
||||||
|
|
||||||
helper :todos, :recurring_todos
|
helper :todos, :recurring_todos
|
||||||
|
|
||||||
append_before_filter :init, :only => [:index, :new, :edit, :create]
|
append_before_action :init, :only => [:index, :new, :edit, :create]
|
||||||
append_before_filter :get_recurring_todo_from_param, :only => [:destroy, :toggle_check, :toggle_star, :edit, :update]
|
append_before_action :get_recurring_todo_from_param, :only => [:destroy, :toggle_check, :toggle_star, :edit, :update]
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@page_title = t('todos.recurring_actions_title')
|
@page_title = t('todos.recurring_actions_title')
|
||||||
|
|
|
||||||
|
|
@ -3,7 +3,7 @@ class StatsController < ApplicationController
|
||||||
SECONDS_PER_DAY = 86400;
|
SECONDS_PER_DAY = 86400;
|
||||||
|
|
||||||
helper :todos, :projects, :recurring_todos
|
helper :todos, :projects, :recurring_todos
|
||||||
append_before_filter :init, :except => :index
|
append_before_action :init, :except => :index
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@page_title = t('stats.index_title')
|
@page_title = t('stats.index_title')
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
class TodosController < ApplicationController
|
class TodosController < ApplicationController
|
||||||
|
|
||||||
skip_before_filter :login_required, :only => [:index, :tag]
|
skip_before_action :login_required, :only => [:index, :tag]
|
||||||
prepend_before_filter :login_or_feed_token_required, :only => [:index, :tag]
|
prepend_before_action :login_or_feed_token_required, :only => [:index, :tag]
|
||||||
append_before_filter :find_and_activate_ready, :only => [:index, :list_deferred]
|
append_before_action :find_and_activate_ready, :only => [:index, :list_deferred]
|
||||||
|
|
||||||
protect_from_forgery :except => :check_deferred
|
protect_from_forgery :except => :check_deferred
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1,8 +1,8 @@
|
||||||
class UsersController < ApplicationController
|
class UsersController < ApplicationController
|
||||||
|
|
||||||
before_filter :admin_login_required, :only => [ :index, :show, :destroy ]
|
before_action :admin_login_required, :only => [ :index, :show, :destroy ]
|
||||||
skip_before_filter :login_required, :only => [ :new, :create ]
|
skip_before_action :login_required, :only => [ :new, :create ]
|
||||||
prepend_before_filter :login_optional, :only => [ :new, :create ]
|
prepend_before_action :login_optional, :only => [ :new, :create ]
|
||||||
|
|
||||||
# GET /users GET /users.xml
|
# GET /users GET /users.xml
|
||||||
def index
|
def index
|
||||||
|
|
|
||||||
|
|
@ -55,7 +55,7 @@ module LoginSystem
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|
||||||
# When called with before_filter :login_from_cookie will check for an :auth_token
|
# When called with before_action :login_from_cookie will check for an :auth_token
|
||||||
# cookie and log the user back in if appropriate
|
# cookie and log the user back in if appropriate
|
||||||
def login_from_cookie
|
def login_from_cookie
|
||||||
return unless cookies[:auth_token] && !logged_in?
|
return unless cookies[:auth_token] && !logged_in?
|
||||||
|
|
@ -82,7 +82,7 @@ module LoginSystem
|
||||||
|
|
||||||
# login_required filter. add
|
# login_required filter. add
|
||||||
#
|
#
|
||||||
# before_filter :login_required
|
# before_action :login_required
|
||||||
#
|
#
|
||||||
# if the controller should be under any rights management.
|
# if the controller should be under any rights management.
|
||||||
# for finer access control you can overwrite
|
# for finer access control you can overwrite
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue