diff --git a/app/views/layouts/standard.html.erb b/app/views/layouts/standard.html.erb
index ecf6a034..2326a047 100644
--- a/app/views/layouts/standard.html.erb
+++ b/app/views/layouts/standard.html.erb
@@ -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}); }
});
diff --git a/app/views/todos/create.js.rjs b/app/views/todos/create.js.rjs
index 06d663d3..2ff2e01a 100644
--- a/app/views/todos/create.js.rjs
+++ b/app/views/todos/create.js.rjs
@@ -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
diff --git a/app/views/todos/toggle_check.js.rjs b/app/views/todos/toggle_check.js.rjs
index 9ce07e83..c1757628 100644
--- a/app/views/todos/toggle_check.js.rjs
+++ b/app/views/todos/toggle_check.js.rjs
@@ -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
\ No newline at end of file
+end
+# make sure the behavior of the new/updated todo is enabled
+page << "TodoBehavior.enableToggleNotes()"
\ No newline at end of file
diff --git a/app/views/todos/update.js.rjs b/app/views/todos/update.js.rjs
index 60a236e9..9c7d7275 100644
--- a/app/views/todos/update.js.rjs
+++ b/app/views/todos/update.js.rjs
@@ -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')}"
diff --git a/public/javascripts/application.js b/public/javascripts/application.js
index b22fd832..51a6932d 100644
--- a/public/javascripts/application.js
+++ b/public/javascripts/application.js
@@ -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=/';
}
}
}
\ No newline at end of file