-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Improved contrast course admin assignment and editor * Fixed missing labels and iframe title * wrapped in fieldset * Fixed Empty header * Empty table header fix, and added missing label to search field * Fixed language not being set * Added link icon to link * Removed redundant login button * Removed django.middleware.clickjacking.XFrameOptionsMiddleware * Added the ability to hide courses from students * Hopefully fixed 145 * Statics view optimization * redirect url cleanup * (re-)moved some inline styling (#146) * added and improved translation for add admin (#148) * moved more inline styling (#146) * Move inline javascript to own file * removed «Print this page» (#146) * Moved out inline styles * Replace inline style with correct css classes * Fixed #149 * added `TRIX_VERSION` template variable * releasing Trix 4.1.0 --------- Co-authored-by: Levijatan <[email protected]>
- Loading branch information
Showing
46 changed files
with
1,002 additions
and
147 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import trix | ||
|
||
|
||
def template_variables(request): | ||
template_variables_dict = { | ||
'TRIX_VERSION': trix.__version__ | ||
} | ||
return template_variables_dict |
Empty file.
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,84 @@ | ||
import os | ||
from django.core.management.base import BaseCommand, CommandParser | ||
from itertools import cycle | ||
from trix.trix_core import models as trix_models | ||
|
||
|
||
DJANGOENV = os.environ.get('DJANGOENV', 'develop') | ||
|
||
if DJANGOENV == 'develop': # Used for local development | ||
from model_bakery import baker | ||
from model_bakery.recipe import Recipe, seq | ||
GENERATED_USER_EMAIL = 'generated_user_email' | ||
TEST_TAG_NAME = 'generate_course' | ||
|
||
UserRecipe = Recipe(trix_models.User, email=seq(GENERATED_USER_EMAIL, suffix='@example.com')) | ||
|
||
class Command(BaseCommand): | ||
help = "Generate a new course with n number of assignments" | ||
|
||
def add_arguments(self, parser: CommandParser) -> None: | ||
parser.add_argument( | ||
'-n', | ||
type=int, | ||
help='Number of assignments to generate, defaults to 5', | ||
default=5 | ||
) | ||
parser.add_argument( | ||
'--clean', | ||
action='store_true', | ||
help='Clean the database of courses generated by this command' | ||
) | ||
parser.add_argument( | ||
'-b', | ||
type=int, | ||
help='Number of "bymyself" Howsolved objects and the corresponding users to generate, defaults to 5', | ||
default=5 | ||
) | ||
parser.add_argument( | ||
'-w', | ||
type=int, | ||
help='Number of "withhelp" Howsolved objects and the corresponding users to generate, defaults to 5', | ||
default=5 | ||
) | ||
parser.add_argument( | ||
'-s', | ||
type=int, | ||
help='Number of users who has not solved to generate, defaults to 5', | ||
default=5 | ||
) | ||
|
||
def _generate_howsolved_objects(self, howsolved, users, assignments, n): | ||
for a in assignments: | ||
baker.make( | ||
trix_models.HowSolved, | ||
howsolved=howsolved, | ||
user=cycle(users), | ||
assignment=a, | ||
_quantity=n | ||
) | ||
|
||
def handle(self, *args, **options) -> None: | ||
if options['clean']: | ||
queryset = trix_models.Course.objects.filter(active_period__tag=TEST_TAG_NAME) | ||
course_tags = queryset.values_list('course_tag__id', flat=True) | ||
trix_models.Tag.objects.filter(id__in=course_tags).delete() | ||
queryset.delete() | ||
trix_models.Assignment.objects.filter(tags__tag=TEST_TAG_NAME).delete() | ||
trix_models.Tag.objects.filter(tag=TEST_TAG_NAME).delete() | ||
trix_models.User.objects.filter(email__startswith=GENERATED_USER_EMAIL).delete() | ||
else: | ||
tag, _ = trix_models.Tag.objects.get_or_create( | ||
tag=TEST_TAG_NAME, defaults={'category': 'p'} | ||
) | ||
course = baker.make(trix_models.Course, active_period=tag) | ||
|
||
assignments = baker.make(trix_models.Assignment, tags=[tag, course.course_tag], _quantity=options['n']) | ||
|
||
bymyself_users = UserRecipe.make(_quantity=options['b']) | ||
withhelp_users = UserRecipe.make(_quantity=options['w']) | ||
notsolved_users = UserRecipe.make(_quantity=options['s']) | ||
|
||
self._generate_howsolved_objects('bymyself', bymyself_users, assignments, options['b']) | ||
self._generate_howsolved_objects('withhelp', withhelp_users, assignments, options['w']) | ||
self._generate_howsolved_objects('notsolved', notsolved_users, assignments, options['s']) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
$(function () { | ||
$('#datetimepicker').datetimepicker({ | ||
format: 'YYYY-MM-DD' | ||
}); | ||
$('#datetimepicker2').datetimepicker({ | ||
format: 'YYYY-MM-DD', | ||
useCurrent: false //Important! See issue #1075 | ||
}); | ||
$("#datetimepicker").on("dp.change", function (e) { | ||
$('#datetimepicker2').data("DateTimePicker").minDate(e.date); | ||
}); | ||
$("#datetimepicker2").on("dp.change", function (e) { | ||
$('#datetimepicker').data("DateTimePicker").maxDate(e.date); | ||
}); | ||
}); |
41 changes: 41 additions & 0 deletions
41
...lates/cradmin_legacy/pagepreview/includes/pagepreview-fullsize-iframe-wrapper.django.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
{% load i18n %} | ||
{% load cradmin_legacy_icon_tags %} | ||
{% comment %} | ||
Include template used to show an embedded iframe floating above | ||
the page with a close button. This renders the | ||
``cradmin-legacy-floating-fullsize-iframe-wrapper`` AngularJS directive | ||
components with some extra components to make it stylable and accessible. | ||
|
||
Example:: | ||
|
||
<div cradmin-legacy-page-preview-wrapper> | ||
{% include "cradmin_legacy/pagepreview/includes/pagepreview.django.html" %} | ||
<div cradmin-legacy-page-preview-open-on-page-load="'{{ preview_url }}'"></div> | ||
</div> | ||
|
||
{% endcomment %} | ||
|
||
<div class="cradmin-legacy-floating-fullsize-iframe-wrapper" | ||
cradmin-legacy-page-preview-iframe-wrapper> | ||
<a href="#" class="cradmin-legacy-floating-fullsize-iframe-closebutton" | ||
cradmin-legacy-page-preview-iframe-closebutton> | ||
<span aria-hidden="true" | ||
class="{% cradmin_icon 'close-overlay-right-to-left' %} | ||
cradmin-legacy-floating-fullsize-iframe-closebutton-icon"></span> | ||
<span class="sr-only">{% trans "Close preview" %}</span> | ||
</a> | ||
<div class="cradmin-legacy-floating-fullsize-content"> | ||
<div class="ng-hide cradmin-legacy-floating-fullsize-loadspinner" | ||
cradmin-legacy-page-preview-load-spinner> | ||
<span class="{% cradmin_icon 'loadspinner' %}"></span> | ||
</div> | ||
<nav class="cradmin-legacy-floating-fullsize-iframe-navbar" | ||
cradmin-legacy-page-preview-navbar | ||
cradmin-legacy-page-preview-navbar-mobile-menu-header="{% trans 'Preview options' %}"> | ||
</nav> | ||
<div class="cradmin-legacy-floating-fullsize-iframe-inner" | ||
cradmin-legacy-page-preview-iframe-wrapper-inner> | ||
<iframe cradmin-legacy-page-preview-iframe title="preview"></iframe> | ||
</div> | ||
</div> | ||
</div> |
2 changes: 2 additions & 0 deletions
2
trix/trix_admin/templates/cradmin_legacy/standalone-base.django.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.