Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 10 additions & 11 deletions catalog/templates/catalog/course.html
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ <h1 class="d-flex align-items-center gap-2">
data-action="change->course-filter#filter"
data-course-filter-target="tag"
/>
<label for="tag-{{ tag.name }}">{{ tag.name }}</label>
<label for="tag-{{ tag.name }}">{{ tag.name }} {{ tag.icon|safe }}</label>
</li>
{% endfor %}
</ul>
Expand Down Expand Up @@ -134,16 +134,15 @@ <h1 class="d-flex align-items-center gap-2">
{{ document.user.name }} |
{{ document.pages }} page{{ document.pages|pluralize }} |
{{ document.date|date:"F Y"|capfirst }}
<div class="tags d-none">
{% for kw in document.tags.all %}
<span
data-id="{{ kw.id }}"
style="background-color: {{ kw.color }}; color:white;"
>
{{ kw }}
</span>
{% endfor %}
</div>
{% for kw in document.tags.all %}
<span
data-id="{{ kw.id }}"
class="badge"
style="background-color: {{ kw.color }}; color:white;font-size:0.8em"
>
{{kw.icon|safe}}
</span>
{% endfor %}
</div>
</div>
</a>
Expand Down
17 changes: 17 additions & 0 deletions tags/migrations/0002_tag_icon.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# Generated by Django 4.2.1 on 2023-05-31 15:07

from django.db import migrations, models


class Migration(migrations.Migration):
dependencies = [
("tags", "0001_initial"),
]

operations = [
migrations.AddField(
model_name="tag",
name="icon",
field=models.CharField(blank=True, max_length=1000),
),
]
1 change: 1 addition & 0 deletions tags/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@

class Tag(models.Model):
name = models.CharField(max_length=50, unique=True)
icon = models.CharField(max_length=1000, blank=True)

@property
def color(self):
Expand Down