Skip to content
This repository has been archived by the owner on May 14, 2021. It is now read-only.

Commit

Permalink
Made feedback private.
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeRomaa committed Jan 21, 2021
1 parent c6c8dd7 commit f7117ea
Show file tree
Hide file tree
Showing 11 changed files with 137 additions and 125 deletions.
2 changes: 1 addition & 1 deletion apps/feedback/templates/add_feedback.html
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
{% endblock %}

{% block body %}
<form action="{% url 'new_feedback' %}" method="POST">
<form action="{% url 'feedback' %}" method="POST">
{% csrf_token %}
<div class="row">
<div class="col-md-12 col-xl-5 d-flex align-content-stretch">
Expand Down
81 changes: 0 additions & 81 deletions apps/feedback/templates/all_feedback.html

This file was deleted.

29 changes: 13 additions & 16 deletions apps/feedback/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,24 +8,16 @@
from django.utils import timezone
from django.views.decorators.http import require_POST

from zhuartcc.decorators import require_staff, require_session
from zhuartcc.decorators import require_staff
from zhuartcc.overrides import send_mail
from .models import Feedback
from ..administration.models import ActionLog
from ..event.models import Event
from ..user.models import User


def view_all_feedback(request):
return render(request, 'all_feedback.html', {
'page_title': 'Feedback',
'all_feedback': Feedback.objects.filter(approved=True),
})


@require_session
def add_feedback(request):
if request.method == 'POST':
if request.method == 'POST' and request.session.get('vatsim_data'):
feedback = Feedback(
controller=User.objects.get(cid=request.POST.get('controller')),
controller_callsign=request.POST.get('controller_callsign'),
Expand All @@ -47,12 +39,17 @@ def add_feedback(request):

return redirect(reverse('feedback'))
else:
return render(request, 'add_feedback.html', {
'page_title': 'Submit Feedback',
'controllers': User.objects.exclude(status=2).order_by('first_name'),
'events': Event.objects.filter(start__gte=timezone.now() - timedelta(days=30))
.filter(start__lte=timezone.now()).filter(hidden=False),
})
if request.session.get('vatsim_data'):
return render(request, 'add_feedback.html', {
'page_title': 'Submit Feedback',
'controllers': User.objects.exclude(status=2).order_by('first_name'),
'events': Event.objects.filter(start__gte=timezone.now() - timedelta(days=30))
.filter(start__lte=timezone.now()).filter(hidden=False),
})
else:
res = redirect('login')
res.set_cookie('redirect-from', '/feedback/')
return res


@require_staff
Expand Down
5 changes: 5 additions & 0 deletions apps/uls/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,11 @@ def login(request):
else:
return redirect('https://login.vatusa.net/uls/v2/login?fac=ZHU&url=1')

redirect_from = request.COOKIES.get('redirect-from')
if redirect_from:
res = redirect(redirect_from)
res.delete_cookie('redirect-from')
return res
return redirect(reverse('home'))


Expand Down
88 changes: 73 additions & 15 deletions apps/user/templates/profile.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,21 @@ <h4 class="alert-heading">Staff Comment</h4>
</div>
{% endif %}
<div class="row">
<div class="col-12 col-lg-6 col-xl-4">
<div class="card">
<div class="card-header">
Biography
{% if user == request.user_obj %}
<a class="float-right" onclick="editBio()">
<i class="fas fa-pencil-ruler"></i>
</a>
{% endif %}
</div>
<div class="card-body">
{{ user.biography|default:'No biography set' }}
</div>
</div>
</div>
<div class="col-12 col-lg-6 col-xl-4">
<div class="card">
<div class="card-header">User Details</div>
Expand All @@ -61,21 +76,6 @@ <h1 style="font-size: 35px">{{ user.rating }}</h1>
</div>
</div>
</div>
<div class="col-12 col-lg-6 col-xl-4">
<div class="card">
<div class="card-header">
Biography
{% if user == request.user_obj %}
<a class="float-right" onclick="editBio()">
<i class="fas fa-pencil-ruler"></i>
</a>
{% endif %}
</div>
<div class="card-body">
{{ user.biography|default:'No biography set' }}
</div>
</div>
</div>
<div class="col-12 col-xl-4">
<div class="card">
<div class="card-header">Endorsements</div>
Expand Down Expand Up @@ -187,6 +187,39 @@ <h1 style="font-size: 35px">{{ stats.total|duration|default:'<span class="text-m
</div>
</div>
</div>
{% if user_feedback %}
<div class="col-12 col-xl-6 mx-auto">
<div class="card">
<div class="card-header">Controller Feedback</div>
<div class="card-body text-center pt-1">
<table class="table table-striped" id="feedback">
<thead>
<tr>
<th class="border-0 text-center">Date / Time</th>
<th class="border-0 text-center">Callsign</th>
<th class="border-0 text-center">Rating</th>
<th class="border-0 text-center">Info</th>
</tr>
</thead>
<tbody>
{% for feedback in user_feedback %}
<tr>
<td class="text-center"><span class="d-none">{{ feedback.submitted|timestamp }}</span>{{ feedback.submitted|date:'M j, Y @ Hi\z' }}</td>
<td class="text-center">{{ feedback.controller_callsign }}</td>
<td class="text-center text-warning">{% for i in feedback.rating|as_range %}<i class="fas fa-star mr-1"></i>{% endfor %}</td>
<td class="text-center"><a data-action="info" data-comments="{{ feedback.comments }}" data-callsign="{{ feedback.flight_callsign|default:'' }}" data-event="{{ feedback.event.name }}"><i class="far fa-lg fa-eye text-dark"></i></a></td>
</tr>
{% empty %}
<tr>
<td colspan="4" class="text-center"><i>No feedback found...</i></td>
</tr>
{% endfor %}
</tbody>
</table>
</div>
</div>
</div>
{% endif %}
</div>
{% endblock %}

Expand All @@ -200,6 +233,18 @@ <h1 style="font-size: 35px">{{ stats.total|duration|default:'<span class="text-m
lengthChange: false,
order: [[ 0, "desc" ]]
})
$('#feedback').DataTable({
pageLength: 20,
lengthChange: false,
order: [[ 0, 'desc' ]],
'columns': [
null,
null,
null,
null,
{ 'orderable': false },
]
})
})
{% if request.user_obj.is_staff %}
function addComment() {
Expand Down Expand Up @@ -279,5 +324,18 @@ <h1 style="font-size: 35px">{{ stats.total|duration|default:'<span class="text-m
})
}
{% endif %}
$('[data-action="info"]').click(function() {
let callsign = $(this).data('callsign')
let event = $(this).data('event')
let comments = $(this).data('comments')
launchCustomModal(
'info',
'Info',
(callsign ? '<h5>Pilot Callsign</h5><p>' : '') + callsign + (callsign ? '</p>' : '') +
(event ? '<h5>Event</h5><p>' : '') + event + (event ? '</p>' : '') +
'<h5>Comments</h5><p>' + comments + '</p>' +
'<div class="mt-3"><button class="btn btn-secondary" data-dismiss="modal">Close</button></div>'
)
})
</script>
{% endblock %}
2 changes: 1 addition & 1 deletion apps/user/templates/roster.html
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ <h3 class="heading-row text-primary my-4">{{ level }}</h3>
<img class="rounded-circle mb-2" src="{% if user.profile_picture %}{{ user.profile_picture.url }}{% else %}{% static 'img/placeholder-profile.png' %}{% endif %}" height="60px">
<h5><a href="{% url 'view_user' cid=user.cid %}">{{ user.full_name }} ({{ user.oper_init }})</a> {% if user.status == 1 %}<span class="badge bg-primary">LOA</span>{% endif %}</h5>
{% if request.user_obj.is_staff or request.user_obj.is_mentor %}
<a href="{% url 'edit_user' cid=user.cid %}"><i class="far fa-pencil-ruler"></i></a> &nbsp; &nbsp; <a href=""><i class="far fa-envelope"></i></a>
<a href="{% url 'edit_user' cid=user.cid %}"><i class="far fa-pencil-ruler"></i></a>
{% endif %}
</div>
<div class="card-body">
Expand Down
10 changes: 8 additions & 2 deletions apps/user/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
from ..administration.models import ActionLog
from ..api.models import ControllerSession
from ..api.views import return_inactive_users
from ..feedback.models import Feedback


# Gets all staff members from local database and serves 'staff.html' file
Expand Down Expand Up @@ -92,12 +93,17 @@ def view_profile(request, cid):
total=Sum('duration'),
)

return render(request, 'profile.html', {
context = {
'page_title': user.full_name,
'user': user,
'stats': stats,
'connections': connections,
})
}

if request.user_obj and (request.user_obj.is_staff or request.user_obj.is_mentor or request.user_obj == user):
context['user_feedback'] = Feedback.objects.filter(controller=user).filter(approved=True)

return render(request, 'profile.html', context)


# Gets specified user from local database and serves 'editUser.html' file. Overrides user info with form data on POST
Expand Down
19 changes: 13 additions & 6 deletions static/css/index.css
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ body {
overflow: overlay;
}
h1 {
font: 100px Gilroy-ExtraBold, Helvetica, sans-serif;
font: 100px Gilroy-Bold, Helvetica, sans-serif;
}
h2 {
font: 30px Gilroy-Light, Helvetica, sans-serif;
Expand Down Expand Up @@ -160,7 +160,7 @@ a:hover {
line-height: 80px;
}
.heading-row {
font: 40px Gilroy-ExtraBold, Helvetica, sans-serif;
font: 40px Gilroy-Bold, Helvetica, sans-serif;
}
.heading-row::before,
.heading-row::after {
Expand Down Expand Up @@ -984,7 +984,7 @@ dP dP `88888P8 8888P' dP `8888P88 `88888P8 dP dP `88888P' dP dP
position: fixed;
z-index: 2;
right: 30px;
top: 30px;
top: 40px;
cursor: pointer;
}
.nav-hamburger span {
Expand All @@ -995,6 +995,9 @@ dP dP `88888P8 8888P' dP `8888P88 `88888P8 dP dP `88888P' dP dP
margin-bottom: 4px;
transition: transform .2s ease, background-color .5s ease;
}
.shrink .nav-hamburger span {
background-color: #333333;
}
.nav-hamburger span:nth-child(1) {
width: 15px;
}
Expand Down Expand Up @@ -1026,20 +1029,24 @@ dP dP `88888P8 8888P' dP `8888P88 `88888P8 dP dP `88888P' dP dP
position: fixed;
top: 50%;
transform: translate(0%, -50%);
width: 100%;
width: 90%;
text-align: center;
font-size: calc(2vw + 10px);
font-weight: 200;
cursor: pointer;
}
.mobile-nav-list {
display: flex;
flex-direction: column;
}
.mobile-nav-list-item {
position: relative;
display: inline-block;
transition-delay: 0.8s;
opacity: 0;
transform: translate(0%, 100%);
transition: opacity .2s ease, transform .3s ease;
margin-right: 25px;
margin-bottom: 25px;
}
.mobile-nav-list-item:before {
content: '';
Expand All @@ -1053,7 +1060,7 @@ dP dP `88888P8 8888P' dP `8888P88 `88888P8 dP dP `88888P' dP dP
z-index: -1;
}
.mobile-nav-list-item:hover:before {
width: 100%;
width: 20%;
}
body.nav-active {
position: fixed;
Expand Down
2 changes: 1 addition & 1 deletion static/css/index.min.css

Large diffs are not rendered by default.

Loading

0 comments on commit f7117ea

Please sign in to comment.