Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Show connect buttons for installed apps only #3394

Merged
merged 7 commits into from
Dec 14, 2017
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions media/css/core.css
Original file line number Diff line number Diff line change
Expand Up @@ -690,19 +690,16 @@ div.project-import-remote button.remote-sync:before {
content: "\f021";
}

div.project-import-remote form.import-connect-github button:before,
a.socialaccount-provider.github:before {
font-family: FontAwesome;
content: "\f09b";
}

div.project-import-remote form.import-connect-gitlab button:before,
a.socialaccount-provider.gitlab:before {
font-family: FontAwesome;
content: "\f1d3";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

\f296 should be for gitlab
http://fontawesome.io/icon/gitlab/

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

}

div.project-import-remote form.import-connect-bitbucket button:before,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What's the reason we're removing this styles?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed these because the form is not used anymore (I removed them). So, I didn't want to leave orphans styles...

a.socialaccount-provider.bitbucket:before,
a.socialaccount-provider.bitbucket_oauth2:before {
font-family: FontAwesome;
Expand Down
12 changes: 7 additions & 5 deletions readthedocs/projects/static/projects/css/import.css
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,14 @@ div.project-import-remote li.remote-repo ul.remote-repo-menu {
top: 10px;
right: 10px;
}
div.project-import-remote form.import-connect {
overflow: auto;
display: inline;
div.project-import-remote div.project-import-providers ul {
overflow: hidden;
}
div.project-import-remote div.project-import-providers ul li {
float: left;
}
div.project-import-remote form.import-connect button {
display: inline;
div.project-import-remote a.socialaccount-provider {
display: block;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes look to have some negative side effect on spacing and alignment. What prompted these changes? If we have to alter layout on one of the forms, that might be better.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"I don't know CSS", so I don't have good reasons. I touched it a little, googled something and it looked it worked so I thought that I could propose it.

I'm totally 👍 on remove this and change it as you like/prefer/wish/etc.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, missed this the first time. This is actually editing a compiled css file, the source is at readthedocs/projects/static-src/projects/css/import.less. I'm going to be working to unify our styling, and to get rid of our core.css file soon.

margin-bottom: .5em;
font-size: 1em;
font-weight: normal;
Expand Down
2 changes: 1 addition & 1 deletion readthedocs/restapi/views/footer_views.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ def get_version_compare_data(project, base_version=None):
}
if highest_version_obj:
ret_val['url'] = highest_version_obj.get_absolute_url()
ret_val['slug'] = highest_version_obj.slug,
ret_val['slug'] = highest_version_obj.slug
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks like an unrelated bug?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ha! Yeah. I don't understand how this passed the test in the PR that was merged :/

if base_version and base_version.slug != LATEST:
try:
base_version_comparable = parse_version_failsafe(
Expand Down
37 changes: 4 additions & 33 deletions readthedocs/templates/projects/project_import.html
Original file line number Diff line number Diff line change
Expand Up @@ -93,41 +93,12 @@ <h1>{% trans "Import a Repository" %}</h1>
{% endblocktrans %}
</p>

<div class="project-import-providers">
<form
method="get"
action="{% provider_login_url "github" %}"
class="import-connect import-connect-github">
<button>
{% trans "Connect to GitHub" %}
</button>
<input type="hidden" name="process" value="connect">
<input type="hidden" name="next" value="/dashboard/import/">
</form>

<form
method="get"
action="{% provider_login_url "gitlab" %}"
class="import-connect import-connect-gitlab">
<button>
{% trans "Connect to GitLab" %}
</button>
<input type="hidden" name="process" value="connect">
<input type="hidden" name="next" value="/dashboard/import/">
</form>

<form
method="get"
action="{% provider_login_url "bitbucket_oauth2" %}"
class="import-connect import-connect-bitbucket">
<button>
{% trans "Connect to Bitbucket" %}
</button>
<input type="hidden" name="process" value="connect">
<input type="hidden" name="next" value="/dashboard/import/">
</form>
<div class="project-import-providers">
<ul class="socialaccount_providers">
{% include "socialaccount/snippets/provider_list.html" with process="connect" %}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't see this file in the commit, did it already exist?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I see it below -- is it also used somewhere else?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it is used in the /accounts/social/connections/ page, under the admin settings.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We do lose the next parameter here, correct? This will likely just redirect users back to the connection page. Is redirecting to the import page important here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I didn't realize this.

Yes, I think it's important since you are at the import page. I'd like to connect my account and import the my project immediately. I'm proposing a fix for this using the template tag: https://github.com/pennersr/django-allauth/blob/cfc5112bf474af2cbb16e4b4a36708e8949a2105/allauth/socialaccount/templatetags/socialaccount.py#L45

</ul>
</div>

{% endif %}
</li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
{% for brand in provider.get_brands %}
<li>
<a title="{{ brand.name }}"
class="socialaccount-provider {{ provider.id }} {{ brand.id }}"
class="socialaccount-provider {{ provider.id }} {{ brand.id }} button"
href="{% provider_login_url provider.id openid=brand.openid_url process=process %}"
>
{% blocktrans with brand_name=brand.name %}
Expand Down