From 92b0031ab04e1c182a28c80a9f8f6c37d4304b46 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Tue, 7 Jan 2025 16:49:06 -0500 Subject: [PATCH 1/2] SSH: add reattach key action --- .../projects/partials/edit/keys_list.html | 33 +++++++++---------- 1 file changed, 16 insertions(+), 17 deletions(-) diff --git a/readthedocsext/theme/templates/projects/partials/edit/keys_list.html b/readthedocsext/theme/templates/projects/partials/edit/keys_list.html index 36e8f267..0b05260b 100644 --- a/readthedocsext/theme/templates/projects/partials/edit/keys_list.html +++ b/readthedocsext/theme/templates/projects/partials/edit/keys_list.html @@ -1,28 +1,27 @@ {% extends "includes/crud/table_list.html" %} -{% load i18n %} - -{% load core_tags %} -{% load privacy_tags %} -{% load projects_tags %} +{% load trans blocktrans from i18n %} {% block top_left_menu_items %} {% endblock top_left_menu_items %} -{% comment %} - Do not show an empty menu bar at the top. Once users can add SSH keys, we can - remove this override and enable the ``create_button`` block -{% endcomment %} {% block top_menu %} + {% endblock top_menu %} -{% block create_button %} - {% comment %} - {# TODO this is not supported currently, and is an admin only action #} - {% url "..." project.slug as create_url %} - {% trans "Add SSH key" as create_text %} - {% include "includes/crud/create_button.html" with url=create_url text=create_text %} - {% endcomment %} -{% endblock create_button %} {% block list_placeholder_icon_class %} fa-duotone fa-lock-keyhole From 0114c95d67c30fdf8d8d48aca317e5499acc76e9 Mon Sep 17 00:00:00 2001 From: Santos Gallegos Date: Tue, 14 Jan 2025 13:43:13 -0500 Subject: [PATCH 2/2] Use message --- .../projects/partials/edit/keys_list.html | 32 ++++++++++++++++++- 1 file changed, 31 insertions(+), 1 deletion(-) diff --git a/readthedocsext/theme/templates/projects/partials/edit/keys_list.html b/readthedocsext/theme/templates/projects/partials/edit/keys_list.html index 0b05260b..4bae6492 100644 --- a/readthedocsext/theme/templates/projects/partials/edit/keys_list.html +++ b/readthedocsext/theme/templates/projects/partials/edit/keys_list.html @@ -13,7 +13,8 @@ method="post" action="{% url "projects_keys_reattach" project_slug=project.slug %}"> {% csrf_token %} - @@ -21,6 +22,35 @@ + + {% if not can_reattach_key_automatically %} +
+
+ {% blocktrans trimmed %} + SSH key can't be automatically reattached to Git provider + {% endblocktrans %} +
+

+ {% if not project.remote_repository %} + {% url "projects_edit" project_slug=project.slug as project_edit_url %} + {% blocktrans trimmed with project_edit_url=project_edit_url %} + You need to connect this project to a Git repository first. + {% endblocktrans %} +

+ {% else %} + {% url "socialaccount_connections" as socialaccount_connections_url %} + {% blocktrans trimmed with socialaccount_connections_url=socialaccount_connections_url %} + You need to connect your account to a Git provider associated with this project first. + {% endblocktrans %} +

+ {% endif %} + {% blocktrans trimmed %} + Alternatively, you can + manually add the SSH key to your Git provider. + {% endblocktrans %} +

+
+ {% endif %} {% endblock top_menu %} {% block list_placeholder_icon_class %}