Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
UNL Resource Scheduler
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
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
Jeff Sturek
UNL Resource Scheduler
Commits
d5580e0c
Commit
d5580e0c
authored
8 years ago
by
Tyler Lemburg
Browse files
Options
Downloads
Patches
Plain Diff
Fix some numbers on resource calendar view
parent
40a3bbe4
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
views/resource_calendar.erb
+30
-26
30 additions, 26 deletions
views/resource_calendar.erb
with
30 additions
and
26 deletions
views/resource_calendar.erb
+
30
−
26
View file @
d5580e0c
<%
reservation_groups
=
reservations
.
group_by
do
|
reservation
|
reservation
.
start_time
.
in_time_zone
.
strftime
(
"%Y/%m/%d"
)
end
%>
end
HALF_HOUR_HEIGHT
=
28
# pixel height of half-hour sections in calendar. DO NOT CHANGE RESPONSIVELY
SIX_AM_MINUTES
=
360
# start time of calendar
EIGHT_PM_MINUTES
=
1200
# end time of calendar
%>
<div
id=
"pagetitle"
>
<div
id=
"kioskLogo"
></div>
...
...
@@ -80,18 +85,22 @@ end %>
closeds
.
each
do
|
closed
|
start_time
=
closed
[
0
]
%>
<%
end_time
=
closed
[
1
]
%>
<%
if
[((
end_time
-
360
)
/
30
).
floor
,
35
].
min
<
0
<%
# if the end time is before 6 am, skip.
if
((
end_time
-
SIX_AM_MINUTES
)
/
30
).
floor
<
0
next
end
top
=
((
start_time
-
360
)
/
30
)
*
20
height
=
(
end_time
-
start_time
)
*
20
/
30
# calculate top based off of 6 am start
top
=
((
start_time
-
SIX_AM_MINUTES
)
/
30
)
*
HALF_HOUR_HEIGHT
height
=
(
end_time
-
start_time
)
*
HALF_HOUR_HEIGHT
/
30
# normalize top to 0, reduce height to accomodate
if
top
<
0
height
+=
top
top
=
0
end
if
top
+
height
>
720
height
=
720
-
top
end
# normalize the bottom to the bottom of the calendar at 8pm.
if
top
+
height
>
(
EIGHT_PM_MINUTES
/
30
)
*
HALF_HOUR_HEIGHT
height
=
(
EIGHT_PM_MINUTES
/
30
)
*
HALF_HOUR_HEIGHT
-
top
end
%>
<div
class=
"status closed"
title=
"Closed"
style=
"top:
<%=
top
%>
px; height:
<%=
height
%>
px;"
>
...
...
@@ -104,17 +113,17 @@ end %>
<%
if
record
[
:status
]
!=
'open'
&&
record
[
:status
]
!=
'closed'
%>
<%
start_time
=
record
[
:start
]
%>
<%
end_time
=
record
[
:end
]
%>
<%
if
[
((
end_time
-
360
)
/
30
).
floor
,
35
].
min
<
0
<%
if
((
end_time
-
SIX_AM_MINUTES
)
/
30
).
floor
<
0
next
end
top
=
((
start_time
-
360
)
/
30
)
*
20
height
=
(
end_time
-
start_time
)
*
20
/
30
top
=
((
start_time
-
SIX_AM_MINUTES
)
/
30
)
*
HALF_HOUR_HEIGHT
height
=
(
end_time
-
start_time
)
*
HALF_HOUR_HEIGHT
/
30
if
top
<
0
height
+=
top
top
=
0
end
if
top
+
height
>
720
height
=
720
-
top
if
top
+
height
>
(
EIGHT_PM_MINUTES
/
30
)
*
HALF_HOUR_HEIGHT
height
=
(
EIGHT_PM_MINUTES
/
30
)
*
HALF_HOUR_HEIGHT
-
top
end
%>
<div
title=
"
<%=
record
[
:status
].
split
(
'_'
).
join
(
' '
).
capitalize_all
%>
"
class=
"status
<%=
record
[
:status
].
downcase
.
split
(
'_'
).
join
(
'-'
)
%>
"
style=
"top:
<%=
top
%>
px; height:
<%=
height
%>
px;"
>
...
...
@@ -127,8 +136,8 @@ end %>
<%
day_events
=
reservation_groups
[
day
.
strftime
(
"%Y/%m/%d"
)]
%>
<%
unless
day_events
.
nil?
%>
<%
day_events
.
sort
{
|
a
,
b
|
a
.
start_time
<=>
b
.
start_time
}.
each
do
|
res
|
%>
<%
start_slot
=
[(((
res
.
start_time
.
in_time_zone
-
day
.
midnight
)
/
60
-
360
)
/
30
).
floor
,
0
].
max
end_slot
=
[(((
res
.
end_time
.
in_time_zone
-
day
.
midnight
)
/
60
-
360
)
/
30
).
floor
,
35
].
min
<%
start_slot
=
[(((
res
.
start_time
.
in_time_zone
-
day
.
midnight
)
/
60
-
SIX_AM_MINUTES
)
/
30
).
floor
,
0
].
max
end_slot
=
[(((
res
.
end_time
.
in_time_zone
-
day
.
midnight
)
/
60
-
SIX_AM_MINUTES
)
/
30
).
floor
,
35
].
min
if
end_slot
<
0
next
end
...
...
@@ -137,8 +146,8 @@ end %>
over
=
slots
[
k
]
if
slots
[
k
]
>
over
end
over
=
[
over
,
3
].
min
top
=
(((
res
.
start_time
.
in_time_zone
-
day
.
midnight
)
/
60
-
360
)
/
30
)
*
28
height
=
res
.
length
*
28
/
30
top
=
(((
res
.
start_time
.
in_time_zone
-
day
.
midnight
)
/
60
-
SIX_AM_MINUTES
)
/
30
)
*
HALF_HOUR_HEIGHT
height
=
res
.
length
*
HALF_HOUR_HEIGHT
/
30
top_overflow
=
false
bottom_overflow
=
false
if
top
<
0
...
...
@@ -146,11 +155,11 @@ end %>
top
=
0
top_overflow
=
true
end
if
top
+
height
>
720
height
=
720
-
top
if
top
+
height
>
(
EIGHT_PM_MINUTES
/
30
)
*
HALF_HOUR_HEIGHT
height
=
(
EIGHT_PM_MINUTES
/
30
)
*
HALF_HOUR_HEIGHT
-
top
bottom_overflow
=
true
reservation
_groups
[(
day
+
1
.
day
).
strftime
(
"%Y/%m/%d"
)]
||=
[]
reservation
_groups
[(
day
+
1
.
day
).
strftime
(
"%Y/%m/%d"
)]
<<
res
events
_groups
[(
day
+
1
.
day
).
strftime
(
"%Y/%m/%d"
)]
||=
[]
events
_groups
[(
day
+
1
.
day
).
strftime
(
"%Y/%m/%d"
)]
<<
res
end
%>
<div
class=
"event-container"
style=
"top:
<%=
top
%>
px;"
>
...
...
@@ -263,11 +272,6 @@ require(['jquery', '/js/functions.js', '/js/jquery.mousewheel.min.js', '/js/jque
tick
();
setInterval
(
tick
,
60000
);
});
});
</script>
\ 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