Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
radiopanik
panikweb
Commits
f27d61fd
Commit
f27d61fd
authored
Aug 16, 2013
by
fred
Browse files
grid: use new durations and week numbers to add more info
parent
9b9e774e
Changes
2
Hide whitespace changes
Inline
Side-by-side
panikweb/views.py
View file @
f27d61fd
...
...
@@ -25,18 +25,26 @@ class TimeCell:
nonstop
=
None
w
=
1
h
=
1
time_label
=
None
def
__init__
(
self
,
i
,
j
):
self
.
x
=
i
self
.
y
=
j
self
.
emissions
=
[]
def
add_emission
(
self
,
emission
):
self
.
emissions
.
append
(
emission
)
self
.
schedules
=
[]
def
add_schedule
(
self
,
schedule
):
end_time
=
schedule
.
datetime
+
datetime
.
timedelta
(
minutes
=
schedule
.
emission
.
duration
)
self
.
time_label
=
'%02d:%02d-%02d:%02d'
%
(
schedule
.
datetime
.
hour
,
schedule
.
datetime
.
minute
,
end_time
.
hour
,
end_time
.
minute
)
self
.
schedules
.
append
(
schedule
)
def
__unicode__
(
self
):
if
self
.
emission
s
:
return
', '
.
join
([
x
.
title
for
x
in
self
.
emission
s
])
if
self
.
schedule
s
:
return
', '
.
join
([
x
.
emission
.
title
for
x
in
self
.
schedule
s
])
else
:
return
self
.
nonstop
...
...
@@ -87,7 +95,7 @@ class Grid(TemplateView):
for
step
in
range
(
int
(
math
.
ceil
(
schedule
.
emission
.
duration
/
30
))):
if
grid
[(
row_start
+
step
)
%
nb_lines
][
day_no
]
is
None
:
grid
[(
row_start
+
step
)
%
nb_lines
][
day_no
]
=
TimeCell
()
grid
[(
row_start
+
step
)
%
nb_lines
][
day_no
].
add_
emission
(
schedule
.
emission
)
grid
[(
row_start
+
step
)
%
nb_lines
][
day_no
].
add_
schedule
(
schedule
)
# start grid at 5am
grid
=
grid
[
2
*
5
:]
+
grid
[:
2
*
5
]
...
...
panikweb_templates/templates/grid.html
View file @
f27d61fd
...
...
@@ -30,6 +30,10 @@
font-size
:
15px
;
}
#grille
h3
{
width
:
100%
;
}
#grille
.jour
{
margin-top
:
20px
;
margin-bottom
:
30px
;
...
...
@@ -65,7 +69,20 @@
<td
class=
"heure"
>
{{ time_header }}
</td>
{% for cell in time_cells %}
<td
{%
if
cell.w
>
1 %}colspan="{{cell.w}}"{% endif %}
{% if cell.h > 1 %}rowspan="{{cell.h}}"{% endif %}>{{ cell }}
</td>
{% if cell.h > 1 %}rowspan="{{cell.h}}"{% endif %}>
{% if cell.time_label %}
<h5>
{{ cell.time_label }}
</h5>
{% endif %}
{% if cell.schedules %}
{% for schedule in cell.schedules %}
<h4>
{{ schedule.emission.title }}
</h4>
{% if schedule.weeks_string %}
({{ schedule.weeks_string }})
{% endif %}
{% endfor %}
{% else %}
<h3
class=
"continu"
>
{{ cell }}
</h3>
{% if cell.w > 1 and cell.h > 1%}
<p>
la musique en continu
</p>
{% endif %}
{% endif %}
</td>
{% endfor %}
<td
class=
"heure"
>
{{ time_header }}
</td>
</tr>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment