Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
WSR Website
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
Sofiane Lasri
WSR Website
Commits
d7b58858
Commit
d7b58858
authored
1 year ago
by
Sofiane Lasri
Browse files
Options
Downloads
Patches
Plain Diff
Ajout des vidéos dans les types de courses.
parent
661d7cbf
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
WSR/models.py
+1
-0
1 addition, 0 deletions
WSR/models.py
WSR/static/scss/components.scss
+1
-1
1 addition, 1 deletion
WSR/static/scss/components.scss
WSR/templates/race-types.html
+47
-2
47 additions, 2 deletions
WSR/templates/race-types.html
with
49 additions
and
3 deletions
WSR/models.py
+
1
−
0
View file @
d7b58858
...
...
@@ -34,6 +34,7 @@ class RaceType(models.Model):
description
=
models
.
TextField
(
default
=
""
,
blank
=
True
)
icon
=
models
.
ImageField
(
upload_to
=
'
racetypes
'
,
default
=
""
,
blank
=
True
,
verbose_name
=
"
Logo d
'
illustration
"
)
image
=
models
.
ImageField
(
upload_to
=
'
racetypes
'
,
default
=
""
,
blank
=
True
,
verbose_name
=
"
Image d
'
illustration
"
)
video
=
models
.
FileField
(
upload_to
=
'
racetypes
'
,
default
=
""
,
blank
=
True
,
verbose_name
=
"
Vidéo de démonstration
"
)
def
__str__
(
self
):
return
self
.
name
...
...
This diff is collapsed.
Click to expand it.
WSR/static/scss/components.scss
+
1
−
1
View file @
d7b58858
...
...
@@ -282,7 +282,7 @@ footer {
margin-bottom
:
map-get
(
$spacers
,
2
);
width
:
100%
;
img
{
img
,
video
{
width
:
inherit
;
}
}
...
...
This diff is collapsed.
Click to expand it.
WSR/templates/race-types.html
+
47
−
2
View file @
d7b58858
...
...
@@ -11,8 +11,8 @@
<div
class=
"race-types-container"
>
{% for epreuve in epreuves %}
<div
class=
"card"
>
<div
class=
"header"
>
<div
class=
"card"
id=
"type-{{ epreuve.id }}"
>
<div
class=
"header"
data-video-url=
"{% get_media_prefix %}{{ epreuve.video }}"
>
<img
src=
"{% get_media_prefix %}{{ epreuve.image }}"
alt=
"{{ epreuve.name }}"
>
</div>
<div
class=
"content"
>
...
...
@@ -32,3 +32,48 @@
</div>
</div>
{% endblock %}
{% block javascripts %}
<script
type=
"text/javascript"
>
// Sélectionne tous les éléments de classe 'card' dont l'ID commence par 'type-'
const
cards
=
document
.
querySelectorAll
(
'
.card[id^="type-"]
'
);
cards
.
forEach
((
card
)
=>
{
let
timeoutId
;
let
originalContent
;
card
.
addEventListener
(
'
mouseenter
'
,
()
=>
{
const
header
=
card
.
querySelector
(
'
.header
'
);
const
videoUrl
=
header
.
dataset
.
videoUrl
;
if
(
videoUrl
&&
!
header
.
querySelector
(
'
video
'
))
{
timeoutId
=
setTimeout
(()
=>
{
const
video
=
document
.
createElement
(
'
video
'
);
video
.
src
=
videoUrl
;
video
.
controls
=
false
;
video
.
autoplay
=
true
;
video
.
muted
=
true
;
video
.
loop
=
true
;
// Sauvegarde le contenu d'origine du header pour pouvoir le restaurer plus tard
originalContent
=
header
.
innerHTML
;
header
.
innerHTML
=
''
;
header
.
appendChild
(
video
);
},
1000
);
}
});
card
.
addEventListener
(
'
mouseleave
'
,
()
=>
{
clearTimeout
(
timeoutId
);
const
header
=
card
.
querySelector
(
'
.header
'
);
const
video
=
header
.
querySelector
(
'
video
'
);
if
(
video
)
{
// Supprime la vidéo et réaffiche l'image d'origine
header
.
innerHTML
=
originalContent
;
}
});
});
</script>
{% endblock %}
\ No newline at end of file
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