Skip to content

Commit

Permalink
Merge branch 'master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
Casassarnau authored Jul 27, 2020
2 parents ee332b0 + d5d2586 commit 3d92205
Show file tree
Hide file tree
Showing 29 changed files with 358 additions and 194 deletions.
2 changes: 1 addition & 1 deletion app/hackathon_variables.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@
CURRENCY = '$'
REIMBURSEMENT_EXPIRY_DAYS = 5
REIMBURSEMENT_REQUIREMENTS = 'You have to submit a project and demo it during the event in order to be reimbursed.'
REIMBURSEMENT_DEADLINE = timezone.datetime(2018, 2, 24, 3, 14, tzinfo=timezone.pytz.timezone(TIME_ZONE))
REIMBURSEMENT_DEADLINE = timezone.datetime(2028, 2, 24, 3, 14, tzinfo=timezone.pytz.timezone(TIME_ZONE))

# (OPTIONAL) Max team members. Defaults to 4
TEAMS_ENABLED = True
Expand Down
37 changes: 37 additions & 0 deletions app/static/css/main.css
Original file line number Diff line number Diff line change
Expand Up @@ -279,3 +279,40 @@ img {
hr {
margin-top: 0px;
}

@media (max-width: 1000px) {
.navbar-header {
float: none;
}
.navbar-left,.navbar-right {
float: none !important;
}
.navbar-toggle {
display: block;
}
.navbar-collapse {
border-top: 1px solid transparent;
box-shadow: inset 0 1px 0 rgba(255,255,255,0.1);
}
.navbar-fixed-top {
top: 0;
border-width: 0 0 1px;
}
.navbar-collapse.collapse {
display: none!important;
}
.navbar-nav {
float: none!important;
margin-top: 7.5px;
}
.navbar-nav>li {
float: none;
}
.navbar-nav>li>a {
padding-top: 10px;
padding-bottom: 10px;
}
.collapse.in{
display:block !important;
}
}
64 changes: 38 additions & 26 deletions app/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,14 @@

<link rel="stylesheet" href="{% static 'css/reset.css' %}">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.2.0/css/bootstrap.min.css">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/css/bootstrap.min.css">
<link href="https://fonts.googleapis.com/css?family=Roboto:300,400,500,700" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
<link rel="stylesheet" href="{% static 'css/main.css' %}">
<link rel="stylesheet" href="{% static 'lib/snackbar.min.css' %}">
<link rel="stylesheet" href="{% static 'lib/material.css' %}">
<script src="https://code.jquery.com/jquery-3.1.1.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"
integrity="sha384-Tc5IQib027qvyjSMfHjOMaLkfuWVxZxUPnCJA7l2mCWNIpG9mGCD8wGNIcPD7Txa"
crossorigin="anonymous"></script>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.4.1/js/bootstrap.min.js"></script>
<script src="{% static 'lib/snackbar.min.js' %}"></script>

{% block head %}
Expand All @@ -72,11 +70,10 @@
</script>
{% endif %}
{% block navbar %}
<nav class="navbar navbar-default navbar-fixed-top">
<div class="container">
<nav class="navbar navbar-default navbar-fixed-top navbar-expand-xl">
<div class="container container-fluid">
<div class="navbar-header">
<button type="button" class="navbar-toggle collapsed" data-toggle="collapse"
data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
<button type="button" class="navbar-toggle" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1">
<span class="sr-only">Toggle navigation</span>
<span class="icon-bar"></span>
<span class="icon-bar"></span>
Expand All @@ -88,37 +85,52 @@
<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">


<ul class="nav navbar-nav navbar-right ">
<ul class="nav navbar-nav">
{% if request.user.is_authenticated %}
{% if request.user.is_admin %}
<li class="{% if request.resolver_match.url_name == "admin:index" %}active{% endif %}"><a
href="{% url 'admin:index' %}">Admin</a></li>
{% endif %}
{% if request.user.email_verified and request.user.has_usable_password %}
{% if request.user.is_organizer %}
<li class="{% if 'stats' in request.build_absolute_uri %}active{% endif %}"><a
href="{% url 'app_stats' %}">Stats</a></li>
<li class="{% if 'applications' in request.build_absolute_uri %}active{% endif %}"><a
href="{% url 'app_list' %}">Applications</a></li>

{% if h_r_enabled %}
<li class="{% if 'reimbursement' in request.build_absolute_uri %}active{% endif %}">
<a href="{% url 'reimbursement_list' %}">Reimbursements</a></li>
{% if request.user.is_organizer or request.user.is_volunteer_accepted %}
<li class="{% if 'hacker' in request.build_absolute_uri %}active{% endif %}">
{% if request.user.is_organizer %}
<a href="{% url 'app_list' %}">Hacker</a>
{% else %}
<a href="{% url 'check_in_list' %}">Check-in</a>
{% endif %}
</li>
{% if request.user.is_organizer %}
{% if request.user.has_volunteer_access %}
<li class="{% if 'volunteer' in request.build_absolute_uri %}active{% endif %}"><a
href="{% url 'volunteer_list' %}">Volunteer</a></li>
{% endif %}
{% if request.user.has_mentor_access %}
<li class="{% if 'mentor' in request.build_absolute_uri %}active{% endif %}"><a
href="{% url 'mentor_list' %}">Mentor</a></li>
{% endif %}
{% if request.user.has_sponsor_access %}
<li class="{% if 'sponsor' in request.build_absolute_uri %}active{% endif %}"><a
href="{% url 'sponsor_user_list' %}">Sponsor</a></li>
{% endif %}
{% endif %}
{% endif %}
{% if h_hw_enabled %}
{% include 'include/hardware_tab.html' %}
{% endif %}
{% if request.user.is_organizer or request.user.is_volunteer_accepted %}
<li class="{% if 'checkin' in request.build_absolute_uri %}active{% endif %}">
<a href="{% url 'check_in_list' %}">Check-in</a></li>
{% if request.user.is_organizer %}
<li class="{% if 'stats' in request.build_absolute_uri %}active{% endif %}"><a
href="{% url 'app_stats' %}">Stats</a></li>
{% endif %}
{% endif %}
<li><a href="{% url 'account_logout' %}">Logout</a></li>

{% endif %}
</ul>
<ul class="nav navbar-nav navbar-right">
{% if request.user.is_authenticated %}
<li><a href="{% url 'account_logout' %}"><span class="glyphicon glyphicon-log-out"></span> Logout</a></li>
{% else %}
<li><a href="{% url 'account_login' %}">Sign In</a></li>
<li><a href="{% url 'account_signup' %}">Sign Up</a></li>
<li><a href="{% url 'account_login' %}"><span class="glyphicon glyphicon-log-in"></span> Sign In</a></li>
<li><a href="{% url 'account_signup' %}"><span class="glyphicon glyphicon-user"></span> Sign Up</a></li>
{% endif %}
</ul>
</div>
Expand Down
85 changes: 83 additions & 2 deletions app/templates/base_tabs.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,11 @@
<div class="row margin-top">
<div class="{% block cols-panel %}col-md-12{% endblock %}">
<div>
<ul class="nav nav-tabs">
<ul class="nav nav-tabs" id="tabs">
<li role="presentation" id="0" style="display: none" onclick="left()"><a><=</a></li>
{% for title,url,needs_action in tabs %}

<li role="presentation" {% if url in request.get_full_path %}class="active_tab action"{% endif %}>
<li role="presentation" {% if url in request.get_full_path %}class="active_tab action"{% endif %} id="{{ forloop.counter }}">

<a {% if url not in request.get_full_path %}href="{{ url }}"{% endif %}>
{{ title }}
Expand All @@ -25,6 +26,7 @@
</li>

{% endfor %}
<li role="presentation" id="-1" style="display: none" onclick="right()"><a>=></a></li>
</ul>
<div class="panel panel-default">

Expand All @@ -45,4 +47,83 @@
</div>
</div>
</div>
<script>
var ul;
var list_li;
var active = 0;
var selected = 0;
var widths = [];
function right() {
selected++;
reset();
}
function left() {
selected--;
reset();
}
function resize_tabs() {
var total_size = ul.getBoundingClientRect().width;
var actual_size = 0;
var n_visible = 0;
for (let i = 0; i<list_li.length; i++) {
if (list_li[i].style.display !== 'none') {
actual_size += list_li[i].getBoundingClientRect().width;
if (i !== 0 && i !== list_li.length-1) n_visible++;
}
}
var add_size = (total_size - actual_size)/((n_visible));
for (let i = 0; i<list_li.length; i++) {
if (i !== 0 && i !== list_li.length-1 && list_li[i].style.display !== 'none') {
list_li[i].style.width = (list_li[i].getBoundingClientRect().width + add_size) + 'px';
}
}
}
function tabs() {
if (ul.getBoundingClientRect().height > 40) {
for (let i = 0; i<list_li.length; i++) {
if (i<selected) {
list_li[i].style.display = 'none';
}
}
if (selected != 1) {
list_li[0].style.display = 'block';
}
list_li[list_li.length-1].style.display = 'block';
var deleted = false;
for (let i = list_li.length-2; i>=0; i--) {
if (ul.getBoundingClientRect().height > 40) {
list_li[i].style.display = 'none';
deleted = true;
}
}
if (!deleted) list_li[list_li.length-1].style.display = 'none';
resize_tabs();
}
}
function reset() {
for (let i = 0; i < list_li.length; i++) {
if (i === 0 || i === list_li.length-1) {
list_li[i].style.display = 'none';
} else {
list_li[i].style.display = 'block';
list_li[i].style.width = null;
}
}
tabs()
}
function init() {
ul = document.getElementById('tabs');
list_li = ul.getElementsByTagName('li');
for (let i = 0; i<list_li.length; i++) {
if (list_li[i].className) {
active = list_li[i].id;
}
widths.push(list_li[i].getBoundingClientRect().width);
}
selected = active;
tabs();
window.addEventListener('resize', reset);
}
init();
</script>
{% endblock %}
2 changes: 1 addition & 1 deletion applications/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class Meta:
tshirt_size = models.CharField(max_length=5, default=DEFAULT_TSHIRT_SIZE, choices=TSHIRT_SIZES)

def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs)
super(BaseApplication, self).__init__(*args, **kwargs)
try:
dict = args[0]['dict']
except:
Expand Down
2 changes: 1 addition & 1 deletion checkin/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def delete(self, using=None, keep_parents=False):
app = self.application
app.status = APP_CONFIRMED
app.save()
return super().delete(using, keep_parents)
return super(CheckIn, self).delete(using, keep_parents)

def type(self):
return self.application.user.get_type_display()
11 changes: 0 additions & 11 deletions checkin/tables.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
from django.db.models import Q

from applications.models import BaseApplication, SponsorApplication
from user.models import User


class ApplicationCheckinFilter(django_filters.FilterSet):
Expand Down Expand Up @@ -55,13 +54,3 @@ class Meta:
template = 'django_tables2/bootstrap-responsive.html'
fields = ['name', 'user.email']
empty_text = 'All users checked in! Yay!'


class RankingListTable(tables.Table):
class Meta:
model = User
attrs = {'class': 'table table-hover'}
template = 'django_tables2/bootstrap-responsive.html'
fields = ['email', 'checkin_count', ]
empty_text = 'No checked in hacker yet... Why? :\'('
order_by = '-checkin_count'
9 changes: 4 additions & 5 deletions checkin/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,10 @@
from checkin import views

urlpatterns = [
url(r'^all/$', views.CheckInList.as_view(), name='check_in_list'),
url(r'^ranking/$', views.CheckinRankingView.as_view(), name='check_in_ranking'),
url(r'^hacker/all/$', views.CheckInList.as_view(), name='check_in_list'),
url(r'(?P<type>[a-z_\-]{1,10})/(?P<id>[\w-]+)$', views.CheckInHackerView.as_view(),
name='check_in_hacker'),
url(r'^volunteer/$', views.CheckinVolunteerList.as_view(), name='check_in_volunteer_list'),
url(r'^mentor/$', views.CheckinMentorList.as_view(), name='check_in_mentor_list'),
url(r'^sponsor/$', views.CheckinSponsorList.as_view(), name='check_in_sponsor_list'),
url(r'^volunteer/all/$', views.CheckinVolunteerList.as_view(), name='check_in_volunteer_list'),
url(r'^mentor/all/$', views.CheckinMentorList.as_view(), name='check_in_mentor_list'),
url(r'^sponsor/all/$', views.CheckinSponsorList.as_view(), name='check_in_sponsor_list'),
]
Loading

0 comments on commit 3d92205

Please sign in to comment.