Use flag icons instead of emoji's
This commit is contained in:
committed by
R. Miles McCain
parent
737eeb5df4
commit
fdf2ab719b
@@ -13,6 +13,7 @@
|
||||
<script src="{% static 'litepicker/dist/js/main.js' %}"></script>
|
||||
<script src="{% static 'dashboard/js/base.js' %}"></script>
|
||||
<link rel="stylesheet" href="{% static 'dashboard/css/global.css' %}">
|
||||
<link rel="stylesheet" href="{% static 'flag-icon-css/css/flag-icon.min.css' %}">
|
||||
{% block extra_head %}
|
||||
{% endblock %}
|
||||
</head>
|
||||
|
||||
@@ -27,7 +27,7 @@
|
||||
<span class="text-gray-600">—</span>
|
||||
{% endif %}
|
||||
</td>
|
||||
<td>{{session.country|flag_emoji}} {{session.asn|default:"Unknown"}}</td>
|
||||
<td><span class="{{session.country|flag_class}}"></span>{{session.asn|default:"Unknown"}}</td>
|
||||
<td class="rf">{{session.duration|naturaldelta}}</td>
|
||||
<td class="rf">{{session.hit_set.count|intcomma}}</td>
|
||||
</tr>
|
||||
|
||||
@@ -153,7 +153,7 @@
|
||||
<tbody>
|
||||
{% for country in stats.countries %}
|
||||
<tr>
|
||||
<td>{{country.country|flag_emoji}} {{country.country|country_name}}</td>
|
||||
<td><span class="{{country.country|flag_class}}"></span></span>{{country.country|country_name}}</td>
|
||||
<td class="rf">{{country.count|intcomma}}</td>
|
||||
</tr>
|
||||
{% empty %}
|
||||
|
||||
@@ -45,7 +45,7 @@
|
||||
</div>
|
||||
<div>
|
||||
<p>Country</p>
|
||||
<p class="label">{{session.country|flag_emoji}} {{session.country|country_name}}</p>
|
||||
<p class="label"><span class="{{session.country|flag_class}}"></span>{{session.country|country_name}}</p>
|
||||
</div>
|
||||
<div>
|
||||
<p>Location</p>
|
||||
|
||||
@@ -2,7 +2,6 @@ from datetime import timedelta
|
||||
from urllib.parse import urlparse
|
||||
import urllib
|
||||
|
||||
import flag
|
||||
import pycountry
|
||||
from django import template
|
||||
from django.conf import settings
|
||||
@@ -29,11 +28,11 @@ def naturaldelta(timedelta):
|
||||
|
||||
|
||||
@register.filter
|
||||
def flag_emoji(isocode):
|
||||
try:
|
||||
return flag.flag(isocode)
|
||||
except:
|
||||
return ""
|
||||
def flag_class(isocode):
|
||||
if isocode:
|
||||
return "mr-1 flag-icon flag-icon-" + isocode.lower()
|
||||
else:
|
||||
return "hidden"
|
||||
|
||||
|
||||
@register.filter
|
||||
|
||||
@@ -306,6 +306,7 @@ NPM_FILE_PATTERNS = {
|
||||
"stimulus": [os.path.join("dist", "stimulus.umd.js")],
|
||||
"inter-ui": [os.path.join("Inter (web)", "*")],
|
||||
"@fortawesome": [os.path.join("fontawesome-free", "js", "all.min.js")],
|
||||
"flag-icon-css": [os.path.join("css", "flag-icon.min.css"), os.path.join("flags", "*")],
|
||||
}
|
||||
|
||||
# Shynet
|
||||
|
||||
Reference in New Issue
Block a user