UI: Improve multi OS display #205
@ -64,6 +64,18 @@ class Platform(CreatedModifiedMixin, models.Model):
|
|||||||
def get_by_slug(cls, slug: str):
|
def get_by_slug(cls, slug: str):
|
||||||
return cls.objects.filter(slug=slug).first()
|
return cls.objects.filter(slug=slug).first()
|
||||||
|
|
||||||
|
def name_first_word(self):
|
||||||
|
"""Used for presentation in download_list."""
|
||||||
|
return self.name.split(None, 1)[0]
|
||||||
|
|
||||||
|
def name_rest(self):
|
||||||
|
"""Used for presentation in download_list."""
|
||||||
|
parts = self.name.split(None, 1)
|
||||||
|
if len(parts) > 1:
|
||||||
|
return parts[1]
|
||||||
|
else:
|
||||||
|
return ''
|
||||||
|
|
||||||
|
|
||||||
class ExtensionManager(models.Manager):
|
class ExtensionManager(models.Manager):
|
||||||
@property
|
@property
|
||||||
|
@ -7,19 +7,7 @@
|
|||||||
<dd>
|
<dd>
|
||||||
<ul class="list-style-none mb-0 ps-0">
|
<ul class="list-style-none mb-0 ps-0">
|
||||||
{% for p in version.platforms.all|dictsort:"slug" %}
|
{% for p in version.platforms.all|dictsort:"slug" %}
|
||||||
{% with slug=p.slug %}
|
<li><i class="i-{{ p.name_first_word|lower }}"></i> {{p.name_first_word}} <span class="text-muted">{{ p.name_rest }}</span></li>
|
||||||
{% if slug == "linux-x64" %}
|
|
||||||
<li><i class="i-linux"></i> Linux</li>
|
|
||||||
{% elif slug == "macos-arm64" %}
|
|
||||||
<li><i class="i-macos"></i> macOS <span class="text-muted">Apple Silicon</span></li>
|
|
||||||
{% elif slug == "macos-x64" %}
|
|
||||||
<li><i class="i-macos"></i> macOS <span class="text-muted">Intel</span></li>
|
|
||||||
{% elif slug == "windows-arm64" %}
|
|
||||||
<li><i class="i-windows"></i> Windows <span class="text-muted">ARM</span></li>
|
|
||||||
{% elif slug == "windows-x64" %}
|
|
||||||
<li><i class="i-windows"></i> Windows</li>
|
|
||||||
{% endif %}
|
|
||||||
{% endwith %}
|
|
||||||
{% endfor %}
|
{% endfor %}
|
||||||
</ul>
|
</ul>
|
||||||
</dd>
|
</dd>
|
||||||
|
@ -288,17 +288,7 @@
|
|||||||
<div class="text-center">
|
<div class="text-center">
|
||||||
<strong>
|
<strong>
|
||||||
{% with platform=download_item.platform %}
|
{% with platform=download_item.platform %}
|
||||||
{% if platform.slug == "linux-x64" %}
|
{{platform.name_first_word}} <span class="fw-normal"> - {{ platform.name_rest }}</span>
|
||||||
Linux
|
|
||||||
{% elif platform.slug == "macos-arm64" %}
|
|
||||||
macOS <span class="fw-normal"> - Apple Silicon</span>
|
|
||||||
{% elif platform.slug == "macos-x64" %}
|
|
||||||
macOS <span class="fw-normal"> - Intel</span>
|
|
||||||
{% elif platform.slug == "windows-arm64" %}
|
|
||||||
Windows <span class="fw-normal"> - ARM</span>
|
|
||||||
{% elif platform.slug == "windows-x64" %}
|
|
||||||
Windows
|
|
||||||
{% endif %}
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</strong> – {{ download_item.size|filesizeformat }}
|
</strong> – {{ download_item.size|filesizeformat }}
|
||||||
</div>
|
</div>
|
||||||
@ -321,17 +311,7 @@
|
|||||||
<a class="d-flex dropdown-item justify-content-between" download="{{ download_item.name }}" href="{{ request.scheme }}://{{ request.get_host }}{{ download_item.url }}">
|
<a class="d-flex dropdown-item justify-content-between" download="{{ download_item.name }}" href="{{ request.scheme }}://{{ request.get_host }}{{ download_item.url }}">
|
||||||
<span>
|
<span>
|
||||||
{% with platform=download_item.platform %}
|
{% with platform=download_item.platform %}
|
||||||
{% if platform.slug == "linux-x64" %}
|
<i class="i-{{ platform.name_first_word|lower }}"></i> {{ platform.name_first_word|lower }} <span class="ms-2 text-muted">{{ platform.name_rest}}</span>
|
||||||
<i class="i-linux"></i> Linux
|
|
||||||
{% elif platform.slug == "macos-arm64" %}
|
|
||||||
<i class="i-macos"></i> macOS <span class="ms-2 text-muted">Apple Silicon</span>
|
|
||||||
{% elif platform.slug == "macos-x64" %}
|
|
||||||
<i class="i-macos"></i> macOS <span class="ms-2 text-muted">Intel</span>
|
|
||||||
{% elif platform.slug == "windows-arm64" %}
|
|
||||||
<i class="i-windows"></i> Windows <span class="ms-2 text-muted">ARM</span>
|
|
||||||
{% elif platform.slug == "windows-x64" %}
|
|
||||||
<i class="i-windows"></i> Windows
|
|
||||||
{% endif %}
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
</span>
|
</span>
|
||||||
<span class="text-muted">{{ download_item.size|filesizeformat }}</span>
|
<span class="text-muted">{{ download_item.size|filesizeformat }}</span>
|
||||||
|
@ -118,19 +118,8 @@
|
|||||||
<a href="{{ download_item.url }}" download="{{ download_item.name }}" class="btn btn-primary btn-block d-flex justify-content-between text-start">
|
<a href="{{ download_item.url }}" download="{{ download_item.name }}" class="btn btn-primary btn-block d-flex justify-content-between text-start">
|
||||||
<span>
|
<span>
|
||||||
{% with platform=download_item.platform %}
|
{% with platform=download_item.platform %}
|
||||||
{% if platform.slug == "linux-x64" %}
|
<i class="i-{{ platform.name_first_word|lower }} me-1"></i> {{ platform.name }}
|
||||||
<i class="i-linux me-1"></i> Linux
|
|
||||||
{% elif platform.slug == "macos-arm64" %}
|
|
||||||
<i class="i-macos me-1"></i> macOS Apple Silicon
|
|
||||||
{% elif platform.slug == "macos-x64" %}
|
|
||||||
<i class="i-macos me-1"></i> macOS Intel
|
|
||||||
{% elif platform.slug == "windows-arm64" %}
|
|
||||||
<i class="i-windows me-1"></i> Windows ARM
|
|
||||||
{% elif platform.slug == "windows-x64" %}
|
|
||||||
<i class="i-windows me-1"></i> Windows
|
|
||||||
{% endif %}
|
|
||||||
{% endwith %}
|
{% endwith %}
|
||||||
|
|
||||||
v{{ version.version }}
|
v{{ version.version }}
|
||||||
</span>
|
</span>
|
||||||
<span>{{ download_item.size|filesizeformat }}</span>
|
<span>{{ download_item.size|filesizeformat }}</span>
|
||||||
|
Loading…
Reference in New Issue
Block a user