Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Site Interludes
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package 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
mediatek
Site Interludes
Commits
753f9a5e
Commit
753f9a5e
authored
4 years ago
by
Dorian Lesbre
Browse files
Options
Downloads
Patches
Plain Diff
Timeline day grouping
parent
344641a9
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
home/static/css/style.css
+0
-8
0 additions, 8 deletions
home/static/css/style.css
home/templates/activites.html
+20
-11
20 additions, 11 deletions
home/templates/activites.html
home/views.py
+6
-0
6 additions, 0 deletions
home/views.py
with
26 additions
and
19 deletions
home/static/css/style.css
+
0
−
8
View file @
753f9a5e
...
...
@@ -233,14 +233,6 @@ span.helptext {
unicode-bidi
:
bidi-override
;
direction
:
rtl
;
}
.planning_title
{
font-size
:
1em
;
}
.planning_room
{
font-size
:
1em
;
color
:
#555
;
font-style
:
italic
;
}
.button
,
.button
:link
,
.button
:visited
,
input
[
type
=
submit
]
{
color
:
white
;
...
...
This diff is collapsed.
Click to expand it.
home/templates/activites.html
+
20
−
11
View file @
753f9a5e
...
...
@@ -10,38 +10,47 @@
{% block "content" %}
{% if settings.display_planning %}
<h2>
Planning
</h2>
<div
id=
"
visualization
"
></div>
<div
id=
"
planning
"
></div>
<script
type=
"text/javascript"
>
// https://visjs.org/
// DOM element where the Timeline will be attached
var
container
=
document
.
getElementById
(
'
visualization
'
);
const
container
=
document
.
getElementById
(
'
planning
'
);
// Create a DataSet (allows two way data-binding)
var
items
=
new
vis
.
DataSet
([
const
groups
=
new
vis
.
DataSet
([
{
id
:
{{
friday
}},
content
:
"
Vendredi
"
,
order
:
0
},
{
id
:
{{
saturday
}},
content
:
"
Samedi
"
,
order
:
1
},
{
id
:
{{
sunday
}},
content
:
"
Dimanche
"
,
order
:
2
},
]);
// Items in the timeline
const
items
=
new
vis
.
DataSet
([
{
%
for
act
in
planning
%
}
{
id
:
{{
act
.
id
}},
content
:
'
<strong>{{ act.title }}</strong><div class="planning_room">{{ act.room }}</div>
'
,
start
:
'
{{
act.
start|date:"Y-m-d
H:i:s" }}
'
,
start
:
'
{{
settings.date_
start|date:"Y-m-d
"}} {{ act.start|date:"
H:i:s" }}
'
,
align
:
'
left
'
,
title
:
'
hello
'
,
group
:
'
{{ act.start|date:"d" }}
'
,
subgroup
:
'
{{ act.room }}
'
,
//
end:'{{ act.end|date:"
Y-m-d
H:i:s" }}'
end
:
'
{{
settings.date_start|date:"Y-m-d"}} {{
act.end|date:"H:i:s" }}
'
},
{
%
endfor
%
}
]);
// Configuration for the Timeline
var
options
=
{
//
showMajorLabels: false,
const
options
=
{
showMajorLabels
:
false
,
showCurrentTime
:
false
,
locale
:
"
fr-fr
"
,
groupOrder
:
"
order
"
,
start
:
'
{{ settings.date_start|date:"Y-m-d"}} 00:00:00
'
,
end
:
'
{{ settings.date_start|date:"Y-m-d"}} 23:59:59
'
,
};
// Create a Timeline
var
timeline
=
new
vis
.
Timeline
(
container
,
items
,
options
);
const
timeline
=
new
vis
.
Timeline
(
container
,
items
,
options
);
timeline
.
setGroups
(
groups
);
// timeline.on('select', function (properties) {
// alert('selected items: ' + properties.items);
// });
...
...
This diff is collapsed.
Click to expand it.
home/views.py
+
6
−
0
View file @
753f9a5e
from
datetime
import
timedelta
from
django.contrib
import
messages
from
django.contrib.auth.mixins
import
LoginRequiredMixin
from
django.contrib.sitemaps
import
Sitemap
...
...
@@ -30,8 +32,12 @@ class ActivityView(TemplateView):
def
get_context_data
(
self
,
**
kwargs
):
"""
ajoute la liste des activités au contexte
"""
context
=
super
(
ActivityView
,
self
).
get_context_data
(
**
kwargs
)
settings
=
SiteSettings
.
load
()
context
[
'
activities
'
]
=
InterludesActivity
.
objects
.
filter
(
display
=
True
).
order_by
(
"
title
"
)
context
[
'
planning
'
]
=
InterludesActivity
.
objects
.
filter
(
on_planning
=
True
).
order_by
(
"
title
"
)
context
[
'
friday
'
]
=
settings
.
date_start
.
day
context
[
'
saturday
'
]
=
(
settings
.
date_start
+
timedelta
(
days
=
1
)).
day
context
[
'
sunday
'
]
=
(
settings
.
date_start
+
timedelta
(
days
=
2
)).
day
return
context
...
...
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