Browse Source

style: Improve look of tags in admin list

Cristian 5 years ago
parent
commit
10384a8a6f
2 changed files with 10 additions and 2 deletions
  1. 2 2
      archivebox/core/admin.py
  2. 8 0
      archivebox/themes/default/static/admin.css

+ 2 - 2
archivebox/core/admin.py

@@ -81,9 +81,9 @@ class SnapshotAdmin(admin.ModelAdmin):
     def title_str(self, obj):
         canon = obj.as_link().canonical_outputs()
         tags = ''.join(
-            format_html(' <span>{}</span> ', tag)
+            format_html(' <a href="/admin/core/snapshot/?tags__id__exact={}"><span class="tag">{}</span></a> ', tag.id, tag)
             for tag in obj.tags.all()
-        ) if obj.tags.all() else ''
+        )
         return format_html(
             '<a href="/{}">'
                 '<img src="/{}/{}" class="favicon" onerror="this.remove()">'

+ 8 - 0
archivebox/themes/default/static/admin.css

@@ -222,3 +222,11 @@ body.model-snapshot.change-list #content .object-tools {
   0% { transform: rotate(0deg); }
   100% { transform: rotate(360deg); }
 }
+
+.tags > a > .tag {
+  border: 1px solid;
+  border-radius: 10px;
+  background-color: #f3f3f3;
+  padding: 3px;
+}
+