Browse Source

Slight progress

main
Artemis 2 weeks ago
parent
commit
a9abacaaaa
  1. 94
      bookmarks/templates/index.html
  2. 1
      linkstream/settings.example.py
  3. 0
      shared/__init__.py
  4. 5
      shared/apps.py
  5. 0
      shared/templatetags/__init__.py
  6. 18
      shared/templatetags/icons.py

94
bookmarks/templates/index.html

@ -1,4 +1,5 @@
{% load static %}
{% load icons %}
<!DOCTYPE html>
<html lang="en">
<head>
@ -8,63 +9,78 @@
<link rel="stylesheet" href="{% static 'linkstream.css' %}">
</head>
<body>
<main>
<section>
<h2>Search</h2>
<header>
<h1 aria-label="Link stream">Link&raquo;stream</h1>
<form action="{% url 'search' %}">
<input name="query" placeholder="This random link #queer" required>
<input type="submit" value="Search">
</form>
</section>
<nav>
<form>
<input name="q" placeholder="Latest news #lgbt">
<button type="submit">{{ 'search'|icon }}</button>
</form>
</nav>
<section>
<h2>Bookmarks</h2>
<nav>
<p>Login</p>
</nav>
</header>
<main>
<section>
<h2>Search</h2>
<form action="{% url 'search' %}">
<input name="query" placeholder="This random link #queer" required>
<input type="submit" value="Search">
</form>
</section>
<details>
<summary>Add a bookmark</summary>
<section>
<h2>Bookmarks</h2>
<form action="{% url 'create_bookmark' %}" method="post">
{% csrf_token %}
{{ bookmark_form }}
<details>
<summary>Add a bookmark</summary>
<input type="submit" value="Create">
</form>
</details>
<form action="{% url 'create_bookmark' %}" method="post">
{% csrf_token %}
{{ bookmark_form }}
<section>
{% for bm in bookmarks %}
<input type="submit" value="Create">
</form>
</details>
<section>
{% for bm in bookmarks %}
<article>
<h3>{{ bm.title }}</h3>
<p>
{% for tag in bm.tags.all %}
<span>#{{ tag.slug }}</span>
<span>#{{ tag.slug }}</span>
{% endfor %}
</p>
</article>
{% endfor %}
</section>
{% endfor %}
</section>
<section>
<h2>Tags</h2>
</section>
<section>
<h2>Tags</h2>
<details>
<summary>Add a tag</summary>
<details>
<summary>Add a tag</summary>
<form action="{% url 'create_tag' %}" method="post">
{% csrf_token %}
{{ tag_form }}
<form action="{% url 'create_tag' %}" method="post">
{% csrf_token %}
{{ tag_form }}
<input type="submit" value="Create">
</form>
</details>
<input type="submit" value="Create">
</form>
</details>
<ul>
{% for tag in tags %}
<ul>
{% for tag in tags %}
<li>{{ tag.slug }}</li>
{% endfor %}
</ul>
</section>
</main>
{% endfor %}
</ul>
</section>
</main>
</body>
</html>

1
linkstream/settings.example.py

@ -29,6 +29,7 @@ ALLOWED_HOSTS = []
# Application definition
INSTALLED_APPS = [
'shared.apps.SharedConfig',
'bookmarks.apps.BookmarksConfig',
'django.contrib.admin',
'django.contrib.auth',

0
shared/__init__.py

5
shared/apps.py

@ -0,0 +1,5 @@
from django.apps import AppConfig
class SharedConfig(AppConfig):
name = 'shared'

0
shared/templatetags/__init__.py

18
shared/templatetags/icons.py

@ -0,0 +1,18 @@
from django import template
from django.template.defaultfilters import stringfilter
register = template.Library()
@register.filter(name='icon', is_safe=True)
@stringfilter
def icon(name):
"""
Inserts an icon for the given name
"""
icons = {
'search': '<svg class="w-6 h-6" fill="none" stroke="currentColor" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M8 16l2.879-2.879m0 0a3 3 0 104.243-4.242 3 3 0 00-4.243 4.242zM21 12a9 9 0 11-18 0 9 9 0 0118 0z"></path></svg>',
}
if name in icons:
return icons[name]
return f'<span class="icon-not-found">{name}</span>'
Loading…
Cancel
Save