forked from refinery/refinerycms
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix a case where the wymeditor fields were not getting updated proper…
…ly when using save and continue. Moved continue_editing javascript to admin.js and we are using jQuery for many of the functions inside admin.js now.
- Loading branch information
Showing
2 changed files
with
49 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
49 changes: 1 addition & 48 deletions
49
vendor/plugins/refinery/app/views/shared/admin/_continue_editing.html.erb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,4 @@ | ||
<% unless f.object.new_record? -%> | ||
<%= hidden_field_tag :continue_editing, false %> | ||
<%= f.submit 'Save & Continue Editing', :id => "submit_continue_button", :class => "wymupdate" %> | ||
<% content_for :head do -%> | ||
<script type='text/javascript'> | ||
FastInit.addOnLoad(function() { | ||
if ($('submit_continue_button') != null) { | ||
$('submit_continue_button').observe("click", function(e) { | ||
$('continue_editing').value = true; | ||
|
||
if ((flash=$('flash')) != null) { | ||
flash.hide(); | ||
} | ||
|
||
new Ajax.Request(this.form.action, { | ||
method: this.form.method | ||
, parameters: this.form.serialize() | ||
, onComplete: function(e) { | ||
if ((flash_container = $('flash_container')) != null) { | ||
|
||
flash_container.update(e.transport.responseText); | ||
|
||
if ((flash = $('flash')) != null) { | ||
flash.style.width = 'auto'; | ||
flash.appear(); | ||
} | ||
|
||
$$('#errorExplanation').each(function(errorExplanation) { | ||
if (errorExplanation.parentNode.id != 'flash_container') { | ||
errorExplanation.remove(); | ||
} | ||
}); | ||
|
||
$$('.fieldWithErrors').each(function(field) { | ||
field.removeClassName('fieldWithErrors').addClassName('field'); | ||
}); | ||
|
||
flash_container.scrollTo(); | ||
$('continue_editing').value = false; | ||
} | ||
} | ||
, evalScripts: true | ||
}); | ||
|
||
e.preventDefault(); | ||
}); | ||
} | ||
}); | ||
</script> | ||
<% end -%> | ||
<% end -%> | ||
<% end -%> |