Refactor: pull #query_statement_invalid up to ApplicationController.

git-svn-id: svn+ssh://rubyforge.org/var/svn/redmine/trunk@3696 e93f8b46-1217-0410-a6f0-8f06a7374b81
pull/351/head
Eric Davis 15 years ago
parent e65c3cfc7d
commit 488879d9cf
  1. 9
      app/controllers/application_controller.rb
  2. 11
      app/controllers/gantts_controller.rb
  3. 8
      app/controllers/issues_controller.rb

@ -329,4 +329,13 @@ class ApplicationController < ActionController::Base
def render_attachment_warning_if_needed(obj) def render_attachment_warning_if_needed(obj)
flash[:warning] = l(:warning_attachments_not_saved, obj.unsaved_attachments.size) if obj.unsaved_attachments.present? flash[:warning] = l(:warning_attachments_not_saved, obj.unsaved_attachments.size) if obj.unsaved_attachments.present?
end end
# Rescues an invalid query statement. Just in case...
def query_statement_invalid(exception)
logger.error "Query::StatementInvalid: #{exception.message}" if logger
session.delete(:query)
sort_clear if respond_to?(:sort_clear)
render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."
end
end end

@ -7,6 +7,8 @@ class GanttsController < ApplicationController
helper :projects helper :projects
helper :queries helper :queries
include QueriesHelper include QueriesHelper
helper :sort
include SortHelper
include Redmine::Export::PDF include Redmine::Export::PDF
def show def show
@ -42,15 +44,6 @@ class GanttsController < ApplicationController
private private
# Rescues an invalid query statement. Just in case...
# TODO: Refactor, move to ApplicationController with IssuesController
def query_statement_invalid(exception)
logger.error "Query::StatementInvalid: #{exception.message}" if logger
session.delete(:query)
sort_clear
render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."
end
# TODO: Refactor, duplicates IssuesController # TODO: Refactor, duplicates IssuesController
def find_optional_project def find_optional_project
@project = Project.find(params[:project_id]) unless params[:project_id].blank? @project = Project.find(params[:project_id]) unless params[:project_id].blank?

@ -453,14 +453,6 @@ private
render_404 render_404
end end
# Rescues an invalid query statement. Just in case...
def query_statement_invalid(exception)
logger.error "Query::StatementInvalid: #{exception.message}" if logger
session.delete(:query)
sort_clear
render_error "An error occurred while executing the query and has been logged. Please report this error to your Redmine administrator."
end
# Used by #edit and #update to set some common instance variables # Used by #edit and #update to set some common instance variables
# from the params # from the params
# TODO: Refactor, not everything in here is needed by #edit # TODO: Refactor, not everything in here is needed by #edit

Loading…
Cancel
Save