diff --git a/content_editor/static/content_editor/save_shortcut.js b/content_editor/static/content_editor/save_shortcut.js index dd1a08e8..70683c86 100644 --- a/content_editor/static/content_editor/save_shortcut.js +++ b/content_editor/static/content_editor/save_shortcut.js @@ -1,7 +1,7 @@ /* global django */ -django.jQuery(function ($) { +django.jQuery(($) => { $(document).keydown(function handleKeys(event) { - if (event.which == 83 && (event.metaKey || event.ctrlKey)) { + if (event.which === 83 && (event.metaKey || event.ctrlKey)) { $("form input[name=_continue]").click() return false } diff --git a/content_editor/static/content_editor/tabbed_fieldsets.js b/content_editor/static/content_editor/tabbed_fieldsets.js index 1d5f0e83..fad4bea2 100644 --- a/content_editor/static/content_editor/tabbed_fieldsets.js +++ b/content_editor/static/content_editor/tabbed_fieldsets.js @@ -1,8 +1,8 @@ /* global django */ django.jQuery(($) => { - var tabbed = $(".tabbed") + const tabbed = $(".tabbed") if (tabbed.length >= 1) { - var anchor = tabbed.eq(0) + let anchor = tabbed.eq(0) /* Break out of the .inline-related containment, avoids ugly h3's */ if (anchor.parents(".inline-related").length) { anchor = anchor.parents(".inline-related") @@ -14,14 +14,14 @@ django.jQuery(($) => { "", ) - var $tabs = $("#tabbed > .tabs"), - $modules = $("#tabbed > .modules"), - errorIndex = -1, - uncollapseIndex = -1 + const $tabs = $("#tabbed > .tabs") + const $modules = $("#tabbed > .modules") + let errorIndex = -1 + let uncollapseIndex = -1 tabbed.each(function createTabs(index) { - var $old = $(this), - $title = $old.children("h2") + const $old = $(this) + const $title = $old.children("h2") if ($old.find(".errorlist").length) { $title.addClass("has-error") @@ -41,7 +41,7 @@ django.jQuery(($) => { }) $tabs.on("click", "[data-index]", function () { - var $tab = $(this) + const $tab = $(this) if ($tab.hasClass("active")) { $tab.removeClass("active") $modules.children().addClass("content-editor-invisible") @@ -57,8 +57,8 @@ django.jQuery(($) => { }) if (errorIndex >= 0 || uncollapseIndex >= 0) { - var index = errorIndex >= 0 ? errorIndex : uncollapseIndex - $tabs.find("[data-index=" + index + "]").click() + const index = errorIndex >= 0 ? errorIndex : uncollapseIndex + $tabs.find(`[data-index=${index}]`).click() } } }) diff --git a/tests/testapp/models.py b/tests/testapp/models.py index cf9dd944..19a6a57f 100644 --- a/tests/testapp/models.py +++ b/tests/testapp/models.py @@ -11,6 +11,9 @@ class Meta: abstract = True verbose_name = "rich text" + def __str__(self): + return self.text + class Article(models.Model): title = models.CharField(max_length=200) @@ -41,6 +44,9 @@ class Meta: verbose_name = "download" verbose_name_plural = "downloads" + def __str__(self): + return self.file.name + class Thing(models.Model): """Added as inline to article admin to check whether non-ContentEditor