diff --git a/warehouse/static/sass/base/_forms.scss b/warehouse/static/sass/base/_forms.scss index ef0d1fb075b1..5a542619f0dc 100644 --- a/warehouse/static/sass/base/_forms.scss +++ b/warehouse/static/sass/base/_forms.scss @@ -48,6 +48,10 @@ } } +select { + height: 40px; +} + input[type="checkbox"] { &:focus, &:hover, diff --git a/warehouse/static/sass/blocks/_button.scss b/warehouse/static/sass/blocks/_button.scss index a0d3859a3784..e8bbbc8d7383 100644 --- a/warehouse/static/sass/blocks/_button.scss +++ b/warehouse/static/sass/blocks/_button.scss @@ -13,6 +13,7 @@ - primary: Makes button bright blue. - danger: Makes button red. - warning: Makes button brown. + - link: styles button like a link (removes all padding, border, etc.) - disabled: Styles for when the button cannot be clicked. - switch-to-desktop: Switch to desktop button found in site footer. - switch-to-mobile: Switch to mobile button found in site header. @@ -126,6 +127,20 @@ } } + &--link { + padding: 0; + background-color: transparent; + border: 0; + color: $text-color; + display: inline-block; + + &:focus, + &:hover, + &:active { + color: $primary-color; + } + } + &[disabled], &--disabled { cursor: not-allowed; diff --git a/warehouse/static/sass/blocks/_filter-wheels.scss b/warehouse/static/sass/blocks/_filter-wheels.scss new file mode 100644 index 000000000000..c5eff61cff01 --- /dev/null +++ b/warehouse/static/sass/blocks/_filter-wheels.scss @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: Apache-2.0 */ + +/* + Search and filter wheels + +
+ +
+ Filters here +
+
+*/ + +.filter-wheels { + display: flex; + gap: $spacing-unit / 2; + justify-content: space-between; + + @media only screen and (max-width: $tablet) { + flex-wrap: wrap; + } + + &__search { + flex-grow: 1; + + .form-group input { + height: 40px; + } + + @media only screen and (max-width: $tablet) { + width: 100%; + } + } + + &__filters { + flex-shrink: 0; + flex: 0 1 auto; + display: flex; + gap: $spacing-unit / 3; + align-items: flex-end; + + div { + flex: 0 1 auto; + } + + @media only screen and (max-width: $tablet) { + width: 100%; + } + + @media only screen and (max-width: $small-tablet) { + display: block; + } + } +} diff --git a/warehouse/static/sass/blocks/_form-group.scss b/warehouse/static/sass/blocks/_form-group.scss index c7334e82ec9f..d3bfbc76dd56 100644 --- a/warehouse/static/sass/blocks/_form-group.scss +++ b/warehouse/static/sass/blocks/_form-group.scss @@ -12,6 +12,10 @@

When a field is not editable, you can use me instead

Some help text here

+ + + Modifiers: + - flex-width: makes fields inside the group flexible width (instead of 350px wide) */ .form-group { @@ -20,7 +24,7 @@ &__label { display: block; - font-weight: bold; + font-weight: 600; } &__label:not(:first-child) { @@ -109,6 +113,38 @@ } } + &--flex-width { + max-width: unset; + :where( + input:not([type]), + select, + textarea, + [type="color"], + [type="date"], + [type="datetime"], + [type="datetime-local"], + [type="email"], + [type="month"], + [type="month"], + [type="number"], + [type="password"], + [type="search"], + [type="tel"], + [type="text"], + [type="time"], + [type="url"], + [type="week"] + ).form-group__field, + select.form-group__field { + width: 100%; + max-width: 100%; + } + + select.form-group__field { + padding-right: $spacing-unit; + } + } + // Specific cases for input validation using `pattern` attribute /* stylelint-disable-next-line selector-id-pattern -- Form sets name */ diff --git a/warehouse/static/sass/blocks/_table.scss b/warehouse/static/sass/blocks/_table.scss index de5e4947ceb7..2143ff269c70 100644 --- a/warehouse/static/sass/blocks/_table.scss +++ b/warehouse/static/sass/blocks/_table.scss @@ -30,8 +30,9 @@ Modifiers: - downloads: specific styles for downloads table on project detail page + - files: specific styles for files table on project detail page - releases: specific styles for releases table on manage project page - - files: specific styles for files table on releases tab + - manage-files: specific styles for files table on the releases tab - history: specific styles for project journals - hashes: specific styles for the hashes table on an individual file - collaborators: specific styles for managing a project's collaborators @@ -58,6 +59,7 @@ tbody tr td:last-child { display: block; width: 100%; + max-width: 100%; text-align: left; border-bottom: 0; padding: 2px 0; @@ -175,6 +177,19 @@ } } + &--files { + margin-bottom: $half-spacing-unit; + + td.file-name { + word-wrap: break-word; + max-width: 250px; + } + + @media only screen and (max-width: $desktop) { + @include mobile-friendly-table; + } + } + &--releases { word-wrap: break-word; margin-bottom: $spacing-unit; @@ -185,7 +200,7 @@ } } - &--files, + &--manage-files, &--history { margin-top: $half-spacing-unit; diff --git a/warehouse/static/sass/warehouse.scss b/warehouse/static/sass/warehouse.scss index 32119d746687..f0d9433f38fc 100644 --- a/warehouse/static/sass/warehouse.scss +++ b/warehouse/static/sass/warehouse.scss @@ -95,6 +95,7 @@ @import "blocks/project-description"; /*rtl:end:ignore*/ @import "blocks/files"; +@import "blocks/filter-wheels"; @import "blocks/radio-toggle-form"; @import "blocks/release"; @import "blocks/release-timeline"; diff --git a/warehouse/templates/manage/project/release.html b/warehouse/templates/manage/project/release.html index 6f3277ed9997..ec37bfbf1c0e 100644 --- a/warehouse/templates/manage/project/release.html +++ b/warehouse/templates/manage/project/release.html @@ -32,7 +32,7 @@

{% if files %} - +
diff --git a/warehouse/templates/packaging/detail.html b/warehouse/templates/packaging/detail.html index b29903e561b7..240cf36a7324 100644 --- a/warehouse/templates/packaging/detail.html +++ b/warehouse/templates/packaging/detail.html @@ -70,28 +70,118 @@

pip install{{ index_url }} {{ release.project.name }}{{ project_version }} {%- endif -%} {%- endmacro -%} -{%- macro file_table(files) -%} + +{%- macro sdists_table(files) -%} +

{% trans version=release.version, project_name=project.name %}Files for release {{ version }} of {{ project_name }}{% endtrans %}
+ + + + + + + + {% for file in files %} -
-
- -
-
+
+ + + + + + + {% endfor %} +
{% trans name=release.project.name, release=release.version %}Source distribution for {{ name }} {{ version }}{% endtrans %}
{% trans %}File{% endtrans %}{% trans %}Uploaded{% endtrans %}{% trans %}Size{% endtrans %}{% trans %}Type{% endtrans %}{% trans %}Details{% endtrans %}
+ {% trans %}File{% endtrans %} +   {{ file.filename }} - ({{ file.size|filesizeformat() if file.size else 0|filesizeformat() }} + + {% trans %}Uploaded{% endtrans %} + {% trans upload_time=humanize(file.upload_time) %}Uploaded {{ upload_time }}{% endtrans %} + + {% trans %}Size{% endtrans %} + {{ file.size|filesizeformat() if file.size else 0|filesizeformat() }} + + {% trans %}Type{% endtrans %} + {% trans %}Source{% endtrans %} + + {% trans %}View details{% endtrans %} {%- trans -%}view details{%- endtrans -%}) -

- Uploaded {{ humanize(file.upload_time) }} - {% for tag in file.pretty_wheel_tags %}{{ tag }}{% endfor %} -

+ data-project-tabs-target="tab" + data-action="project-tabs#onTabClick"> + {% trans %}Details{% endtrans %} + +
+{%- endmacro -%} + +{%- macro bdists_table(files) -%} + + + + + + + + + + {% for file in files %} + + + + + + - + {% endfor %} +
{% trans name=release.project.name, release=release.version %}Table of built distributions (wheels) for {{ name }} {{ release }}{% endtrans %}
{% trans %}File{% endtrans %}{% trans %}Interpreter{% endtrans %}{% trans %}ABI{% endtrans %}{% trans %}Platform{% endtrans %}{% trans %}Details{% endtrans %}
+ {% trans %}File{% endtrans %} +   + {{ file.filename }} +
+ + {{ file.size|filesizeformat() if file.size else 0|filesizeformat() }}.  + {% trans upload_time=humanize(file.upload_time) %}Uploaded {{ upload_time }}{% endtrans %}. + +
+ {% trans %}Interpreter{% endtrans %} + {% for key, value in file.wheel_filters.items() %} + {% if key == 'interpreters' %} + {% for interpreter in value %} + {{ interpreter }}
+ {% endfor %} + {% endif %} + {% endfor %} +
+ {% trans %}ABI{% endtrans %} + {% for key, value in file.wheel_filters.items() %} + {% if key == 'abis' %} + {% for abi in value %} + {{ abi }}
+ {% endfor %} + {% endif %} + {% endfor %} +
+ {% trans %}Platform{% endtrans %} + {% for key, value in file.wheel_filters.items() %} + {% if key == 'platforms' %} + {% for platform in value %} + {{ platform }}
+ {% endfor %} + {% endif %} + {% endfor %} +
+ {% trans %}View details{% endtrans %} + + {% trans %}Details{% endtrans %} + +
{%- endmacro -%} + {% macro filter_select(name, title, selected) %} {% endmacro %} + {% block title %}{{ release.project.name }}{% endblock %} {% block description %}{{ release.summary }}{% endblock %} {% block additional_rss -%} @@ -441,90 +532,91 @@

data-controller="filter-list">

{% trans %}Download files{% endtrans %}

- {% trans href='https://packaging.python.org/tutorials/installing-packages/', title=gettext('External link') %}Download the file for your platform. If you're not sure which to choose, learn more about installing packages.{% endtrans %} + {% trans href='https://packaging.python.org/en/latest/discussions/package-formats/#package-formats', title=gettext('External link') %}For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.{% endtrans %}

{% trans count=sdists|length %} - Source Distribution + Source distribution (sdist) {% pluralize %} - Source Distributions + Source distributions (sdists) {% endtrans %}

{% if sdists %} - {{ file_table(sdists) }} + {{ sdists_table(sdists) }} {% else %} -
-
- -
-
- {% trans %}No source distribution files available for this release.{% endtrans %} - {% trans href='https://packaging.python.org/tutorials/packaging-projects/#generating-distribution-archives', title=gettext('External link') %}See tutorial on generating distribution archives.{% endtrans %} -
+
+   + {% trans %}No source distribution files available for this release.{% endtrans %}  + {% trans href='https://packaging.python.org/tutorials/packaging-projects/#generating-distribution-archives', title=gettext('External link') %}See tutorial on generating distribution archives.{% endtrans %}
{% endif %} + {% if bdists %} + {% set bdist_count = bdists|length %}

- {% trans count=bdists|length %} - Built Distribution + {% trans count=bdist_count %} + Built distribution (wheel) {% pluralize %} - Built Distributions + Built distributions (wheels) {% endtrans %}

- -

- {% trans href='https://packaging.python.org/en/latest/specifications/binary-distribution-format/', title=gettext('External link') %}If you're not sure about the file name format, learn more about wheel file names.{% endtrans %} -

+ {% if bdist_count > 3 %} - + data-clipboard-tooltip-value="{% trans %}Copy link to filters{% endtrans %}"> + + {% trans %}Copy link to filters{% endtrans %} + + + {{ filter_select('interpreters', 'Interpreter', wheel_filters_params) }} +
+
{{ filter_select('abis', 'ABI', wheel_filters_params) }}
+
{{ filter_select('platforms', 'Platform', wheel_filters_params) }}
+ + + {% endif %} + + {{ bdists_table(bdists) }} + + {% if bdist_count > 3 %} -
- -
-
{{ filter_select('interpreters', 'Interpreter', wheel_filters_params) }}
-
{{ filter_select('abis', 'ABI', wheel_filters_params) }}
-
{{ filter_select('platforms', 'Platform', wheel_filters_params) }}
-
-
- {{ file_table(bdists) }} + {% endif %} + {% endif %} {# Tabs: file details #}