Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions hackathon/fixtures/hackathons.json
Original file line number Diff line number Diff line change
Expand Up @@ -687,7 +687,7 @@
"created": "2021-01-28T17:46:37.870Z",
"updated": "2021-01-28T17:46:37.870Z",
"created_by": 1,
"display_name": "team_1",
"display_name": "team_x1",
"header_image": "",
"hackathon": 12,
"project": null,
Expand All @@ -704,7 +704,7 @@
"created": "2021-01-28T17:46:37.876Z",
"updated": "2021-01-28T17:46:37.876Z",
"created_by": 1,
"display_name": "team_2",
"display_name": "team_x2",
"header_image": "",
"hackathon": 12,
"project": null,
Expand All @@ -722,7 +722,7 @@
"created": "2021-01-28T17:46:37.880Z",
"updated": "2021-01-28T17:46:37.880Z",
"created_by": 1,
"display_name": "team_3",
"display_name": "team_x3",
"header_image": "",
"hackathon": 12,
"project": null,
Expand All @@ -740,7 +740,7 @@
"created": "2021-01-28T17:46:37.882Z",
"updated": "2021-01-28T17:46:37.882Z",
"created_by": 1,
"display_name": "team_4",
"display_name": "team_x4",
"header_image": "",
"hackathon": 12,
"project": null,
Expand Down
5 changes: 1 addition & 4 deletions hackathon/templates/hackathon/create-event.html
Original file line number Diff line number Diff line change
Expand Up @@ -40,10 +40,7 @@ <h1>Create Hackathon</h1>
<div class="col-12 col-md-6">
{{ form.status|as_crispy_field }}
</div>
<div class="col-12 col-md-6">
{{ form.judging_status|as_crispy_field }}
</div>
<div class="col-12 col-md-6">
<div class="col-12">
{{ form.start_date|as_crispy_field }}
</div>
<div class="col-12 col-md-6 mb-3">
Expand Down
12 changes: 8 additions & 4 deletions hackathon/templates/hackathon/hackathon_view.html
Original file line number Diff line number Diff line change
Expand Up @@ -84,10 +84,10 @@ <h1 class="page-title" id="teams">Teams:</h1>
<div class="card team-card">
<div class="card-body">
<div class="card-title text-left my-auto">
<a href="{% url 'view_team' team_id=team.id %}">
<h3 class="team-name">
<a href="{% url 'view_team' team_id=team.id %}" class="ci-link">
<h4 class="team-name">
{{ team }}
</h3>
</h4>
</a>
</div>
<div class="card-text">
Expand All @@ -99,10 +99,14 @@ <h3 class="team-name">
{% endfor %}
</div>
<!-- Render project submission button if user is participant of team -->
{% if user in team.participants.get_queryset %}
{% if user in hackathon.participants.all %}
{% if user in team.participants.get_queryset %}
<div class="text-left">
{% if hackathon.status == 'hack_in_progress' %}
<a href="/teams/{{team.id}}/project/" class="btn btn-ci">Edit Project</a>
{% endif %}
</div>
{% endif %}
{% elif user in hackathon.judges.all %}
{% if hackathon.status == 'hack_in_progress' or hackathon.status == 'judging' %}
<div class="text-left">
Expand Down
9 changes: 9 additions & 0 deletions hackathon/templates/hackathon/includes/enrollpart.html
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,15 @@
</form>
{% else %}
<div class="enrollments-closed mt-4 mb-2 p-3">
{% if request.user in hackathon.participants.all %}
{% if hackathon.status == 'hack_in_progress' or hackathon.status == 'judging' %}
You are participanting in this hackathon.
{% elif hackathon.status == 'finished' %}
You are participated in this hackathon.
{% endif %}
{% else %}
Registrations for this hackathon are currently not open.
{% endif %}
</div>

{% endif %}
2 changes: 1 addition & 1 deletion hackathon/templates/hackathon/includes/hackathon_card.html
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
</div>
<div class="col-md-12 col-lg-9">

<h5 class="p-orange card-title">{{ hackathon.display_name }}
<h5 class="p-orange card-title"><a href="/hackathon/{{hackathon.id}}/" class="ci-link">{{ hackathon.display_name }}</a>
{% if user.is_staff %}<span class="badge badge-secondary ml-2">{{hackathon.status}}</span>{% endif %}
</h5>
<p class="card-subtitle mb-2 text-muted"><i class="far fa-calendar-alt p-2"></i> {{ hackathon.start_date }} - {{ hackathon.end_date }}</p>
Expand Down
3 changes: 2 additions & 1 deletion hackathon/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,10 +70,11 @@ def judging(request, hack_id, team_id):
project=get_object_or_404(HackTeam, pk=team_id).project,
hack_project_score_category=score_category,
)

score_cat_id = f"score_{score_category.id}"
if team_score:
team_score.update(score=request.POST.get(score_cat_id))
else:
score_cat_id = f"score_{score_category.id}"
team_score = HackProjectScore(
created_by=request.user,
judge=request.user,
Expand Down
2 changes: 2 additions & 0 deletions left_to_do.txt
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
- Add notification to notify participants of winners
- Check if teams can submit projects still if status is judging, finished, deleted
- Allow judges to enroll as participant, but remove staff privileges for that hackathon
4 changes: 3 additions & 1 deletion showcase/templates/showcase.html
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,9 @@ <h3 class="text-center mb-3">All Showcased Projects</h3>
</div>
<div class="col-md-12 col-lg-9">

<div class="card-title showcase-card-title"><h4><a href="/showcase/{{showcase.id}}">{{showcase.display_name}}</a></h4></div>
<div class="card-title showcase-card-title">
<h4><a href="/showcase/{{showcase.id}}" class="ci-link">{{showcase.display_name}}</a></h4>
</div>
<div class="card-text">
<label for="showcase_description"><strong>Description</strong></label>
<p id="showcase_description">
Expand Down
5 changes: 5 additions & 0 deletions static/css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ main {
color: var(--s-grey);
}

a.ci-link {
font-size: inherit !important;
color: var(--p-orange);
}

.disabled-link {
pointer-events: none;
opacity: .5;
Expand Down
1 change: 1 addition & 0 deletions teams/helpers.py
Original file line number Diff line number Diff line change
Expand Up @@ -206,5 +206,6 @@ def update_team_participants(created_by_user, teams, hackathon_id):
if hack_team:
hack_team.first().participants.set(get_users_from_ids(team_members))
else:
hackathon = Hackathon.objects.get(id=hackathon_id)
create_new_team_and_add_participants(created_by_user, team_name,
team_members, hackathon)
4 changes: 2 additions & 2 deletions teams/templates/change_teams.html
Original file line number Diff line number Diff line change
Expand Up @@ -29,21 +29,21 @@ <h5 class="p-orange card-title">{{ team_name|format_team_name }}<span class="tea
{% endif %}
</div>

{% if leftover_participants %}
<section class="card shadow mb-3 mt-3">
<div class="card-body">
<h5 class="p-orange card-title">Leftover Participants</h5>
<ol class="team-drop-area" id="leftover_participants" ondrop="drop(event)" ondragover="allowDrop(event)">
{% if leftover_participants %}
{% for participant in leftover_participants %}
<li id="leftover_participants-{{ forloop.counter0 }}"
data-level={{ participant.level }}
data-userid={{ participant.userid }}
draggable="true" ondragstart="drag(event)">{{ participant.name }} (level: {{ participant.level }})</li>
{% endfor %}
{% endif %}
</ol>
</div>
</section>
{% endif %}

{% include 'includes/menu.html' %}

Expand Down
2 changes: 2 additions & 0 deletions teams/templates/includes/empty_project.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ <h3>Project: {{ team.project.display_name}}</h3>
<div class="card p-3">
<div class="card-body">
No Project submitted yet.
{% if team.hackathon.status == 'hack_in_progress' %}
{% if request.user in team.participants.all %}
<a href="/teams/{{team.id}}/project" class="teams-link">Add project details now!</a>
<p class="empty-project-subtitle mt-2 mb-0">
<i>Project details can always be edited until the judging starts.</i>
{% endif %}
{% endif %}
</p>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion teams/templates/includes/member.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div class="card card-no-border team-member-card ml-auto mr-auto">

<a href="{% url 'show_profile' user_id=member.id %}"><h6 class="card-text text-center mb-3">{{member.slack_display_name}}</h6></a>
<a href="{% url 'show_profile' user_id=member.id %}" class="ci-link"><h6 class="card-text text-center mb-3">{{member.slack_display_name}}</h6></a>
{% if member.profile_image %}
<img class="card-img-top team-member-img"
src="{{member.profile_image}}" alt="Profile Image">
Expand Down
10 changes: 8 additions & 2 deletions teams/templates/includes/project.html
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,13 @@ <h3>Project: {{ team.project.display_name}}</h3>
{% endif %}
</div>
{% if request.user in team.participants.all and not showcase %}
{% if team.hackathon.status == 'hack_in_progress' %}
<a role="button" class="btn btn-ci mt-2 w-100" href="{% url 'create_project' team_id=team.id %}">Edit Project</a>
{% elif team.hackathon.status == 'judging' %}
<div class="enrollments-closed mt-4 mb-2 p-3">
Judging in progress, you cannot edit your project anymore.
</div>
{% endif%}
<a role="button" class="btn btn-ci mt-2 w-100" href="{% url 'create_or_update_showcase' team_id=team.id %}">
{% if team.get_showcase %}Edit{% else %}Add{% endif %} Showcase
</a>
Expand Down Expand Up @@ -65,12 +71,12 @@ <h4>Code / Deployement</h4>
<div class="card-text">
{% if team.project.technologies_used %}
<p class="mb-0">
<strong>GitHub Repo:</strong> <a class="teams-link"
<strong>GitHub Repo:</strong> <a class="teams-link ci-link"
target="_blank"
href="{{team.project.github_url}}">{{team.project.github_url}}</a>
</p>
<p class="mb-0">
<strong>Deployed at: </strong> <a class="teams-link"
<strong>Deployed at: </strong> <a class="teams-link ci-link"
target="_blank"
href="{{team.project.github_url}}">{{team.project.deployed_url}}</a>
</p>
Expand Down
2 changes: 1 addition & 1 deletion teams/templates/includes/showcase_member.html
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

<div class="card card-no-border team-member-card ml-auto mr-auto">
{% if member.website_url %}
<a href="{{member.website_url}}" target="_blank"><h6 class="card-text text-center mb-3">{{member.full_name}}</h6></a>
<a href="{{member.website_url}}" target="_blank" class="ci-link"><h6 class="card-text text-center mb-3">{{member.full_name}}</h6></a>
{% else %}
<h6 class="card-text text-center mb-3">{% if not member.full_name %}{{member.slack_display_name}}{% else %}{{member.full_name}}{% endif %}</h6>
{% endif %}
Expand Down
10 changes: 7 additions & 3 deletions teams/templates/team.html
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,14 @@ <h3>About the team</h3>
</div>

{% if team.project %}
{% if team.project.share_permission or request.user.is_staff or request.user in team.participants.all %}
{% include 'includes/project.html' %}
{% if request.user.is_staff or team.project.share_permission or request.user in team.participants.all %}
{% if request.user in team.hackathon.participants.all and request.user not in team.participants.all and request.user.is_staff %}
{% include 'includes/project_not_visible.html' %}
{% else %}
{% include 'includes/project.html' %}
{% endif %}
{% else %}
{% include 'includes/project_not_visible.html' %}
{% include 'includes/project.html' %}
{% endif %}
{% else %}
{% include 'includes/empty_project.html' %}
Expand Down
4 changes: 4 additions & 0 deletions teams/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,6 +133,10 @@ def create_project(request, team_id):
hack_team = get_object_or_404(HackTeam, id=team_id)
hack_project = HackProject.objects.filter(hackteam=hack_team)

if hack_team.hackathon.status != 'hack_in_progress':
messages.error(request, "You currently cannot edit this project.")
return redirect(reverse('view_team', kwargs={'team_id': team_id}))

if request.method == 'POST':
if hack_project:
form = HackProjectForm(request.POST, instance=hack_project.get())
Expand Down