UI: Improve multi OS display #205
@ -813,7 +813,7 @@ class Version(CreatedModifiedMixin, TrackChangesMixin, models.Model):
|
||||
'url': self.get_download_url(file),
|
||||
}
|
||||
]
|
||||
platform2file = {}
|
||||
platform_slug2file = {}
|
||||
for file in files:
|
||||
platforms = file.get_platforms()
|
||||
if not platforms:
|
||||
@ -821,16 +821,17 @@ class Version(CreatedModifiedMixin, TrackChangesMixin, models.Model):
|
||||
f'data error: Version pk={self.pk} has multiple files, but File pk={file.pk} '
|
||||
f'is not platform-specific'
|
||||
)
|
||||
for platform in platforms:
|
||||
platform2file[platform] = file
|
||||
for platform_slug in platforms:
|
||||
platform_slug2file[platform_slug] = file
|
||||
all_platforms_by_slug = {p.slug: p for p in Platform.objects.all()}
|
||||
return [
|
||||
{
|
||||
'name': self._get_download_name(file),
|
||||
'platform': p,
|
||||
'platform': all_platforms_by_slug.get(platform_slug),
|
||||
'size': file.size_bytes,
|
||||
'url': self.get_download_url(file),
|
||||
}
|
||||
for p, file in platform2file.items()
|
||||
for platform_slug, file in platform_slug2file.items()
|
||||
]
|
||||
|
||||
def get_build_list(self) -> List[dict]:
|
||||
|
@ -288,15 +288,15 @@
|
||||
<div class="text-center">
|
||||
<strong>
|
||||
{% with platform=download_item.platform %}
|
||||
{% if platform == "linux-x64" %}
|
||||
{% if platform.slug == "linux-x64" %}
|
||||
Linux
|
||||
{% elif platform == "macos-arm64" %}
|
||||
{% elif platform.slug == "macos-arm64" %}
|
||||
macOS <span class="fw-normal"> - Apple Silicon</span>
|
||||
{% elif platform == "macos-x64" %}
|
||||
{% elif platform.slug == "macos-x64" %}
|
||||
macOS <span class="fw-normal"> - Intel</span>
|
||||
{% elif platform == "windows-arm64" %}
|
||||
{% elif platform.slug == "windows-arm64" %}
|
||||
Windows <span class="fw-normal"> - ARM</span>
|
||||
{% elif platform == "windows-x64" %}
|
||||
{% elif platform.slug == "windows-x64" %}
|
||||
Windows
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
@ -321,15 +321,15 @@
|
||||
<a class="d-flex dropdown-item justify-content-between" download="{{ download_item.name }}" href="{{ request.scheme }}://{{ request.get_host }}{{ download_item.url }}">
|
||||
<span>
|
||||
{% with platform=download_item.platform %}
|
||||
{% if platform == "linux-x64" %}
|
||||
{% if platform.slug == "linux-x64" %}
|
||||
<i class="i-linux"></i> Linux
|
||||
{% elif platform == "macos-arm64" %}
|
||||
{% elif platform.slug == "macos-arm64" %}
|
||||
<i class="i-macos"></i> macOS <span class="ms-2 text-muted">Apple Silicon</span>
|
||||
{% elif platform == "macos-x64" %}
|
||||
{% elif platform.slug == "macos-x64" %}
|
||||
<i class="i-macos"></i> macOS <span class="ms-2 text-muted">Intel</span>
|
||||
{% elif platform == "windows-arm64" %}
|
||||
{% elif platform.slug == "windows-arm64" %}
|
||||
<i class="i-windows"></i> Windows <span class="ms-2 text-muted">ARM</span>
|
||||
{% elif platform == "windows-x64" %}
|
||||
{% elif platform.slug == "windows-x64" %}
|
||||
<i class="i-windows"></i> Windows
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
@ -348,7 +348,7 @@
|
||||
<div class="btn-col text-center">
|
||||
{% for download_item in download_list %}
|
||||
<a class="btn btn-flex btn-accent" href="{{ request.scheme }}://{{ request.get_host }}{{ download_item.url }}" download="{{ download_item.name }}">
|
||||
<i class="i-download"></i><span>{% trans 'Download' %} {{ extension.get_type_display }} {{ download_item.platform }}</span>
|
||||
<i class="i-download"></i><span>{% trans 'Download' %} {{ extension.get_type_display }} {{ download_item.platform.slug }}</span>
|
||||
</a>
|
||||
<small class="mt-3">...and <a class="text-underline text-primary text-center" href="https://docs.blender.org/manual/en/dev/editors/preferences/extensions.html#install" target="_blank">Install from Disk</a></small>
|
||||
{% endfor %}
|
||||
|
@ -118,15 +118,15 @@
|
||||
<a href="{{ download_item.url }}" download="{{ download_item.name }}" class="btn btn-primary btn-block text-start">
|
||||
<span>
|
||||
{% with platform=download_item.platform %}
|
||||
{% if platform == "linux-x64" %}
|
||||
{% if platform.slug == "linux-x64" %}
|
||||
<i class="i-linux me-1"></i> Linux
|
||||
{% elif platform == "macos-arm64" %}
|
||||
{% elif platform.slug == "macos-arm64" %}
|
||||
<i class="i-macos me-1"></i> macOS Apple Silicon
|
||||
{% elif platform == "macos-x64" %}
|
||||
{% elif platform.slug == "macos-x64" %}
|
||||
<i class="i-macos me-1"></i> macOS Intel
|
||||
{% elif platform == "windows-arm64" %}
|
||||
{% elif platform.slug == "windows-arm64" %}
|
||||
<i class="i-windows me-1"></i> Windows ARM
|
||||
{% elif platform == "windows-x64" %}
|
||||
{% elif platform.slug == "windows-x64" %}
|
||||
<i class="i-windows me-1"></i> Windows
|
||||
{% endif %}
|
||||
{% endwith %}
|
||||
|
Loading…
Reference in New Issue
Block a user