[issue #64] Fixed bug with preview page.
This commit is contained in:
parent
407130f3d7
commit
d3b32e4d6d
|
@ -36,7 +36,8 @@
|
|||
%br
|
||||
|
||||
= submit_tag t("layout.wiki.save_button"), :id => "gollum-editor-submit", :title => t("layout.wiki.save_changes")
|
||||
= link_to t("layout.wiki.preview"), "javascript:void(0)", :id => "gollum-editor-preview", :class => "minibutton", :title => t("layout.wiki.preview_title")
|
||||
= link_to t("layout.wiki.preview"), "javascript:void(0)", :id => "gollum-editor-preview",
|
||||
:class => "minibutton", :title => t("layout.wiki.preview_title"), :'data-url' => preview_project_wiki_index_path(@project)
|
||||
|
||||
- content_for :javascripts do
|
||||
= javascript_include_tag 'gollum/editor/gollum.editor.js'
|
||||
|
|
|
@ -63,11 +63,18 @@
|
|||
// get form fields
|
||||
var oldAction = $('#gollum-editor form').attr('action');
|
||||
var $form = $($('#gollum-editor form').get(0));
|
||||
$form.attr('action', $form.attr('action') + '/preview');
|
||||
$form.attr('action', $('#gollum-editor #gollum-editor-preview').attr('data-url'));
|
||||
$form.attr('target', '_blank');
|
||||
//$form.find('input[name=_method]').val('post');
|
||||
var $oldMeth = $('#gollum-editor form input[name=_method]');
|
||||
if ( $oldMeth.length ) {
|
||||
$oldMeth.remove();
|
||||
}
|
||||
$form.submit();
|
||||
|
||||
|
||||
if ( $oldMeth.length ) {
|
||||
$form.append($oldMeth);
|
||||
}
|
||||
$form.attr('action', oldAction);
|
||||
$form.removeAttr('target');
|
||||
return false;
|
||||
|
|
Loading…
Reference in New Issue