From 55f8688c851d4f5f32a35fd804f31ad2f355be37 Mon Sep 17 00:00:00 2001 From: Wojtek Kosior Date: Wed, 31 Aug 2022 15:55:58 +0200 Subject: [proxy] improve styling of items' "install" and "uninstall" buttons in the web UI --- .../proxy/web_ui/templates/base.html.jinja | 50 ++++++++++++- .../templates/items/item_viewversion.html.jinja | 83 ++++++++++++---------- .../templates/items/library_viewversion.html.jinja | 6 -- .../templates/items/package_viewversion.html.jinja | 6 -- .../web_ui/templates/repos/show_single.html.jinja | 2 +- 5 files changed, 95 insertions(+), 52 deletions(-) (limited to 'src/hydrilla/proxy/web_ui') diff --git a/src/hydrilla/proxy/web_ui/templates/base.html.jinja b/src/hydrilla/proxy/web_ui/templates/base.html.jinja index 31613cd..8b8be4b 100644 --- a/src/hydrilla/proxy/web_ui/templates/base.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/base.html.jinja @@ -45,11 +45,15 @@ in a proprietary work, I am not going to enforce this in court. } .inline-form { - display: inline-block; + display: inline-flex; padding: 0; margin: 0; } + .inline-form > * { + flex: 1 1 0; + } + .small-print { font-size: 80%; color: #555; @@ -61,8 +65,7 @@ in a proprietary work, I am not going to enforce this in court. background-color: #fcc; } - .green-button { - background-color: #4caf50; + .green-button, .red-button, .blue-button { border: none; border-radius: 2px; color: white; @@ -77,6 +80,47 @@ in a proprietary work, I am not going to enforce this in court. margin: 2px; } + .green-button { + background-color: #4caf50; + } + + .red-button { + background-color: #af504c; + } + + .red-button { + background-color: #504caf; + } + + .disabled-button { + background-color: #aaa; + cursor: default; + } + + .button-bordering-right { + margin-right: 0; + border-radius: 2px 0 0 2px; + border-right: 1px solid #65A065; + } + + .button-bordering-left { + margin-left: 0; + border-radius: 0 2px 2px 0; + border-left: 1px solid #65A065; + } + + .button-bordering-left.button-bordering-right { + border-radius: 0; + } + + .button-row { + display: flex; + } + + .button-row > * { + flex: 1 1 0; + } + .hide { display: none !important; } diff --git a/src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja b/src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja index b4d12c2..151a8b3 100644 --- a/src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/items/item_viewversion.html.jinja @@ -41,43 +41,54 @@ in a proprietary work, I am not going to enforce this in court.
{{ display_info.info.versioned_identifier }}
- {% if display_info.installed == InstalledStatus.INSTALLED %} -
{% block item_is_installed_msg %}{% endblock %}
+ + {% block main_info_bulk %} + TODO: add more info... + {% endblock %} + + {% set install_but_classes = ['green-button', 'button-bordering-left'] %} + {% set uninstall_but_classes = ['green-button', 'button-bordering-right'] %} + {% if display_info.installed == InstalledStatus.FAILED_TO_INSTALL %} {% - if uninstall_disallowed is not defined and - display_info.active != ActiveStatus.REQUIRED + set install_text = + _('web_ui.items.single_version.retry_install_button') + %} + {% + set uninstall_text = + _('web_ui.items.single_version.leave_uninstalled_button') %} -
- - -
- {% endif %} - {% elif display_info.installed == InstalledStatus.NOT_INSTALLED %} -
{% block item_is_not_installed_msg %}{% endblock %}
-
- - -
- {% else %}
{% block item_install_failed_msg %}{% endblock %}
-
-
- - -
-
- - -
-
- {% endif %} - TODO: add more info... + {% else %} + {% set install_text = _('web_ui.items.single_version.install_button') %} + {% set uninstall_text = _('web_ui.items.single_version.uninstall_button') %} + {% if display_info.installed == InstalledStatus.INSTALLED %} + {% do install_but_classes.append('disabled-button') %} + {% + if uninstall_disallowed is defined or + display_info.active == ActiveStatus.REQUIRED + %} + {% do uninstall_but_classes.append('disabled-button') %} + {% endif %} + {% else %} + {# display_info.installed == InstalledStatus.NOT_INSTALLED #} + {% do uninstall_but_classes.append('disabled-button') %} + {% endif %} + {% endif %}{# else/ display_info.installed == InstalledStatus.FAILED_TO_I...#} +
+ {% + for classes, text, action in [ + (uninstall_but_classes, uninstall_text, 'uninstall_item_version'), + (install_but_classes, install_text, 'install_item_version') + ] + %} + {% if 'disabled-button' in classes %} + + {% else %} +
+ + +
+ {% endif %} + {% endfor %} +
{% endblock main_info %} diff --git a/src/hydrilla/proxy/web_ui/templates/items/library_viewversion.html.jinja b/src/hydrilla/proxy/web_ui/templates/items/library_viewversion.html.jinja index a087a95..2176646 100644 --- a/src/hydrilla/proxy/web_ui/templates/items/library_viewversion.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/items/library_viewversion.html.jinja @@ -28,12 +28,6 @@ in a proprietary work, I am not going to enforce this in court. .format(display_info.info.long_name) }} {% endblock %} -{% block item_is_installed_msg %} -{{ _('web_ui.items.single_version.library.is_installed') }} -{% endblock %} -{% block item_is_not_nstalled_msg %} - {{ _('web_ui.items.single_version.library.is_not_installed') }} -{% endblock %} {% block item_install_failed_msg %} {{ _('web_ui.items.single_version.library.install_failed') }} {% endblock %} diff --git a/src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja b/src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja index 4224d4b..6671747 100644 --- a/src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/items/package_viewversion.html.jinja @@ -28,12 +28,6 @@ in a proprietary work, I am not going to enforce this in court. .format(display_info.info.long_name) }} {% endblock %} -{% block item_is_installed_msg %} -{{ _('web_ui.items.single_version.package.is_installed') }} -{% endblock %} -{% block item_is_not_nstalled_msg %} - {{ _('web_ui.items.single_version.package.is_not_installed') }} -{% endblock %} {% block item_install_failed_msg %} {{ _('web_ui.items.single_version.package.install_failed') }} {% endblock %} diff --git a/src/hydrilla/proxy/web_ui/templates/repos/show_single.html.jinja b/src/hydrilla/proxy/web_ui/templates/repos/show_single.html.jinja index 20d6964..ce1cef2 100644 --- a/src/hydrilla/proxy/web_ui/templates/repos/show_single.html.jinja +++ b/src/hydrilla/proxy/web_ui/templates/repos/show_single.html.jinja @@ -86,7 +86,7 @@ in a proprietary work, I am not going to enforce this in court. {% endif %}{# not display_info.deleted #} - {% endif %}{# display_info.is_local_semirepo (else) #} + {% endif %}{# else/ display_info.is_local_semirepo #} {% if display_info.deleted and not display_info.is_local_semirepo %}
{{ _('web_ui.repos.single.repo_is_deleted') }} -- cgit v1.2.3