Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
concrexit
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
70
Issues
70
List
Boards
Labels
Service Desk
Milestones
Merge Requests
10
Merge Requests
10
Operations
Operations
Incidents
Analytics
Analytics
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
thalia
concrexit
Commits
e7b0b2a8
Verified
Commit
e7b0b2a8
authored
Jun 26, 2019
by
Sébastiaan Versteeg
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add sentry user feedback modal
parent
3651c4a3
Changes
7
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
116 additions
and
2 deletions
+116
-2
website/thaliawebsite/settings/settings.py
website/thaliawebsite/settings/settings.py
+3
-0
website/thaliawebsite/static/css/_modals.scss
website/thaliawebsite/static/css/_modals.scss
+6
-0
website/thaliawebsite/static/css/main.scss
website/thaliawebsite/static/css/main.scss
+1
-0
website/thaliawebsite/static/js/sentry.js
website/thaliawebsite/static/js/sentry.js
+27
-0
website/thaliawebsite/templates/500.html
website/thaliawebsite/templates/500.html
+63
-2
website/thaliawebsite/urls.py
website/thaliawebsite/urls.py
+4
-0
website/thaliawebsite/views.py
website/thaliawebsite/views.py
+12
-0
No files found.
website/thaliawebsite/settings/settings.py
View file @
e7b0b2a8
...
...
@@ -296,6 +296,9 @@ GOOGLE_MAPS_API_KEY = os.environ.get('GOOGLE_MAPS_API_KEY', '')
GOOGLE_MAPS_API_SECRET
=
os
.
environ
.
get
(
'GOOGLE_MAPS_API_SECRET'
,
''
)
GOOGLE_PLACES_API_KEY
=
os
.
environ
.
get
(
'GOOGLE_PLACES_API_KEY'
,
''
)
# Sentry settings
SENTRY_API_ROOT
=
os
.
environ
.
get
(
'SENTRY_API_ROOT'
,
''
)
# Photos settings
PHOTO_UPLOAD_SIZE
=
1920
,
1080
...
...
website/thaliawebsite/static/css/_modals.scss
0 → 100644
View file @
e7b0b2a8
.modal
{
.modal-content
{
border
:
none
;
border-radius
:
0
;
}
}
website/thaliawebsite/static/css/main.scss
View file @
e7b0b2a8
...
...
@@ -12,6 +12,7 @@
@import
"alerts"
;
@import
"navs"
;
@import
"progress"
;
@import
"modals"
;
@import
"./base.scss"
;
@import
"../../announcements/static/announcements/css/style.scss"
;
...
...
website/thaliawebsite/static/js/sentry.js
0 → 100644
View file @
e7b0b2a8
$
(
function
()
{
$
(
'
#feedback-modal
'
).
modal
(
'
show
'
);
$
(
'
#feedback-form
'
).
on
(
'
submit
'
,
function
(
e
)
{
e
.
preventDefault
();
const
formEl
=
document
.
getElementById
(
'
feedback-form
'
);
$
.
ajax
({
url
:
formEl
.
dataset
.
api
+
'
user-feedback/
'
,
type
:
'
POST
'
,
mode
:
"
no-cors
"
,
data
:
JSON
.
stringify
({
"
comments
"
:
$
(
'
#feedback-body
'
).
val
(),
"
email
"
:
formEl
.
dataset
.
email
,
"
event_id
"
:
formEl
.
dataset
.
event
,
"
name
"
:
formEl
.
dataset
.
name
}),
headers
:
{
'
Authorization
'
:
'
DSN
'
+
formEl
.
dataset
.
dsn
,
'
Content-Type
'
:
'
application/json
'
},
});
$
(
this
).
modal
(
'
dispose
'
);
});
});
website/thaliawebsite/templates/500.html
View file @
e7b0b2a8
{% extends "error.html" %}
{% load i18n %}
{% load i18n
static
%}
{% block error_message %}{% trans "500: Internal server error. Thalia's website committee has been notified." %}{% endblock %}
{% block error_message %}
{% trans "500: Internal server error. Thalia's website committee has been notified." %}{% endblock %}
{% block body %}
{{ block.super }}
{% if request.user.is_authenticated %}
<div
class=
"modal fade"
id=
"feedback-modal"
>
<div
class=
"modal-dialog"
role=
"document"
>
<form
id=
"feedback-form"
data-dsn=
"{{ sentry_dsn }}"
data-event=
"{{ sentry_event_id }}"
data-api=
"{{ sentry_api_root }}"
data-name=
"{{ request.user.username }}"
data-email=
"{{ request.user.email }}"
method=
"post"
>
<div
class=
"modal-content"
>
<div
class=
"modal-header"
>
<h5
class=
"modal-title"
id=
"exampleModalLabel"
>
{% trans 'Help us fix this problem' %}
</h5>
</div>
<div
class=
"modal-body"
>
<p>
{% blocktrans trimmed %}
Please provide us with some information so that
we can easily fix the problem that you just
encountered.
Any description of the steps you took to get
into this situation would be of tremendous
worth.
{% endblocktrans %}
</p>
<div
class=
"form-group"
>
<textarea
class=
"form-control"
id=
"feedback-body"
rows=
"5"
placeholder=
"{% trans "
Jot
down
your
feedback
here
"
%}..."
></textarea>
</div>
</div>
<div
class=
"modal-footer"
>
<button
type=
"button"
class=
"btn btn-secondary"
data-dismiss=
"modal"
>
{% trans 'Close' %}
</button>
<input
type=
"submit"
value=
"{% trans 'Send feedback' %}"
class=
"btn btn-primary"
/>
</div>
</div>
</form>
</div>
</div>
{% endif %}
{% endblock %}
{% block js_body %}
{{ block.super }}
<script
src=
"{% static 'js/sentry.js' %}"
type=
"text/javascript"
></script>
{% endblock %}
website/thaliawebsite/urls.py
View file @
e7b0b2a8
...
...
@@ -48,6 +48,7 @@ from members.sitemaps import sitemap as members_sitemap
from
members.views
import
ObtainThaliaAuthToken
from
partners.sitemaps
import
sitemap
as
partners_sitemap
from
thabloid.sitemaps
import
sitemap
as
thabloid_sitemap
from
thaliawebsite
import
views
from
thaliawebsite.forms
import
AuthenticationForm
from
thaliawebsite.views
import
(
PrivacyPolicyView
,
EventTermsView
,
...
...
@@ -72,10 +73,13 @@ THALIA_SITEMAP.update(partners_sitemap)
THALIA_SITEMAP
.
update
(
education_sitemap
)
THALIA_SITEMAP
.
update
(
events_sitemap
)
handler500
=
'thaliawebsite.views.sentry_500handler'
# pragma pylint: disable=line-too-long
urlpatterns
=
[
# pylint: disable=invalid-name
url
(
r'^admin/'
,
admin
.
site
.
urls
),
path
(
''
,
IndexView
.
as_view
(),
name
=
'index'
),
path
(
'500/'
,
views
.
sentry_500handler
,
name
=
'500error'
),
path
(
'privacy-policy/'
,
PrivacyPolicyView
.
as_view
(),
name
=
'privacy-policy'
),
path
(
'event-registration-terms/'
,
EventTermsView
.
as_view
(),
name
=
'event-registration-terms'
),
path
(
'alumni/'
,
AlumniEventsView
.
as_view
(),
name
=
'alumni'
),
...
...
website/thaliawebsite/views.py
View file @
e7b0b2a8
"""General views for the website"""
import
os
from
django.contrib.admin.views.decorators
import
staff_member_required
from
django.contrib.auth.decorators
import
login_required
from
django.http
import
(
HttpResponseForbidden
,
HttpResponse
)
from
django.shortcuts
import
render
from
django.utils.decorators
import
method_decorator
from
django.views.generic
import
TemplateView
from
django.views.generic.base
import
View
from
django.conf
import
settings
from
sentry_sdk
import
last_event_id
class
IndexView
(
TemplateView
):
...
...
@@ -51,3 +55,11 @@ class TestCrashView(View):
if
not
request
.
user
.
is_superuser
:
return
HttpResponseForbidden
(
"This is not for you"
)
raise
Exception
(
"Test exception"
)
def
sentry_500handler
(
request
,
*
args
,
**
argv
):
return
render
(
request
,
"500.html"
,
{
'sentry_event_id'
:
'213'
,
#last_event_id(),
'sentry_dsn'
:
'https://f5dc3689093e438eb574a090c7cae63d@sentry.io/1463433'
,
#os.environ.get('SENTRY_DSN'),
'sentry_api_root'
:
settings
.
SENTRY_API_ROOT
},
status
=
500
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment