Add templates management
This commit is contained in:
@@ -13,14 +13,33 @@
|
||||
</head>
|
||||
<body onload="startup();">
|
||||
<!-- Header -->
|
||||
<div class="settings"><a href="/public_notes">Public notes</a> {% 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="/templates">Templates</a> <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>
|
||||
<form id="form_note_add" action="/note/add" method="POST">
|
||||
{% csrf_token %}
|
||||
<a href="#" onclick="document.getElementById('form_note_add').submit();">Add a note</a>
|
||||
{% if templates_by_name|length != 0 %}
|
||||
<br/>
|
||||
<select name="template">
|
||||
<option value="-1">None</option>
|
||||
{% for template in templates_by_name %}
|
||||
{% if template.id == user.default_template.id %}
|
||||
<option value="{{ template.id }}" selected="1">{{ template.name }}</option>
|
||||
{% else %}
|
||||
<option value="{{ template.id }}">{{ template.name }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
<br/>
|
||||
{% else %}
|
||||
<input type="hidden" name="template" value="-1"/>
|
||||
{% endif %}
|
||||
</form>
|
||||
{% endif %}
|
||||
{% block left %} {% endblock %}
|
||||
</div>
|
||||
|
@@ -8,6 +8,20 @@
|
||||
<form action="/user/edit" method="post">
|
||||
{% csrf_token %}
|
||||
{{ form.as_p }}
|
||||
<p>
|
||||
<label for="id_default_template">Default template:</label>
|
||||
<select id="id_default_template" name="default_template">
|
||||
<option value="-1">None</option>
|
||||
{% for template in templates_by_name %}
|
||||
{% if template.id == user.default_template.id %}
|
||||
<option value="{{ template.id }}" selected="1">{{ template.name }}</option>
|
||||
{% else %}
|
||||
<option value="{{ template.id }}">{{ template.name }}</option>
|
||||
{% endif %}
|
||||
{% endfor %}
|
||||
</select>
|
||||
</p>
|
||||
|
||||
<input type="submit" name="edit" value="Edit" /><input type="submit" name="cancel" value="Cancel" /><input type="submit" name="delete" value="Delete" onclick="return confirm('Do you really want to delete your account ?')"/>
|
||||
</form>
|
||||
{% endblock %}
|
||||
|
@@ -29,7 +29,7 @@
|
||||
<div class="form_add">
|
||||
<form action="/note/add" method="post">{% csrf_token %}
|
||||
{{ note_form.as_p }}
|
||||
Category <input name="category" list=all_categories>
|
||||
Category <input name="category" list=all_categories {% if category != None %} value="{{ category }}" {% endif %}>
|
||||
<datalist id="all_categories">
|
||||
{% for category in categories %}
|
||||
<option value="{{ category.name }}"></option>
|
||||
|
77
denote/templates/user_template.html
Normal file
77
denote/templates/user_template.html
Normal file
@@ -0,0 +1,77 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
<div class="template">
|
||||
{% if template != None %}
|
||||
<form action="/template/{{ template.id }}" method="post">{% csrf_token %}
|
||||
{% else %}
|
||||
<form action="/template/add" method="post">{% csrf_token %}
|
||||
{% endif %}
|
||||
{{ template_form.as_p }}
|
||||
Category <input name="category" list="all_categories" {% if template.category != None %} value="{{ template.category.name }}" {% endif %}>
|
||||
<datalist id="all_categories">
|
||||
{% for category in categories %}
|
||||
<option value="{{ category.name }}"></option>
|
||||
{% endfor %}
|
||||
</datalist><br/>
|
||||
{% if template != None %}
|
||||
<input type="submit" name="edit" value="Edit" />
|
||||
<input type="submit" name="delete" value="Delete" onclick="return confirm('Do you really want to delete this template ?')"/>
|
||||
{% else %}
|
||||
<input type="submit" name="add" value="Add"/>
|
||||
{% endif %}
|
||||
<input type="submit" name="cancel" value="Cancel"/>
|
||||
</form>
|
||||
<br/>
|
||||
<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"></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 OR
|
||||
```language
|
||||
Code
|
||||
```
|
||||
</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>
|
||||
</div>
|
||||
{% endblock %}
|
14
denote/templates/user_template_index.html
Normal file
14
denote/templates/user_template_index.html
Normal file
@@ -0,0 +1,14 @@
|
||||
{% extends "base.html" %}
|
||||
|
||||
{% block content %}
|
||||
{% for template in templates %}
|
||||
<div class="template">
|
||||
<div class="title"><a href="/template/{{ template.id}}" oncontextmenu="return DoEdit('{{ template.id }}');">{{ template.name }}</a></div>
|
||||
</div>
|
||||
{% endfor %}
|
||||
{% if templates|length == 0 %}
|
||||
<b>Any template</b>
|
||||
{% endif %}
|
||||
<div class="settings"><a href="/template/add">Add a Template</a><br/></div>
|
||||
|
||||
{% endblock %}
|
Reference in New Issue
Block a user