Skip to content

Commit

Permalink
portal: minor landing page layout fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
tschaume committed May 11, 2021
1 parent 1fb1041 commit 593b13b
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 18 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@
</nav>

{% if alert %}
<div id=alert class="notification is-warning">
<div id=alert class="notification is-warning is-marginless">
{{ alert|safe }}
</div>
{% endif %}
Expand Down
39 changes: 24 additions & 15 deletions mpcontribs-portal/mpcontribs/portal/templates/landingpage.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,40 +5,48 @@
<section class="section" id=landingpage>

{% if references %}
<nav class="breadcrumb has-bullet-separator is-size-7 is-marginless">
<ul>
{% for ref in references %}
<li><a href="{{ref.url}}" target="_blank" rel="noopener noreferrer">{{ref.label}}</a></li>
{% endfor %}
{% if more_references %}
<li></li>
<a name="read_more">[+]</a>
{% for ref in more_references %}
<li name="read_more" class="is-hidden"><a href="{{ref.url}}">{{ref.label}}</a></li>
{% endfor %}
{% endif %}
</ul>
</nav>
<div class="breadcrumb has-bullet-separator is-marginless is-small" style="display: flex;">
<label style="padding-right: 9px;">Reference(s):</label>
<ul>
{% for ref in references %}
<li><a href="{{ref.url}}" target="_blank" rel="noopener noreferrer">{{ref.label}}</a></li>
{% endfor %}
{% if more_references %}
<li></li>
<a name="read_more">[+]</a>
{% for ref in more_references %}
<li name="read_more" class="is-hidden"><a href="{{ref.url}}">{{ref.label}}</a></li>
{% endfor %}
{% endif %}
</ul>
</div>
{% endif %}

{% if title %}
<div class="title">{{ title }}</div>
{% endif %}
{% if authors %}
<div class="subtitle">
{{ authors.main }}
<span>{{ authors.main }}</span>
{% if authors.etal %}
<a name="read_more">et al.</a>
<span name="read_more" hidden>, {{ authors.etal }}</span>
{% endif %}
</div>
{% endif %}

{% if descriptions or other %}
<article class="message is-dark">
<div class="message-body">
{% if descriptions %}
<div class="content">
{{ descriptions.0|safe }}.
{% if descriptions.1 %}
<a name="read_more">More &raquo;</a>
<span name="read_more" hidden>{{ descriptions.1|safe }}</span>
{% endif %}
</div>
{% endif %}
{% if other and other.strip != 'null' %}
<details>
<summary>Other Info</summary>
Expand All @@ -49,6 +57,7 @@
{% endif %}
</div>
</article>
{% endif %}

{% if not request.META.HTTP_X_ANONYMOUS_CONSUMER %}
{% if columns and columns.strip != 'null' %}
Expand Down
10 changes: 8 additions & 2 deletions mpcontribs-portal/mpcontribs/portal/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,8 +72,9 @@ def landingpage(request, project):
ckwargs = client_kwargs(request)
headers = ckwargs.get("headers", {})
ctx = get_context(request)
not_logged_in = headers.get("X-Anonymous-Consumer", False)

if headers.get("X-Anonymous-Consumer", False):
if not_logged_in:
ctx["alert"] = f"""
Please <a href=\"{ctx['OAUTH_URL']}\">log in</a> to browse and filter contributions.
""".strip()
Expand Down Expand Up @@ -116,7 +117,12 @@ def landingpage(request, project):
if col["unit"] != "NaN"
}
)

except HTTPNotFound:
msg = f"Project '{project}' not found or access denied!"
if not_logged_in:
ctx["alert"] += f" {msg}"
else:
ctx["alert"] = msg
except Exception as ex:
ctx["alert"] = str(ex)

Expand Down

0 comments on commit 593b13b

Please sign in to comment.