mirror of https://codeberg.org/dribdat/dribdat.git
Certificate links
This commit is contained in:
parent
0487d0047d
commit
18f2114c22
|
@ -100,9 +100,12 @@ def home():
|
|||
resource_events = events.filter(Event.lock_resources)
|
||||
resource_events = resource_events.order_by(Event.name.asc())
|
||||
# Select my challenges
|
||||
my_projects = None
|
||||
my_projects = may_certify = None
|
||||
if current_user and not current_user.is_anonymous:
|
||||
my_projects = current_user.joined_projects(True, 3)
|
||||
if cur_event is not None:
|
||||
may_certify = cur_event.has_finished
|
||||
may_certify = may_certify and cur_event.certificate_path
|
||||
# Filter past events
|
||||
MAX_PAST_EVENTS = 6
|
||||
events_past_next = events_past.count() > MAX_PAST_EVENTS
|
||||
|
@ -115,6 +118,7 @@ def home():
|
|||
events_past=events_past.all(),
|
||||
events_past_next=events_past_next,
|
||||
my_projects=my_projects,
|
||||
may_certify=may_certify,
|
||||
current_event=cur_event)
|
||||
|
||||
|
||||
|
@ -221,9 +225,12 @@ def event(event_id):
|
|||
if request.args.get('embed'):
|
||||
return render_template("public/embed.html",
|
||||
current_event=event, projects=projects)
|
||||
# Check for certificate
|
||||
may_certify = event.has_finished and event.certificate_path
|
||||
# TODO: seems inefficient? We only need a subset of the data here:
|
||||
summaries = [ p.data for p in projects ]
|
||||
return render_template("public/event.html", current_event=event,
|
||||
may_certify=may_certify,
|
||||
summaries=summaries, project_count=len(summaries),
|
||||
active="projects")
|
||||
|
||||
|
|
|
@ -1763,6 +1763,14 @@ a.go-up {
|
|||
text-align: center;
|
||||
margin-top: 1em;
|
||||
}
|
||||
#get-certified {
|
||||
background-image: url('/static/img/certificate.png');
|
||||
background-repeat: no-repeat;
|
||||
background-size: contain;
|
||||
padding-left: 5.4em;
|
||||
padding-top: 1.2em;
|
||||
height: 4em;
|
||||
}
|
||||
.drib-count,
|
||||
.team-boost,
|
||||
.user-score {
|
||||
|
@ -1887,6 +1895,12 @@ a.go-up {
|
|||
.profile-projects .card {
|
||||
padding-left: 0px !important;
|
||||
}
|
||||
.profile-projects.honeycomb .row {
|
||||
min-height: 240px;
|
||||
}
|
||||
.profile-projects.honeycomb .hexagon {
|
||||
margin-bottom: 0px;
|
||||
}
|
||||
}
|
||||
|
||||
/* Embed view of the projects */
|
||||
|
|
|
@ -108,6 +108,14 @@
|
|||
<i class="fa fa-comment"></i>
|
||||
Connect</a>
|
||||
{% endif %}
|
||||
{% if may_certify %}
|
||||
<a class="btn btn-lg btn-light"
|
||||
href="{{ url_for('public.user_current') }}"
|
||||
title="Download a participation certificate on your profile">
|
||||
<i class="fa fa-check text-info"></i>
|
||||
Certificate available
|
||||
</a>
|
||||
{% endif %}
|
||||
</div>
|
||||
|
||||
<div class="event-nav mt-2 mb-2 text-center" role="group" aria-label="Event navigation">
|
||||
|
|
|
@ -21,6 +21,16 @@
|
|||
{% block content %}
|
||||
|
||||
{% cache 300, 'home-page' %}
|
||||
|
||||
{% if may_certify %}
|
||||
<div class="container-certify mb-2" style="position: absolute; z-index: 99;">
|
||||
<a id="get-certified" class="btn btn-default btn-lg"
|
||||
href="{{ url_for('public.user_current') }}"
|
||||
title="Download a participation certificate on your profile">
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
||||
{% if current_event %}
|
||||
<main class="home-page">
|
||||
{% if current_event.countdown and 'up' in config.DRIBDAT_CLOCK %}
|
||||
|
@ -39,6 +49,7 @@
|
|||
{% for event in events_featured %}
|
||||
{{ misc.render_featured_event(event) }}
|
||||
{% endfor %}
|
||||
|
||||
</div>
|
||||
|
||||
{% if events_featured %}
|
||||
|
|
|
@ -66,10 +66,8 @@
|
|||
<br clear="all"/>
|
||||
<a id="get-certified" class="btn btn-light btn-lg"
|
||||
href="{{ url_for('public.user_cert') }}" download
|
||||
title="Download a participation certificate" style="width: 12em">
|
||||
<img src="{{ url_for('static', filename='img/certificate.png') }}"
|
||||
style="width: 7em"><br>
|
||||
My Certificate
|
||||
title="Download a participation certificate">
|
||||
Download Certificate
|
||||
</a>
|
||||
</div>
|
||||
{% endif %}
|
||||
|
|
|
@ -277,10 +277,11 @@ class User(UserMixin, PkModel):
|
|||
projects = [for_project]
|
||||
if not len(projects) > 0:
|
||||
return (False, 'projects')
|
||||
cert_path = self.get_cert_path(projects[0].event)
|
||||
if not cert_path:
|
||||
return (False, 'event')
|
||||
return (True, cert_path)
|
||||
for p in projects:
|
||||
cert_path = self.get_cert_path(p.event)
|
||||
if cert_path:
|
||||
return (True, cert_path)
|
||||
return (False, 'event')
|
||||
|
||||
def get_cert_path(self, event):
|
||||
"""Generate URL to participation certificate."""
|
||||
|
@ -288,6 +289,8 @@ class User(UserMixin, PkModel):
|
|||
return None
|
||||
if not event.certificate_path:
|
||||
return None
|
||||
if not event.has_finished:
|
||||
return None
|
||||
path = event.certificate_path
|
||||
userdata = self.data
|
||||
for m in ['sso', 'username', 'email']:
|
||||
|
|
|
@ -5,8 +5,8 @@ attrs==23.2.0 ; python_version >= "3.8" and python_version < "4"
|
|||
bcrypt==4.1.2 ; python_version >= "3.8" and python_version < "4"
|
||||
bleach==6.1.0 ; python_version >= "3.8" and python_version < "4"
|
||||
blinker==1.7.0 ; python_version >= "3.8" and python_version < "4"
|
||||
boto3==1.34.86 ; python_version >= "3.8" and python_version < "4"
|
||||
botocore==1.34.86 ; python_version >= "3.8" and python_version < "4"
|
||||
boto3==1.34.90 ; python_version >= "3.8" and python_version < "4"
|
||||
botocore==1.34.90 ; python_version >= "3.8" and python_version < "4"
|
||||
cachelib==0.9.0 ; python_version >= "3.8" and python_version < "4"
|
||||
certifi==2024.2.2 ; python_version >= "3.8" and python_version < "4"
|
||||
cffi==1.16.0 ; python_version >= "3.8" and python_version < "4"
|
||||
|
@ -75,7 +75,7 @@ python-slugify==8.0.4 ; python_version >= "3.8" and python_version < "4"
|
|||
pytz==2023.4 ; python_version >= "3.8" and python_version < "4"
|
||||
pyyaml==6.0.1 ; python_version >= "3.8" and python_version < "4"
|
||||
redis==4.6.0 ; python_version >= "3.8" and python_version < "4"
|
||||
referencing==0.34.0 ; python_version >= "3.8" and python_version < "4"
|
||||
referencing==0.35.0 ; python_version >= "3.8" and python_version < "4"
|
||||
requests-oauthlib==2.0.0 ; python_version >= "3.8" and python_version < "4"
|
||||
requests==2.31.0 ; python_version >= "3.8" and python_version < "4"
|
||||
rfc3986==2.0.0 ; python_version >= "3.8" and python_version < "4"
|
||||
|
@ -97,7 +97,7 @@ typer[all]==0.11.1 ; python_version >= "3.8" and python_version < "4"
|
|||
typing-extensions==4.11.0 ; python_version >= "3.8" and python_version < "4"
|
||||
urllib3==1.26.18 ; python_version >= "3.8" and python_version < "4"
|
||||
urlobject==2.4.3 ; python_version >= "3.8" and python_version < "4"
|
||||
validators==0.28.0 ; python_version >= "3.8" and python_version < "4"
|
||||
validators==0.28.1 ; python_version >= "3.8" and python_version < "4"
|
||||
webassets==2.0 ; python_version >= "3.8" and python_version < "4"
|
||||
webencodings==0.5.1 ; python_version >= "3.8" and python_version < "4"
|
||||
werkzeug==2.3.8 ; python_version >= "3.8" and python_version < "4"
|
||||
|
|
Loading…
Reference in New Issue