Add visibility management

This commit is contained in:
Gregory Soutade
2016-06-14 11:09:11 +02:00
parent 38be8017a0
commit 72c3a97ffa
12 changed files with 140 additions and 68 deletions

View File

@@ -2,6 +2,10 @@
<head>
<title>Dénote{% if user.get_full_name|length != 0 %} - {{ user.get_full_name }}{% endif %}</title>
<link rel="icon" type="image/png" href="{{ STATIC_URL }}images/favicon.png" />
<script type="text/javascript">
var hidden_categories = null;
function get_csrf_token() { return '{{ csrf_token }}';}
</script>
{% block head %} {% endblock %}
<link href="{{ STATIC_URL }}css/denote.css" rel="stylesheet" type="text/css"/>
<link href="{{ STATIC_URL }}css/pygments.css" rel="stylesheet" type="text/css"/>
@@ -9,8 +13,9 @@
</head>
<body onload="startup();">
<!-- Header -->
<div class="settings"><a href="/user/edit">Settings</a> <a href="/disconnect">Disconnect</a><br/>
<form action="/search">{% csrf_token %}<input name="text"/><input type="button" value="Search"/></form></div>
<div class="settings">{% 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/>

View File

@@ -1,9 +1,8 @@
{% extends "base.html" %}
{% block head %}
<script type="text/javascript">
var hidden_categories = "{{ user.hidden_categories }}";
hidden_categories = "{{ user.hidden_categories }}";
hidden_categories = hidden_categories.split(",");
function get_csrf_token() { return '{{ csrf_token }}';}
</script>
{% endblock %}
{% block left %}

View File

@@ -0,0 +1,20 @@
{% extends "base.html" %}
{% block left %}
{% for note in public_notes %}
<div id="categories">
<div class="note">
<a href="/note/{{ note.author.id}}/{{ note.id }}"><div class="title">{{ note.title }}</div></a>
<div class="date">{{ note.created_date }}</div>
<div class="summary">{{ note.short_summary }}</div>
</div>
</div>
{% endfor %}
{% endblock %}
{% block content %}
<div class="note">
<div id="title" class="title">{{ note.title }}</div>
<div id="transformed_content">{{ note.transformed_text|safe }}</div>
</div>
{% endblock %}

View File

@@ -0,0 +1,26 @@
{% extends "base.html" %}
{% block left %}
{% for note in public_notes %}
<div id="categories">
<div class="note">
<a href="/note/{{ note.author.id}}/{{ note.id }}"><div class="title">{{ note.title }}</div></a>
<div class="date">{{ note.created_date }}</div>
<div class="summary">{{ note.short_summary }}</div>
</div>
</div>
{% endfor %}
{% endblock %}
{% block content %}
{% for note in notes %}
<div class="note">
<div class="title"><a href="/note/{{ note.author.id }}/{{ note.id }}">{{ note.title }}</a></div>
<div class="date">{{ note.modified_date }}</div>
<div class="summary">{{ note.long_summary }}</div>
</div>
{% endfor %}
{% if notes|length == 0 %}
<b>Any note</b>
{% endif %}
{% endblock %}

View File

@@ -12,4 +12,7 @@
<div class="summary">{{ note.long_summary }}</div>
</div>
{% endfor %}
{% if notes|length == 0 %}
<b>Any note</b>
{% endif %}
{% endblock %}

View File

@@ -2,12 +2,16 @@
{% block content %}
<div class="note">
{% if note != None %}
{% if note and note_form != None %}
<div id="title" class="title" ondblclick="edit_note();">{{ note.title }}</div>
{% if note.category != None %}
{% else %}
<div id="title" class="title">{{ note.title }}</div>
{% endif %}
{% if note and note.category != None %}
<div class="category">{{ note.category.name }}</div>
{% endif %}
<div id="transformed_content">{{ note.transformed_text|safe }}</div>
{% if note and note_form != None %}
<div class="edit_button"><input id="edit_button" type="button" value="Edit" onclick="edit_note();"/> <form id="form_delete" action="/note/{{ note.id }}" method="post">{% csrf_token %}<input type="submit" name="delete" value="Delete" onclick="return confirm('Do you really want to delete this note ?')"/></form></div>
<div id="div_edit">
<form id="form_edit" action="/note/{{ note.id }}" method="post">{% csrf_token %}
@@ -21,54 +25,7 @@
<input type="submit" name="edit" value="Edit" />
<input type="button" value="Cancel" onclick="cancel_edit_note();"/>
</form>
<b>Markdown syntax</b><br /><br />
<table>
<tr>
<td class="markdown_help">
<pre style="display:inline">_italic_</pre> <span style="font-style:italic">italic</span><br/>
<pre style="display:inline">**bold**</pre> <span style="font-weight:bold">bold</span><br/>
<pre style="display:inline">~~line through~~</pre> <span style="text-decoration:line-through">line through</span><br/>
<pre style="display:inline">~underline~</pre> <span style="text-decoration:underline">underline</span><br/>
<pre style="display:inline">>Citation</pre><br/>
<pre>
* Unordered list
* Second element
</pre>
<ul>
<li>Unordered list
<li>Second element
</ul>
<pre>
1. Ordered list
1. Second element
</pre>
<ol>
<li>Ordered list
<li>Second element
</ol>
<pre style="display:inline">![Picture](https://bits.wikimedia.org/images/wikimedia-button.png)</pre><img src="https://bits.wikimedia.org/images/wikimedia-button.png" alt="Picture"/><br/>
<pre style="display:inline">#[Inline Picture](https://bits.wikimedia.org/images/wikimedia-button.png)</pre><img src="https://bits.wikimedia.org/images/wikimedia-button.png" alt="Picture"/><br/>
<pre style="display:inline">[Link](http://www.wikipedia.org)</pre> <a href="http://www.wikipedia.org">Link</a><br/><br/>
<pre>
Code : 4 whitespaces ahead
</pre>
</td>
<td>
<pre># Title # or
Title
=====</pre>
<h1>Title</h1>
<pre>## Sub title ## or
Sub title
---------</pre>
<h2>Sub title</h2>
<pre>### Sub sub title ###</pre>
<h3>Sub sub title</h3>
</td>
</tr>
</table>
</div>
{% else %}
{% else %}
<div class="form_add">
<form action="/note/add" method="post">{% csrf_token %}
{{ note_form.as_p }}
@@ -81,7 +38,7 @@
<input type="submit" name="add" value="Add" />
<input type="submit" name="cancel" value="Cancel" />
</form>
</div>
{% endif %}
<b>Markdown syntax</b><br /><br />
<table>
<tr>
@@ -131,6 +88,6 @@
</td>
</tr>
</table>
{% endif %}
</div>
</div>
{% endblock %}