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 %}
- {{ meta_note.category }} ({{ meta_note.notes|length }}) + {{ meta_note.category }} ({{ meta_note.notes|length }})
@@ -34,7 +34,7 @@
{% for note in meta_note.notes %}
-
{{ note.title }}
+
{{ note.title }}
{{ note.created_date }}
{{ note.short_summary }}
@@ -45,11 +45,11 @@ {% if notes_without_category|length != 0 %}
- Other ({{ notes_without_category|length }})
+ Other ({{ notes_without_category|length }})
{% for note in notes_without_category %}
-
{{ note.title }}
+
{{ note.title }}
{{ note.created_date }}
{{ note.short_summary }}
diff --git a/denote/templates/login.html b/denote/templates/login.html index 586d12b..1686d6f 100644 --- a/denote/templates/login.html +++ b/denote/templates/login.html @@ -26,7 +26,7 @@ Login Password - Create an account + Create an account
(already {{ nb_people_registered }} people(s) registered)
diff --git a/denote/templates/user_index.html b/denote/templates/user_index.html index dd1db73..10693b9 100644 --- a/denote/templates/user_index.html +++ b/denote/templates/user_index.html @@ -4,9 +4,9 @@ {% for note in notes %}
{% if note.category != None %} - + {% else %} - + {% endif %}
{{ note.modified_date }}
{{ note.long_summary }}
diff --git a/denote/views.py b/denote/views.py index c00e31c..6cf8df4 100644 --- a/denote/views.py +++ b/denote/views.py @@ -46,7 +46,10 @@ def index(request): else: return user_home(request, request.user) - c = {'login_failed' : login_failed} + c = { + 'login_failed' : login_failed, + 'nb_people_registered' : User.objects.all().count() + } return render(request, 'login.html', c)