Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
EvaP
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
CourseEval
EvaP
Commits
7f50b907
Unverified
Commit
7f50b907
authored
3 years ago
by
Niklas Mohrin
Browse files
Options
Downloads
Patches
Plain Diff
`./manage.py format`, I added the brackets myself though
parent
84d8969f
No related branches found
No related tags found
No related merge requests found
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
evap/static/ts/src/base-template.ts
+1
-1
1 addition, 1 deletion
evap/static/ts/src/base-template.ts
evap/static/ts/src/student-vote.ts
+8
-5
8 additions, 5 deletions
evap/static/ts/src/student-vote.ts
with
9 additions
and
6 deletions
evap/static/ts/src/base-template.ts
+
1
−
1
View file @
7f50b907
// This file contains all typescript code for the base.html template.
// Fix autofocus on bootstrap modals -> Focus the first element with `autofocus` attribute
document
.
addEventListener
(
"
shown.bs.modal
"
,
(
e
)
=>
{
document
.
addEventListener
(
"
shown.bs.modal
"
,
e
=>
{
if
(
!
e
.
target
)
return
;
const
modalEl
=
e
.
target
as
HTMLElement
;
const
autofocusEl
=
modalEl
.
querySelector
(
"
[autofocus]
"
)
as
HTMLElement
;
...
...
This diff is collapsed.
Click to expand it.
evap/static/ts/src/student-vote.ts
+
8
−
5
View file @
7f50b907
function
isInvisible
(
el
:
Element
):
boolean
{
if
(
getComputedStyle
(
el
).
display
===
"
none
"
)
if
(
getComputedStyle
(
el
).
display
===
"
none
"
)
{
return
true
;
}
return
el
.
parentElement
!==
null
&&
isInvisible
(
el
.
parentElement
);
}
...
...
@@ -22,7 +23,7 @@ function selectByNumberKey(row: HTMLElement, num: number) {
const
studentForm
=
document
.
getElementById
(
"
student-vote-form
"
)
as
HTMLElement
;
const
selectables
:
NodeListOf
<
HTMLElement
>
=
studentForm
.
querySelectorAll
(
"
.tab-selectable
"
);
const
rows
=
Array
.
from
(
studentForm
.
getElementsByClassName
(
"
tab-row
"
))
as
Array
<
HTMLElement
>
;
const
letterRegex
=
new
RegExp
(
"
^[A-Za-zÄÖÜäöü
\
.
\
*
\
+
\
-]$
"
);
const
letterRegex
=
new
RegExp
(
"
^[A-Za-zÄÖÜäöü
.*+
-]$
"
);
// Sometimes we just want the browser to do it's thing.
let
disableFocusHandler
=
false
;
...
...
@@ -90,15 +91,17 @@ studentForm.addEventListener("keydown", (e: KeyboardEvent) => {
if
(
e
.
key
!==
"
Tab
"
)
{
if
(
current
.
tagName
!==
"
TEXTAREA
"
&&
letterRegex
.
test
(
e
.
key
))
{
const
wholeRow
=
currentRow
.
closest
(
"
div.row
"
);
if
(
wholeRow
===
null
)
if
(
wholeRow
===
null
)
{
return
;
}
e
.
preventDefault
();
const
textAnswerButton
:
HTMLElement
|
null
=
wholeRow
.
querySelector
(
"
[data-bs-toggle=
\
"
collapse
\
"
]
"
);
const
textAnswerButton
:
HTMLElement
|
null
=
wholeRow
.
querySelector
(
'
[data-bs-toggle="collapse"]
'
);
const
textField
:
HTMLTextAreaElement
|
null
=
wholeRow
.
querySelector
(
"
textarea.tab-selectable
"
);
if
(
textAnswerButton
!==
null
&&
textField
!==
null
)
{
if
(
isInvisible
(
textField
))
if
(
isInvisible
(
textField
))
{
textAnswerButton
.
click
();
}
fancyFocus
(
textField
);
textField
.
value
+=
e
.
key
;
textField
.
dispatchEvent
(
new
Event
(
"
input
"
));
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment