make sure that new/updated todos also get the behavior enabled for toggling notes

This commit is contained in:
Reinier Balt 2009-03-31 09:56:23 +02:00
parent 33e96dd42e
commit 480af3a2ab
5 changed files with 27 additions and 11 deletions

View file

@ -115,7 +115,7 @@
/* for toggle notes link in mininav */
jQuery("#toggle-notes-nav").click(function () { jQuery(".todo_notes").toggle(); });
/* show the notes of a todo */
jQuery(".show_notes").click(function () { jQuery(this).next().toggle("fast"); return false; });
TodoBehavior.enableToggleNotes();
Nifty("div#todo_new_action_container","normal");
if ($('flash').visible()) { new Effect.Fade("flash",{duration:5.0}); }
});

View file

@ -20,6 +20,8 @@ if @saved
page.visual_effect :highlight, dom_id(@todo), :duration => 3
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

View file

@ -47,3 +47,5 @@ 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()"

View file

@ -6,7 +6,8 @@ if @saved
status_message = 'Added new context / ' + status_message if @new_context_created
page.notify :notice, status_message, 5.0
# update auto completer arrays for edit form in right column, only for pages with that form
# update auto completer arrays for edit form in right column, only for pages
# with that form
unless source_view_is_one_of(:calendar)
page << "contextAutoCompleter.options.array = #{context_names_for_autocomplete}; contextAutoCompleter.changed = true" if @new_context_created
page << "projectAutoCompleter.options.array = #{project_names_for_autocomplete}; projectAutoCompleter.changed = true" if @new_project_created
@ -123,7 +124,8 @@ 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')}"

View file

@ -19,6 +19,7 @@ var Login = {
new CookieManager().setCookie('preferred_auth', 'database');
}
}
var TracksForm = {
toggle: function(toggleDivId, formContainerId, formId, hideLinkText, hideLinkTitle, showLinkText, showLinkTitle) {
$(formContainerId).toggle();
@ -85,6 +86,13 @@ var TracksForm = {
}
}
var TodoBehavior = {
enableToggleNotes: function() {
jQuery(".show_notes").click(function () {
jQuery(this).next().toggle("fast"); return false;
});
}
}
// uncomment the next four lines for easier debugging with FireBug
// Ajax.Responders.register({
// onException: function(source, exception) {
@ -96,7 +104,9 @@ var TracksForm = {
Event.observe(window, 'load', function() {
$A(document.getElementsByClassName('alert')).each(function(o) {
o.opacity = 100.0
Effect.Fade(o, {duration: 8.0})
Effect.Fade(o, {
duration: 8.0
})
});
});