Project

General

Profile

Patch #13629 ยป 0027-Add-method-option-for-submitPreview-js.patch

Alex Shulgin, 2013-03-28 15:04

View differences:

app/helpers/application_helper.rb
1034 1034
  end
1035 1035

  
1036 1036
  def preview_link(url, form, target='preview', options={})
1037
    method = options.delete(:method) || 'post'
1037 1038
    content_tag 'a', l(:label_preview), {
1038 1039
        :href => "#", 
1039
        :onclick => %|submitPreview("#{escape_javascript url_for(url)}", "#{escape_javascript form}", "#{escape_javascript target}"); return false;|, 
1040
        :onclick => %|submitPreview("#{escape_javascript url_for(url)}", "#{escape_javascript form}", "#{escape_javascript target}", "#{escape_javascript method}"); return false;|, 
1040 1041
        :accesskey => accesskey(:preview)
1041 1042
      }.merge(options)
1042 1043
  end
public/javascripts/application.js
402 402
  modal.dialog("close");
403 403
}
404 404

  
405
function submitPreview(url, form, target) {
405
function submitPreview(url, form, target, method) {
406 406
  $.ajax({
407 407
    url: url,
408
    type: 'post',
408
    type: method,
409 409
    data: $('#'+form).serialize(),
410 410
    success: function(data){
411 411
      $('#'+target).html(data);
    (1-1/1)