|
1 |
| -{% load get_providers provider_login_url from socialaccount %} |
2 | 1 | {% load trans blocktrans from i18n %}
|
| 2 | +{% load get_github_providers get_providers from ext_theme_tags %} |
3 | 3 |
|
4 |
| -{% get_providers as socialaccount_providers %} |
| 4 | +{% comment %} |
| 5 | + ``get_providers`` filters out providers marked as hidden in our settings file. |
| 6 | + ``get_github_providers`` is just used for the modal and can be removed eventually. |
| 7 | +{% endcomment %} |
| 8 | +{% get_providers process=process as providers %} |
| 9 | +{% get_github_providers process=process as providers_github %} |
5 | 10 |
|
6 |
| -{% for provider in socialaccount_providers %} |
7 |
| - {% comment %} |
8 |
| - - OpenID is not implemented. |
9 |
| - - SAML is handled in another view, we don't want to list all SAML integrations here. |
10 |
| - - GitHub App is not exposed to users yet. |
11 |
| - {% endcomment %} |
12 |
| - {% if provider.id != 'saml' and provider.id != 'githubapp' %} |
13 |
| - {% if allowed_providers and provider.id in allowed_providers or not allowed_providers %} |
14 |
| - <li class="item"> |
15 |
| - <form class="ui form" |
16 |
| - method="post" |
17 |
| - action="{% provider_login_url provider.id process=process scope=scope auth_params=auth_params %}"> |
18 |
| - {% csrf_token %} |
19 |
| - <button class="ui button" type="submit" title="{{ provider.name }}"> |
20 |
| - <i class="fa-brands fa-{{ provider.name|lower }} icon"></i> |
21 |
| - {% blocktrans trimmed with provider_name=provider.name verbiage=verbiage|default:'Connect to' %} |
22 |
| - {{ verbiage }} {{ provider_name }} |
23 |
| - {% endblocktrans %} |
24 |
| - </button> |
25 |
| - </form> |
26 |
| - </li> |
27 |
| - {% endif %} |
| 11 | +{% comment %} |
| 12 | + If both GitHub providers are configured, and they are not ``hidden=True`` or |
| 13 | + ``hidden_on_{process}=True`` in settings, we'll show these providers in a modal. |
| 14 | +{% endcomment %} |
| 15 | +{% get_providers process=process as providers %} |
| 16 | +{% if providers_github|length == 2 %} |
| 17 | + {% trans "GitHub" as provider_name %} |
| 18 | + <li class="item"> |
| 19 | + <a class="ui button" |
| 20 | + data-bind="click: $root.show_modal('github-select')" |
| 21 | + title="{{ provider_name }}"> |
| 22 | + <i class="fa-brands fa-github icon"></i> |
| 23 | + {% blocktrans trimmed with provider_name=provider_name verbiage=verbiage|default:'Connect to' %} |
| 24 | + {{ verbiage }} {{ provider_name }} |
| 25 | + {% endblocktrans %} |
| 26 | + </a> |
| 27 | + </li> |
| 28 | + <div class="ui tiny modal" data-modal-id="github-select"> |
| 29 | + <div class="header"> |
| 30 | + {% blocktrans trimmed with verbiage=verbiage|default:'Connect to' provider_name=provider_name %} |
| 31 | + {{ verbiage }} {{ provider_name }} |
| 32 | + {% endblocktrans %} |
| 33 | + </div> |
| 34 | + <div class="content"> |
| 35 | + <p> |
| 36 | + {% blocktrans trimmed %} |
| 37 | + Read the Docs now supports two methods for connecting your GitHub account: |
| 38 | + {% endblocktrans %} |
| 39 | + </p> |
| 40 | + <div class="ui segment"> |
| 41 | + <div class="ui small divided items"> |
| 42 | + {% for provider in providers_github %} |
| 43 | + <div class="item"> |
| 44 | + <div class="content"> |
| 45 | + <div class="header"> |
| 46 | + {% if provider.id == "github" %} |
| 47 | + {% blocktrans trimmed %} |
| 48 | + Our GitHub OAuth app |
| 49 | + {% endblocktrans %} |
| 50 | + <span class="ui compact small basic label">Default</span> |
| 51 | + {% elif provider.id == "githubapp" %} |
| 52 | + {% blocktrans trimmed %} |
| 53 | + Our GitHub App |
| 54 | + {% endblocktrans %} |
| 55 | + <span class="ui violet compact small basic label">Beta</span> |
| 56 | + {% endif %} |
| 57 | + </div> |
| 58 | + <div class="description"> |
| 59 | + <p> |
| 60 | + {# As we progress in a beta test period, the connect text should be tuned to make GHA sound like less of a beta feature. #} |
| 61 | + {% with is_early_beta=False %} |
| 62 | + {% if provider.id == "github" %} |
| 63 | + {% if process == "connect" and is_early_beta %} |
| 64 | + {% blocktrans trimmed %} |
| 65 | + For new users and users reconnecting a previously connected GitHub account. |
| 66 | + {% endblocktrans %} |
| 67 | + {% elif process == "connect" and not is_early_beta %} |
| 68 | + {% blocktrans trimmed %} |
| 69 | + For users reconnecting a previously connected GitHub account and users unable to switch to our new app. |
| 70 | + {% endblocktrans %} |
| 71 | + <i> |
| 72 | + {% blocktrans trimmed %} |
| 73 | + We recommend new users connect their account using our GitHub App. |
| 74 | + {% endblocktrans %} |
| 75 | + </i> |
| 76 | + {% else %} |
| 77 | + {% blocktrans trimmed %} |
| 78 | + For users that connected their GitHub accounts before June 24, 2025. |
| 79 | + {% endblocktrans %} |
| 80 | + {% endif %} |
| 81 | + {% elif provider.id == "githubapp" %} |
| 82 | + {% if process == "connect" and is_early_beta %} |
| 83 | + {% blocktrans trimmed %} |
| 84 | + For users that would like early access to our new app and would like to test new features. |
| 85 | + {% endblocktrans %} |
| 86 | + <i> |
| 87 | + {% blocktrans trimmed %} |
| 88 | + We recommend only advanced users use this method. |
| 89 | + {% endblocktrans %} |
| 90 | + </i> |
| 91 | + {% elif process == "connect" and not is_early_beta %} |
| 92 | + {% blocktrans trimmed %} |
| 93 | + For users that want granular control of permissions to repositories. |
| 94 | + {% endblocktrans %} |
| 95 | + {% else %} |
| 96 | + {% blocktrans trimmed %} |
| 97 | + For users that have switched their connected GitHub accounts already. |
| 98 | + {% endblocktrans %} |
| 99 | + {% endif %} |
| 100 | + {% endif %} |
| 101 | + {% endwith %} |
| 102 | + </p> |
| 103 | + </div> |
| 104 | + <div class="extra"> |
| 105 | + {% with button_classes=forloop.first|yesno:"right floated primary,right floated basic" %} |
| 106 | + {% include "socialaccount/snippets/provider_list_item.html" with process=process verbiage=text_log_in provider=provider button_classes=button_classes %} |
| 107 | + {% endwith %} |
| 108 | + </div> |
| 109 | + </div> |
| 110 | + </div> |
| 111 | + {% endfor %} |
| 112 | + </div> |
| 113 | + </div> |
| 114 | + |
| 115 | + <div class="ui info message"> |
| 116 | + <i class="fas fa-info-circle icon"></i> |
| 117 | + To learn more about our new GitHub App integration, |
| 118 | + <a href="https://about.readthedocs.com/blog/2025/06/announcing-our-github-app-beta/">read our beta announcement</a> |
| 119 | + </div> |
| 120 | + </div> |
| 121 | + <div class="actions"> |
| 122 | + <div class="ui cancel button">{% trans "Cancel" %}</div> |
| 123 | + </div> |
| 124 | + </div> |
| 125 | +{% endif %} |
| 126 | + |
| 127 | +{# This is the basic list but with sorting now. If there is a modal above, we skip the GitHub providers here #} |
| 128 | +{% for provider in providers %} |
| 129 | + {% if providers_github|length == 2 and "github" in provider.id %} |
| 130 | + {% comment %} |
| 131 | + TODO remove this after we are mostly using GHA and don't need a modal |
| 132 | + |
| 133 | + Skip any provider that is in the modal above if the modal is in use. This |
| 134 | + adjusts for when one provider is shown on connect but the modal is used |
| 135 | + on login. |
| 136 | + {% endcomment %} |
| 137 | + {% else %} |
| 138 | + <li class="item"> |
| 139 | + {% include "socialaccount/snippets/provider_list_item.html" with process=process verbiage=text_log_in provider=provider %} |
| 140 | + </li> |
28 | 141 | {% endif %}
|
29 | 142 | {% endfor %}
|
0 commit comments