Skip to content

Commit

Permalink
Merge pull request #59 from Elthan/master
Browse files Browse the repository at this point in the history
CSV bug fix, CSS updates, and Error pages
  • Loading branch information
torgeirl committed Aug 6, 2018
2 parents 225e4cb + e031f71 commit 4ea0e33
Show file tree
Hide file tree
Showing 26 changed files with 485 additions and 518 deletions.
3 changes: 3 additions & 0 deletions trix/project/default/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@
'django.contrib.sessions.middleware.SessionMiddleware',
'django.middleware.common.CommonMiddleware',
'django.middleware.csrf.CsrfViewMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
'django.contrib.auth.middleware.AuthenticationMiddleware',
'django.contrib.messages.middleware.MessageMiddleware',
'django.middleware.clickjacking.XFrameOptionsMiddleware',
Expand All @@ -69,6 +70,8 @@
USE_L10N = True
USE_TZ = True

# https://docs.djangoproject.com/en/1.11/ref/clickjacking/
# X_FRAME_OPTIONS = 'DENY'

# Setup static files to be served at /s/.
# - Gives us short urls for angular apps (I.E.: /s/v1/).
Expand Down
1 change: 0 additions & 1 deletion trix/project/production/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
ROOT_URLCONF = 'trix.project.production.urls'

DEBUG = False
TEMPLATE_DEBUG = False
LANGUAGE_CODE = 'nb'

# Database
Expand Down
Binary file modified trix/trix_admin/locale/nb/LC_MESSAGES/django.mo
Binary file not shown.
12 changes: 6 additions & 6 deletions trix/trix_admin/locale/nb/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: trix_admin\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-01 19:59+0200\n"
"POT-Creation-Date: 2018-08-03 19:26+0200\n"
"PO-Revision-Date: 2015-01-08 12:35+0100\n"
"Last-Translator: Espen Angell Kristiansen <post@espenak.net>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -211,7 +211,7 @@ msgstr "Slett tag"
msgid "Type in the tag you want to remove from the selected assignments"
msgstr "Skriv inn taggen du vil fjerne fra valgte oppgaver"

#: trix/trix_admin/views/roleselect.py:7
#: trix/trix_admin/views/roleselect.py:9
msgid "Select a course"
msgstr "Velg et kurs"

Expand All @@ -237,18 +237,18 @@ msgstr "Prosent"
msgid "Number"
msgstr "Antall"

#: trix/trix_admin/views/statistics.py:202
#: trix/trix_admin/views/statistics.py:208
msgid "Title"
msgstr "Tittel"

#: trix/trix_admin/views/statistics.py:203
#: trix/trix_admin/views/statistics.py:209
msgid "Date created"
msgstr "Dato opprettet"

#: trix/trix_admin/views/statistics.py:204
#: trix/trix_admin/views/statistics.py:210
msgid "Last updated"
msgstr "Sist oppdatert"

#: trix/trix_admin/views/statistics.py:233
#: trix/trix_admin/views/statistics.py:239
msgid "Number of assignments"
msgstr "Antall oppgaver"
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ <h1>{% trans "Aggregated statistics on how the assignments where solved" %}</h1>
<span class="btn trix-sort-button">
{% order_in_use order sort_list as is_negative %}
<a href="?{% url_replace 'ordering' '' %}"
style="float: left;{% if order not in sort_list %}visibility:hidden;{% endif %}">
style="{% if order not in sort_list %}visibility:hidden;{% endif %}">
<span class="fa fa-times"></span>
</a>
<a class="btn btn-link"
Expand Down
8 changes: 8 additions & 0 deletions trix/trix_admin/views/roleselect.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from django.conf import settings
from django.utils.translation import ugettext_lazy as _
from django.core.exceptions import PermissionDenied

from cradmin_legacy.views import roleselect


Expand All @@ -13,3 +15,9 @@ def get_context_data(self, **kwargs):
context['TRIX_ADMIN_DOCUMENTATION_URL'] = settings.TRIX_ADMIN_DOCUMENTATION_URL
context['TRIX_ADMIN_DOCUMENTATION_LABEL'] = settings.TRIX_ADMIN_DOCUMENTATION_LABEL
return context

def get(self, request):
if request.user.is_admin_on_anything():
return super(TrixRoleSelectView, self).get(request)
else:
raise PermissionDenied
8 changes: 7 additions & 1 deletion trix/trix_admin/views/statistics.py
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ def get(self, request, *args, **kwargs):

try:
response['Content-Disposition'] = 'attachment; filename="trix-statistics.csv"'
csvwriter = UnicodeWriter(response, dialect='semicolons', encoding="utf-8")
csvwriter = UnicodeWriter(response, dialect='semicolons', encoding="utf-16")
csvwriter.writerow([_('Simple statistics showing percentage share of how the '
'assignments where solved')])
csvwriter.writerow([_('Total number of users'), str(user_count)])
Expand Down Expand Up @@ -164,6 +164,12 @@ def get(self, request, *args, **kwargs):
raise e
return response

def get_queryset(self):
queryset = trix_models.Assignment.objects.all().order_by('title')
for tagstring in self.tags:
queryset = queryset.filter(tags__tag=tagstring)
return queryset


class StatisticsChartView(AssignmentStatsMixin, ListView):
"""
Expand Down
Binary file modified trix/trix_core/locale/nb/LC_MESSAGES/django.mo
Binary file not shown.
5 changes: 1 addition & 4 deletions trix/trix_core/locale/nb/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: trix_core\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-01 19:59+0200\n"
"POT-Creation-Date: 2018-08-03 19:26+0200\n"
"PO-Revision-Date: 2014-12-21 22:43+0100\n"
"Last-Translator: Tor Ivar Johansen <tor@appresso.no>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand Down Expand Up @@ -185,6 +185,3 @@ msgid ""
msgstr ""
"En eller flere av den gitte IDen ble ikke funnet blant oppgavene "
"tilgjengelig via \"%(course_tag)s\"."

#~ msgid "Is admin?"
#~ msgstr "Er admin?"
2 changes: 1 addition & 1 deletion trix/trix_core/templatetags/trix_core_tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,9 @@ def url_replace(context, field, value):
pass
else:
dict_[field] = value
print(dict_)
return dict_.urlencode()


@register.filter
def add_string_list(string_list, item):
return string_list + ',' + item
Binary file modified trix/trix_student/locale/nb/LC_MESSAGES/django.mo
Binary file not shown.
31 changes: 20 additions & 11 deletions trix/trix_student/locale/nb/LC_MESSAGES/django.po
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ msgid ""
msgstr ""
"Project-Id-Version: trix_student\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2018-08-01 19:59+0200\n"
"POT-Creation-Date: 2018-08-03 19:26+0200\n"
"PO-Revision-Date: 2015-01-03 17:40+0100\n"
"Last-Translator: Espen Angell Kristiansen <post@espenak.net>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
Expand All @@ -18,6 +18,22 @@ msgstr ""
"Plural-Forms: nplurals=2; plural=(n != 1);\n"
"X-Generator: Poedit 1.6.5\n"

#: trix/trix_student/templates/400.html:11
msgid "Bad request!"
msgstr "Dårlig forespørsel!"

#: trix/trix_student/templates/403.html:11
msgid "You do not have access to this page!"
msgstr "Du har ikke tilgang til denne siden!"

#: trix/trix_student/templates/404.html:11
msgid "The page could not be found!"
msgstr "Fant ikke siden!"

#: trix/trix_student/templates/500.html:11
msgid "Something went wrong!"
msgstr "Noe gikk galt!"

#: trix/trix_student/templates/trix_student/assignment_list_base.django.html:5
#: trix/trix_student/templates/trix_student/assignments.django.html:3
#: trix/trix_student/templates/trix_student/assignments.django.html:8
Expand All @@ -38,8 +54,6 @@ msgid "Filter"
msgstr "Filtrer"

#: trix/trix_student/templates/trix_student/assignment_list_base.django.html:61
#, fuzzy
#| msgid "Filter"
msgid "Filter out"
msgstr "Filtrer"

Expand Down Expand Up @@ -182,16 +196,16 @@ msgstr "Profil"
msgid "Sign out"
msgstr "Logg ut"

#: trix/trix_student/templates/trix_student/include/pager.django.html:33
#: trix/trix_student/templates/trix_student/include/pager.django.html:32
msgid "Previous"
msgstr "Forrige"

#: trix/trix_student/templates/trix_student/include/pager.django.html:37
#: trix/trix_student/templates/trix_student/include/pager.django.html:36
#, python-format
msgid "Page %(number)s of %(total)s"
msgstr "Side %(number)s av %(total)s"

#: trix/trix_student/templates/trix_student/include/pager.django.html:46
#: trix/trix_student/templates/trix_student/include/pager.django.html:45
msgid "Next"
msgstr "Neste"

Expand Down Expand Up @@ -229,8 +243,6 @@ msgid "All the permalinks created are listed below"
msgstr "Under listes alle permalinker opp"

#: trix/trix_student/templates/trix_student/users.django.html:6
#, fuzzy
#| msgid "Username"
msgid "User"
msgstr "Brukernavn"

Expand Down Expand Up @@ -284,6 +296,3 @@ msgstr "Administrator for "
#: trix/trix_student/views/users.py:30
msgid "Student"
msgstr "Student"

#~ msgid "Superuser panel"
#~ msgstr "Superbruker panel"

0 comments on commit 4ea0e33

Please sign in to comment.