diff options
Diffstat (limited to 'design/templates/notes/notes_detail.html')
-rw-r--r-- | design/templates/notes/notes_detail.html | 76 |
1 files changed, 28 insertions, 48 deletions
diff --git a/design/templates/notes/notes_detail.html b/design/templates/notes/notes_detail.html index 95583bd..b2ddbc3 100644 --- a/design/templates/notes/notes_detail.html +++ b/design/templates/notes/notes_detail.html @@ -2,26 +2,38 @@ {% block extrastyles %} <link rel="stylesheet" href="/media/quill.snow.css" /> {% endblock %} -{% block breadcrumbs %} -<li><a href="{%url 'notes:note-list' user.username %}">Notes</a></li> -{% endblock %} - {% block content %} <main> <article class="note-container"> + <form action="" method="post" id="note-edit-form">{% csrf_token %} <header class="note-header"> <div class="note-header-left"> - <span class="label">tags:</span> - <ul>{% for tag in object.tags.all %} - <li> - <a href="{% url 'notes:note-tag' user.username tag.slug %}">{{tag}}</a> - </li> - {%endfor%}</ul> - <div class="notebook"> - <span class="label">notebook:</span> - <a href="">{{object.notebook.name}}</a> - </div> + + <div class="flex-wrapper"> + <div class="notebook"> + <a id="n-link" href="{% url 'notebooks:detail' object.slug %}"><span id="n-box" class="color-box" style="background-color: {{object.notebook.color_rgb}}"></span><span id="n-name">{{object.notebook}}</span></a> + <div id="notebook-edit" class="hide"> + <span class="error">{{ form.notebook.errors }}</span> + {{form.notebook}} + </div> + </div> + <div class="tags"> + <span class="label">tags:</span> + <div id="t-display" class="">{% for tag in object.tags.all %} + <a class="t-link" href="{% url 'notes:tags' tag.slug %}"> + <span class="tag-wrapper" data-bg-color="#{{tag.color_color_rgb}};" >{{tag}}</span> + </a>{%endfor%} + </div> + <div id="tags-edit" class="hide"> + <span class="error">{{ form.notebook.errors }}</span> + {{form.tags}} + </div> + </div> + </div> + </div> + <div class="hide">{{form.body_text}}</div> + <fieldset class="hide">{{form.title}}</fieldset> <div class="note-header-right"> <h2 class="note-time">{{object.date_created|date:"M d, Y"}}</h2> {% if object.url %}<h3 class="note-url"><a class="btn btn-small btn-subtle" href="{{object.url}}">Source</a><a class="btn btn-small btn-subtle right-padding-0 left-margin-2" href="object.cache">Archive</a></h3>{% endif %} @@ -30,10 +42,6 @@ <div class="edit-btn-wrapper"><button class="hide btn btn-hollow" id="edit-toggle-btn">Edit</button></div> <h1 id="note-title" class="note-title">{{object.title}}</h1> <div id="q-container" class="inactive"><div id="note-body">{% if object.body_html %}{{object.body_html|safe}}{%else%}{{object.body_text}}{%endif%}</div></div> - <form action="" method="post" id="note-edit-form">{% csrf_token %} - {% for field in form %}{% if field.name in "title body_text" %} - <div class="hide">{{field}}</div> - {% endif%}{% endfor %} <input id="btn-js-hide" type="submit" class="btn sm" value="Save" > </form> </article> @@ -44,7 +52,7 @@ <div class=""> <ul class="list-note-preview">{% for obj in notes_list %} <li> - <a href="{% url 'notes:note-detail' user.username obj.slug %}"> + <a href="{% url 'notes:detail' obj.slug obj.pk %}"> <h4>{{obj.title}}</h4> <div class="note-preview">{{obj.body_text|truncatewords:12}}</div> </a> @@ -71,34 +79,6 @@ document.addEventListener('readystatechange', event => { }); </script> {% endblock %} - <script> {% block jsdomready %} - var btn = document.getElementById("edit-toggle-btn"), - qcontainer = document.getElementById('q-container'), - title = document.getElementById('note-title'), - form = document.getElementById('note-edit-form'), - note_html = document.createElement('textarea'), - note_qjson = document.createElement('textarea'); - - window.editing = false; - window.quillchange = false; - - hljs.initHighlightingOnLoad(); - btn.classList.remove('hide'); - note_html.setAttribute('name', 'body_html'); - note_html.setAttribute('class', 'hide'); - note_html.setAttribute('id', 'id_body_html'); - note_qjson.setAttribute('name', 'body_qjson'); - note_qjson.setAttribute('id', 'id_body_qjson'); - note_qjson.setAttribute('class', 'hide'); - form.appendChild(note_html); - form.appendChild(note_qjson); - document.getElementById("btn-js-hide").classList.add("hide"); - btn.addEventListener('click', function(){edit_note(this, title, qcontainer, window.quill, "{% url 'notes-api-detail' object.pk %}" )}, false) +window.url = "{% url 'notes-api-detail' object.pk %}"; {%endblock%} - </script> - -'indent -'align -'direction -'code-block |