Skip to content

Commit

Permalink
Fix warnings
Browse files Browse the repository at this point in the history
  • Loading branch information
matthiask committed May 31, 2024
1 parent fe3d42d commit 37997af
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 13 deletions.
4 changes: 2 additions & 2 deletions content_editor/static/content_editor/save_shortcut.js
Original file line number Diff line number Diff line change
@@ -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
}
Expand Down
22 changes: 11 additions & 11 deletions content_editor/static/content_editor/tabbed_fieldsets.js
Original file line number Diff line number Diff line change
@@ -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")
Expand All @@ -14,14 +14,14 @@ django.jQuery(($) => {
"</div>",
)

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")
Expand All @@ -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")
Expand All @@ -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()
}
}
})
6 changes: 6 additions & 0 deletions tests/testapp/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 37997af

Please sign in to comment.