redmine.patch

Massimo Zaniboni, 2011-01-10 00:30

Download (2.54 KB)

View differences:

app/controllers/application_controller.rb
39 39
  before_filter :user_setup, :check_if_login_required, :set_localization
40 40
  filter_parameter_logging :password
41 41
  protect_from_forgery
42
  
42

  
43 43
  rescue_from ActionController::InvalidAuthenticityToken, :with => :invalid_authenticity_token
44

  
45
  after_filter :before_sending_response_hook
46
  def before_sending_response_hook
47
    call_hook(:application_controller_before_sending_response, { :user => User.current, :request => request, :headers => headers, :response => response, :logger => logger })
48
  end
44 49
  
45 50
  include Redmine::Search::Controller
46 51
  include Redmine::MenuManager::MenuController
app/views/issues/index.rhtml
37 37

  
38 38
    <%= link_to_remote l(:button_apply), 
39 39
                       { :url => { :set_filter => 1 },
40
                         :method => :get,
40 41
                         :before => 'selectAllOptions("selected_columns");',
41 42
                         :update => "content",
42 43
                         :complete => "apply_filters_observer()",
43
                         :with => "Form.serialize('query_form')"
44
                         :with => "RedMineForm_serializeExceptAuthenticityToken('query_form')",
44 45
                       }, :class => 'icon icon-checked' %>
45 46
                       
46 47
    <%= link_to_remote l(:button_clear),
public/javascripts/application.js
253 253
}
254 254

  
255 255
Event.observe(window, 'load', hideOnLoad);
256

  
257
function RedMineForm_serializeExceptAuthenticityToken(form, options) {
258
  return Form.serializeElements(RedMineForm_getElementsExceptAuthenticityCode(form), options);
259
}
260

  
261
function RedMineForm_getElementsExceptAuthenticityCode(form) {
262
  return $A($(form).getElementsByTagName('*')).inject([],
263
  function(elements, child) {
264
    var e = child.readAttribute('name');
265
    if (e == null || e.toLowerCase() != 'authenticity_token') {
266
      if (Form.Element.Serializers[child.tagName.toLowerCase()])
267
        elements.push(Element.extend(child));
268
      }
269
      return elements;
270
    }
271
  );
272
}