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

Fix communities creation check #187

Merged

Conversation

Glignos
Copy link
Member

@Glignos Glignos commented Sep 23, 2020

No description provided.

@Glignos Glignos requested a review from slint September 23, 2020 12:40
<h2>
{{ _('My communities') }}
<div class="pull-right">
&nbsp;<a href="{{url_for('.new')}}" class="btn btn-primary"><i class="icon-plus-sign"></i> {{ _('New') }}</a>
&nbsp;<a href="{{url_for('.new')}}" class="btn btn-primary" {{ "disabled" if not can_user_create_community(current_user) }}><i class="icon-plus-sign"></i> {{ _('New') }}</a>
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
&nbsp;<a href="{{url_for('.new')}}" class="btn btn-primary" {{ "disabled" if not can_user_create_community(current_user) }}><i class="icon-plus-sign"></i> {{ _('New') }}</a>
&nbsp;<a href="{{url_for('.new')}}" class="btn btn-primary {{ "disabled" if not can_user_create_community(current_user) }}" {{ "disabled" if not can_user_create_community(current_user) }}><i class="icon-plus-sign"></i> {{ _('New') }}</a>

This also makes the button unclickable

@@ -10,10 +10,13 @@
<div class="well">
{% if current_user.is_authenticated %}
{% if mycommunities %}
{% if not can_user_create_community(current_user) %}
Copy link
Member

Choose a reason for hiding this comment

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

I would extract this as a variable at the beginning of the template:

{% set can_create_community = can_user_create_community(current_user) %}

and then use appropriately below

@@ -177,6 +176,10 @@ def new():
for at least one week. If you want to speed up the process, you \
Copy link
Member

Choose a reason for hiding this comment

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

Instead of \, it's better to use string literal lines in parentheses, just to be sure about the whitespace

@Glignos Glignos force-pushed the fix_communities_creation_check branch from d1a0df1 to d4dcaab Compare September 23, 2020 13:22
@Glignos Glignos force-pushed the fix_communities_creation_check branch from d4dcaab to 22e12c6 Compare September 23, 2020 14:01
@slint slint merged commit 3ff78b2 into inveniosoftware:maint-1.0 Sep 23, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants