diff --git a/denote/static/js/denote.js b/denote/static/js/denote.js index af90511..c83d1e6 100644 --- a/denote/static/js/denote.js +++ b/denote/static/js/denote.js @@ -26,7 +26,7 @@ function getPreference(cname) { return null; } -function set_visible(id, visible, display="block") +function set_visible(id, visible, display) { widget = document.getElementById(id); if (visible) @@ -64,21 +64,21 @@ function updateHiddenCategories(cat_id, add) setPreference('hidden_categories', hidden_categories.join(",")); } -function hide_category(cat_id, update_cookie=true) +function hide_category(cat_id, update_cookie) { - set_visible("content_" + cat_id, false); - set_visible("minus_" + cat_id, false); + set_visible("content_" + cat_id, false, ""); + set_visible("minus_" + cat_id, false, ""); set_visible("plus_" + cat_id, true, "inline-block"); if (update_cookie) updateHiddenCategories(cat_id, true); } -function show_category(cat_id, update_cookie=true) +function show_category(cat_id, update_cookie) { - set_visible("content_" + cat_id, true); + set_visible("content_" + cat_id, true, "block"); set_visible("minus_" + cat_id, true, "inline-block"); - set_visible("plus_" + cat_id, false); + set_visible("plus_" + cat_id, false, ""); if (update_cookie) updateHiddenCategories(cat_id, false); @@ -115,12 +115,14 @@ function category_setup() function startup() { category_setup(); + if (location.search.search('edit_note') != -1) + edit_note(); } function edit_category(cat_id, name) { - set_visible("category_" + cat_id, false); - set_visible("edit_category_" + cat_id, true); + set_visible("category_" + cat_id, false, ""); + set_visible("edit_category_" + cat_id, true, "block"); input = document.getElementById("cat_name_" + cat_id); input.value = name; @@ -129,8 +131,8 @@ function edit_category(cat_id, name) function end_edit_category(cat_id) { - set_visible("category_" + cat_id, true); - set_visible("edit_category_" + cat_id, false); + set_visible("category_" + cat_id, true, "block"); + set_visible("edit_category_" + cat_id, false, ""); } function submit_category_name(cat_id, orig) @@ -157,19 +159,24 @@ function handleKeyPress(e, cat_id, orig){ function edit_note() { document.body.scrollTop = document.documentElement.scrollTop = 0; - set_visible("title", false); - set_visible("transformed_content", false); - set_visible("edit_button", false); - set_visible("form_delete", false); - set_visible("div_edit", true); + set_visible("title", false, ""); + set_visible("transformed_content", false, ""); + set_visible("edit_button", false, ""); + set_visible("form_delete", false, ""); + set_visible("div_edit", true, "block"); } function cancel_edit_note() { document.body.scrollTop = document.documentElement.scrollTop = 0; - set_visible("title", true); - set_visible("transformed_content", true); + set_visible("title", true, "block"); + set_visible("transformed_content", true, "block"); set_visible("edit_button", true, "inline"); set_visible("form_delete", true, "inline"); - set_visible("div_edit", false); + set_visible("div_edit", false, ""); +} + +function DoEdit(url) { + window.location.href = '/note/' + url + '?edit_note=1'; + return false; } diff --git a/denote/templates/base_user.html b/denote/templates/base_user.html index 2271da5..1dc9bc8 100644 --- a/denote/templates/base_user.html +++ b/denote/templates/base_user.html @@ -23,7 +23,7 @@ {% for meta_note in notes_by_category %}