mirror of
https://github.com/TracksApp/tracks.git
synced 2025-12-30 13:58:49 +01:00
Simplify some stuff thanks to live()
This commit is contained in:
parent
290fa3351c
commit
f9d37d1d90
4 changed files with 4 additions and 14 deletions
|
|
@ -22,7 +22,6 @@ if @saved
|
|||
page[empty_container_msg_div_id].hide unless empty_container_msg_div_id.nil?
|
||||
end
|
||||
# make sure the behavior of the new/updated todo is enabled
|
||||
page << "TodoBehavior.enableToggleNotes()"
|
||||
page['tickler-empty-nd'].hide if source_view_is :deferred
|
||||
end
|
||||
else
|
||||
|
|
|
|||
|
|
@ -54,5 +54,3 @@ if @saved
|
|||
else
|
||||
page.replace_html "status", content_tag("div", content_tag("h2", "#{pluralize(@todo.errors.count, "error")} prohibited this action from being saved") + content_tag("p", "There were problems with the following fields:") + content_tag("ul", @todo.errors.each_full { |msg| content_tag("li", msg) }), "id" => "errorExplanation", "class" => "errorExplanation")
|
||||
end
|
||||
# make sure the behavior of the new/updated todo is enabled
|
||||
page << "TodoBehavior.enableToggleNotes()"
|
||||
|
|
|
|||
|
|
@ -135,8 +135,6 @@ if @saved
|
|||
else
|
||||
logger.error "unexpected source_view '#{params[:_source_view]}'"
|
||||
end
|
||||
# make sure the behavior of the new/updated todo is enabled
|
||||
page << "TodoBehavior.enableToggleNotes()"
|
||||
else
|
||||
page.show 'error_status'
|
||||
page.replace_html 'error_status', "#{error_messages_for('todo')}"
|
||||
|
|
|
|||
|
|
@ -86,14 +86,6 @@ var TracksForm = {
|
|||
}
|
||||
}
|
||||
|
||||
var TodoBehavior = {
|
||||
enableToggleNotes: function() {
|
||||
$(".show_notes").unbind('click').bind('click', function () {
|
||||
$(this).next().toggle("fast"); return false;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
$.fn.clearForm = function() {
|
||||
return this.each(function() {
|
||||
var type = this.type, tag = this.tagName.toLowerCase();
|
||||
|
|
@ -316,8 +308,11 @@ $(document).ready(function() {
|
|||
|
||||
/* for toggle notes link in mininav */
|
||||
$("#toggle-notes-nav").click(function () { jQuery(".todo_notes").toggle(); });
|
||||
|
||||
/* show the notes of a todo */
|
||||
TodoBehavior.enableToggleNotes();
|
||||
$(".show_notes").live('click', function () {
|
||||
$(this).next().toggle("fast"); return false;
|
||||
});
|
||||
|
||||
/* fade flashes and alerts in automatically */
|
||||
$(".alert").fadeOut(8000);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue