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

@ -46,4 +46,6 @@ if @saved
end
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
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

@ -6,7 +6,7 @@ var Login = {
if ($('alternate_auth_database')) $('alternate_auth_database').show();
if ($('openid_url')) $('openid_url').focus();
if ($('openid_url')) $('openid_url').select();
new CookieManager().setCookie('preferred_auth', 'openid');
new CookieManager().setCookie('preferred_auth', 'openid');
},
showDatabase: function(container) {
@ -16,9 +16,10 @@ var Login = {
if ($('alternate_auth_openid')) $('alternate_auth_openid').show();
if ($('user_login')) $('user_login').focus();
if ($('user_login')) $('user_login').select();
new CookieManager().setCookie('preferred_auth', 'database');
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
})
});
});
@ -106,9 +116,9 @@ Event.observe(window, 'load', function() {
*/
CookieManager = Class.create();
CookieManager.prototype =
{
{
BROWSER_IS_IE:
(document.all
(document.all
&& window.ActiveXObject
&& navigator.userAgent.toLowerCase().indexOf("msie") > -1
&& navigator.userAgent.toLowerCase().indexOf("opera") == -1),
@ -118,7 +128,7 @@ CookieManager.prototype =
* chokes on cookies containing double quotes...
*/
BROWSER_IS_OPERA:
(navigator.userAgent.toLowerCase().indexOf("opera") != -1),
(navigator.userAgent.toLowerCase().indexOf("opera") != -1),
initialize: function(options)
{
@ -217,7 +227,7 @@ CookieManager.prototype =
else
{
document.cookie =
aCookieName + '=;expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/';
aCookieName + '=;expires=Thu, 01-Jan-1970 00:00:01 GMT; path=/';
}
}
}