Edit note with right click
Remove default parameters (thanks Chrome...) Add number of registered people
This commit is contained in:
parent
46082b8dcb
commit
f48b0516df
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
{% for meta_note in notes_by_category %}
|
||||
<div class="category" category_id="{{ meta_note.category_id }}">
|
||||
<div id="category_{{ meta_note.category_id }}" class="name" ondblclick="edit_category({{ meta_note.category_id }}, '{{ meta_note.category }}')">
|
||||
<img id="minus_{{ meta_note.category_id }}" src="{{ STATIC_URL }}images/denote_minus.png" onclick="hide_category({{ meta_note.category_id }});"/><img id="plus_{{ meta_note.category_id }}" src="{{ STATIC_URL }}images/denote_plus.png" onclick="show_category({{ meta_note.category_id }});"/>{{ meta_note.category }} ({{ meta_note.notes|length }})
|
||||
<img id="minus_{{ meta_note.category_id }}" src="{{ STATIC_URL }}images/denote_minus.png" onclick="hide_category({{ meta_note.category_id }},true);"/><img id="plus_{{ meta_note.category_id }}" src="{{ STATIC_URL }}images/denote_plus.png" onclick="show_category({{ meta_note.category_id }},true);"/>{{ meta_note.category }} ({{ meta_note.notes|length }})
|
||||
</div>
|
||||
<div class="edit_category" id="edit_category_{{ meta_note.category_id }}">
|
||||
<form id="form_edit_category_{{ meta_note.category_id }}" action="/category/edit/{{ meta_note.category_id }}" method="post" onsubmit="return submit_category_name({{ meta_note.category_id }}, '{{ meta_note.category }}');">
|
||||
|
@ -34,7 +34,7 @@
|
|||
<div id="content_{{ meta_note.category_id }}" class="content" >
|
||||
{% for note in meta_note.notes %}
|
||||
<div class="note">
|
||||
<a href="/note/{{ note.id}}"><div class="title">{{ note.title }}</div></a>
|
||||
<a href="/note/{{ note.id}}" oncontextmenu="return DoEdit('{{ note.id}}');"><div class="title">{{ note.title }}</div></a>
|
||||
<div class="date">{{ note.created_date }}</div>
|
||||
<div class="summary">{{ note.short_summary }}</div>
|
||||
</div>
|
||||
|
@ -45,11 +45,11 @@
|
|||
{% if notes_without_category|length != 0 %}
|
||||
<div class="category" category_id="-1">
|
||||
<div id="category_-1" class="name">
|
||||
<img id="minus_-1" src="{{ STATIC_URL }}images/denote_minus.png" onclick="hide_category(-1);"/><img id="plus_-1" src="{{ STATIC_URL }}images/denote_plus.png" onclick="show_category(-1);"/>Other ({{ notes_without_category|length }})</div>
|
||||
<img id="minus_-1" src="{{ STATIC_URL }}images/denote_minus.png" onclick="hide_category(-1,true);"/><img id="plus_-1" src="{{ STATIC_URL }}images/denote_plus.png" onclick="show_category(-1,true);"/>Other ({{ notes_without_category|length }})</div>
|
||||
<div id="content_-1" class="content">
|
||||
{% for note in notes_without_category %}
|
||||
<div class="note">
|
||||
<a href="/note/{{ note.id}}"><div class="title">{{ note.title }}</div></a>
|
||||
<a href="/note/{{ note.id}}" oncontextmenu="return DoEdit('{{ note.id}}');"><div class="title">{{ note.title }}</div></a>
|
||||
<div class="date">{{ note.created_date }}</div>
|
||||
<div class="summary">{{ note.short_summary }}</div>
|
||||
</div>
|
||||
|
|
|
@ -26,7 +26,7 @@
|
|||
<tr><td>Login</td><td><input type="text" name="login"/></td></tr>
|
||||
<tr><td>Password</td><td><input id="password" type="password" name="password"/></td></tr>
|
||||
<tr><td/><td><input type="submit" value="Connect"/></td></tr>
|
||||
<tr><td/><td><a href="/user/add">Create an account</a></td></tr>
|
||||
<tr><td/><td><a href="/user/add">Create an account</a><br/>(already {{ nb_people_registered }} people(s) registered)</td></tr>
|
||||
</table>
|
||||
</form>
|
||||
</div>
|
||||
|
|
|
@ -4,9 +4,9 @@
|
|||
{% for note in notes %}
|
||||
<div class="note">
|
||||
{% if note.category != None %}
|
||||
<div class="title"><a href="/note/{{ note.id }}">{{ note.title }} [{{ note.category.name }}]</a></div>
|
||||
<div class="title"><a href="/note/{{ note.id}}" oncontextmenu="return DoEdit('{{ note.id}}');">{{ note.title }} [{{ note.category.name }}]</a></div>
|
||||
{% else %}
|
||||
<div class="title"><a href="/note/{{ note.id }}">{{ note.title }}</a></div>
|
||||
<div class="title"><a href="/note/{{ note.id}}" oncontextmenu="return DoEdit('{{ note.id}}');">{{ note.title }}</a></div>
|
||||
{% endif %}
|
||||
<div class="date">{{ note.modified_date }}</div>
|
||||
<div class="summary">{{ note.long_summary }}</div>
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue
Block a user