Skip to content

Commit

Permalink
For private profile show just the header
Browse files Browse the repository at this point in the history
  • Loading branch information
vidya-ram committed Oct 26, 2023
1 parent 1d9106b commit b4c5cfa
Show file tree
Hide file tree
Showing 5 changed files with 54 additions and 30 deletions.
8 changes: 4 additions & 4 deletions funnel/templates/profile_layout.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -426,10 +426,10 @@
{% if profile.is_organization_profile %}
<a class="sub-navbar__item mui--text-subhead mui--text-dark mui--hidden-xs mui--hidden-sm {% if current_page == 'profile' %}sub-navbar__item--active{%- endif %}" href="{%- if current_page != 'profile' -%}{{ profile.url_for() }}{%- endif %}" data-cy-navbar="profile">{% trans %}Home{% endtrans %}</a>
<a class="sub-navbar__item mui--text-subhead mui--text-dark {% if current_page == 'admins' %}sub-navbar__item--active{%- endif %}" href="{%- if current_page != 'admins' -%}{{ profile.urls['members'] }}{%- endif %}" data-cy-navbar="admins">{% trans %}Admins{% endtrans %} <span class="sub-navbar__item__icon mui--pull-right">{{ faicon(icon='chevron-right', icon_size='subhead') }}</span></a>
{% else %}
<a class="sub-navbar__item mui--text-subhead mui--text-dark mui--hidden-xs mui--hidden-sm {% if current_page == 'profile' %}sub-navbar__item--active{%- endif %}" href="{{ profile.url_for() }}">{% trans %}Sessions{% endtrans %}</a>
<a class="sub-navbar__item mui--text-subhead mui--text-dark {% if current_page == 'projects' %}sub-navbar__item--active{%- endif %}" href="{{ profile.url_for('user_participated_projects') }}">{% trans %}Projects{% endtrans %}<span class="sub-navbar__item__icon mui--pull-right">{{ faicon(icon='chevron-right', icon_size='subhead') }}</span></a>
<a class="sub-navbar__item mui--text-subhead mui--text-dark {% if current_page == 'submissions' %}sub-navbar__item--active{%- endif %}" href="{{ profile.url_for('user_proposals') }}" data-cy="submissions">{% trans %}Submissions{% endtrans %}<span class="sub-navbar__item__icon mui--pull-right">{{ faicon(icon='chevron-right', icon_size='subhead') }}</span></a>
{% elif not profile.features.is_private() %}
<a class="sub-navbar__item mui--text-subhead mui--text-dark mui--hidden-xs mui--hidden-sm {% if current_page == 'profile' %}sub-navbar__item--active{%- endif %}" href="{{ profile.url_for() }}">{% trans %}Sessions{% endtrans %}</a>
<a class="sub-navbar__item mui--text-subhead mui--text-dark {% if current_page == 'projects' %}sub-navbar__item--active{%- endif %}" href="{{ profile.url_for('user_participated_projects') }}">{% trans %}Projects{% endtrans %}<span class="sub-navbar__item__icon mui--pull-right">{{ faicon(icon='chevron-right', icon_size='subhead') }}</span></a>
<a class="sub-navbar__item mui--text-subhead mui--text-dark {% if current_page == 'submissions' %}sub-navbar__item--active{%- endif %}" href="{{ profile.url_for('user_proposals') }}" data-cy="submissions">{% trans %}Submissions{% endtrans %}<span class="sub-navbar__item__icon mui--pull-right">{{ faicon(icon='chevron-right', icon_size='subhead') }}</span></a>
{% endif %}
</nav>
</div>
Expand Down
26 changes: 15 additions & 11 deletions funnel/templates/user_profile.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,22 @@
<div class="mui-container">
<div class="page-content">
{% block contentwrapper %}
<div class="grid projects-wrapper" id="tagged-sessions">
<div class="grid__col-xs-12">
{% if not tagged_sessions %}
<p class="mui-panel bg-accent">{% trans %}No tagged sessions yet{% endtrans %}</p>
{% endif %}
</div>
{% for session in tagged_sessions %}
<div class="grid__col-xs-12 grid__col-sm-6 grid__col-sm-4">
{{ video_thumbnail(session) }}
{% if profile.features.is_private() %}
<p class="mui-panel bg-accent">{% trans %}This is a private account{% endtrans %}</p>
{% else %}
<div class="grid projects-wrapper" id="tagged-sessions">
<div class="grid__col-xs-12">
{% if not tagged_sessions %}
<p class="mui-panel bg-accent">{% trans %}No tagged sessions yet{% endtrans %}</p>
{% endif %}
</div>
{% endfor %}
</div>
{% for session in tagged_sessions %}
<div class="grid__col-xs-12 grid__col-sm-6 grid__col-sm-4">
{{ video_thumbnail(session) }}
</div>
{% endfor %}
</div>
{% endif %}
{% endblock contentwrapper %}
</div>
</div>
Expand Down
30 changes: 18 additions & 12 deletions funnel/templates/user_profile_projects.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,24 @@

{% block contentwrapper %}
<div class="grid projects-wrapper" id="tagged-projects">
<div class="grid__col-xs-12">
{% if not participated_projects %}
<p class="mui-panel bg-accent">{% trans %}No participation yet{% endtrans %}</p>
{% endif %}
</div>
<ul class="mui-list--unstyled grid upcoming" role="list">
{% for project in participated_projects %}
<li class="grid__col-xs-12 grid__col-sm-6 grid__col-lg-4" role="listitem">
{{ projectcard(project, include_calendar=true, calendarwidget_compact=false) }}
</li>
{%- endfor -%}
</ul>
{% if profile.features.is_private() %}
<div class="grid__col-xs-12">
<p class="mui-panel bg-accent">{% trans %}This is a private account{% endtrans %}</p>
</div>
{% else %}
<div class="grid__col-xs-12">
{% if not participated_projects %}
<p class="mui-panel bg-accent">{% trans %}No participation yet{% endtrans %}</p>
{% endif %}
</div>
<ul class="mui-list--unstyled grid upcoming" role="list">
{% for project in participated_projects %}
<li class="grid__col-xs-12 grid__col-sm-6 grid__col-lg-4" role="listitem">
{{ projectcard(project, include_calendar=true, calendarwidget_compact=false) }}
</li>
{%- endfor -%}
</ul>
{% endif %}
</div>
{% endblock contentwrapper %}

Expand Down
10 changes: 7 additions & 3 deletions funnel/templates/user_profile_proposals.html.jinja2
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,14 @@
{% block contentwrapper %}
<div class="grid projects-wrapper" id="tagged-submissions">
<div class="grid__col-xs-12">
{% if submitted_proposals %}
{{ proposal_list(submitted_proposals) }}
{% if profile.features.is_private() %}
<p class="mui-panel bg-accent">{% trans %}This is a private account{% endtrans %}</p>
{% else %}
<p class="mui-panel bg-accent">{% trans %}No submissions{% endtrans %}</p>
{% if submitted_proposals %}
{{ proposal_list(submitted_proposals) }}
{% else %}
<p class="mui-panel bg-accent">{% trans %}No submissions{% endtrans %}</p>
{% endif %}
{% endif %}
</div>
</div>
Expand Down
10 changes: 10 additions & 0 deletions funnel/views/profile.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,16 @@ def feature_profile_make_private(obj: Account):
return obj.current_roles.admin and obj.make_profile_private.is_available


@Account.features('is_private')
def feature_profile_is_private(obj: Account):
print('obj.current_roles.admin', obj.current_roles.admin, bool(obj.profile_state.PRIVATE))
return (
obj.is_user_profile
and not obj.current_roles.admin
and not bool(obj.profile_state.ACTIVE_AND_PUBLIC)
)


def template_switcher(templateargs):
template = templateargs.pop('template')
return render_template(template, **templateargs)
Expand Down

0 comments on commit b4c5cfa

Please sign in to comment.