Fix redirections to empty tabs (#290)

Whenever href (url) attribute was omitted or had no value
the click action would do nothing. With no URLs defined and
`target="_blank"` attributes, which were recently added,
anchor tags now redirect users to new blank tabs (side effect).

This PR solves the issues by adding conditions
before applying `target="_blank"` or in some cases by
ommiting entire entities (e.g. the view_certificate button).
This commit is contained in:
Tommy Chu 2021-04-05 18:25:27 +02:00 committed by GitHub
parent cb3df73d53
commit d6706e05ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 16 additions and 6 deletions

View file

@ -11,7 +11,9 @@
<p>{{ .courseOverview | markdownify }}</p>
</div>
<div class="card-footer">
<a class="btn btn-outline-info ml-1 pl-2 mb-2" href="{{ .certificateURL | default "#"}}" target="_blank" role="button">{{ i18n "view_certificate"}}</a>
{{ if .certificateURL }}
<a class="btn btn-outline-info ml-1 pl-2 mb-2" href="{{ .certificateURL }}" target="_blank" role="button">{{ i18n "view_certificate"}}</a>
{{ end }}
</div>
</div>
</div>