Dénote

Dénote Commit Details

Date:2016-06-14 11:28:37 (2 years 7 months ago)
Author:Grégory Soutadé
Branch:master
Commit:b4e7d6076046d15e34d90aa181f65d0a72a27599
Parents: 72c3a97ffaa582038c4856291f2c8667f1a6a6bf
Message:Add public notes access

Changes:
Mdenote/templates/base.html (1 diff)
Mdenote/templates/base_user.html (2 diffs)
Mdenote/templates/login.html (1 diff)
Mdenote/urls.py (1 diff)
Mdenote/views.py (1 diff)

File differences

denote/templates/base.html
1313
1414
1515
16
16
1717
1818
1919
2020
2121
22
23
24
2225
2326
2427
</head>
<body onload="startup();">
<!-- Header -->
<div class="settings">{% if authenticated %}<a href="/user/edit">Settings</a> <a href="/disconnect">Disconnect</a><br/>
<div class="settings"><a href="/public_notes">Public notes</a> {% if authenticated %}<a href="/user/edit">Settings</a> <a href="/disconnect">Disconnect</a><br/>
{% endif %}
<form action="/search" method="post">{% csrf_token %}<input name="text"/><input type="submit" value="Search"/></form></div>
<!-- Left panel -->
<div id="left_panel">
<a id="home_icon" href="/" alt="Home"><img src="{{ STATIC_URL }}images/home.png"/></a><br/><br/>
{% if authenticated %}
<a href="/note/add">Add a note</a>
{% endif %}
{% block left %} {% endblock %}
</div>
<div id="main_panel">
denote/templates/base_user.html
66
77
88
9
10
11
129
1310
1411
......
4643
4744
4845
49
50
51
52
5346
5447
5548
</script>
{% endblock %}
{% block left %}
{% if authenticated %}
<a href="/note/add">Add a note</a>
{% endif %}
<div id="categories">
{% for meta_note in notes_by_category %}
<div class="category" category_id="{{ meta_note.category_id }}">
{% endfor %}
</div>
</div>
{% else %}
{% if notes_by_category|length == 0 %}
<b>Any note</b>
{% endif %}
{% endif %}
</div>
{% endblock %}
denote/templates/login.html
2727
2828
2929
30
31
3032
3133
3234
<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><br/>({{ nb_people_registered }} people(s) registered)</td></tr>
<tr><td></td><td></td></tr>
<tr><td></td><td><a href="/public_notes">Public notes</a></td></tr>
</table>
</form>
</div>
denote/urls.py
2929
3030
3131
32
3233
3334
3435
url(r'^note/add$', 'denote.views.add_note', name='add_note'),
url(r'^note/(\d+)$', 'denote.views.note', name='note'),
url(r'^note/(\d+)/(\d+)$', 'denote.views.public_note', name='public_note'),
url(r'^public_notes$', 'denote.views.public_notes', name='public_notes'),
url(r'^category/edit/(\d)$','denote.views.edit_category', name='edit_category'),
url(r'^preferences$', 'denote.views.preferences', name='preferences'),
url(r'^search$', 'denote.views.search', name='search'),
denote/views.py
238238
239239
240240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
241255
242256
243257
return render(request, 'public_note.html', context)
def public_notes(request):
user = request.user
if user.is_authenticated():
public_notes = Note.objects.filter(visibility__gte=Note.REGISTERED).order_by('-modified_date')
else:
public_notes = Note.objects.filter(visibility__gte=Note.PUBLIC).order_by('-modified_date')
context = _prepare_note_context(user)
context['notes'] = public_notes[:50]
context['public_notes'] = public_notes[:50]
return render(request, 'public_notes.html', context)
@login_required
def edit_category(request, category_id):
user = request.user

Archive Download the corresponding diff file

Branches

Tags