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
8e80dec5
Commit
8e80dec5
authored
8 years ago
by
Tyler Lemburg
Browse files
Options
Downloads
Patches
Plain Diff
Agenda
parent
7ebe434a
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
routes/admin/agenda.rb
+34
-0
34 additions, 0 deletions
routes/admin/agenda.rb
views/admin/agenda.erb
+113
-0
113 additions, 0 deletions
views/admin/agenda.erb
with
147 additions
and
0 deletions
routes/admin/agenda.rb
0 → 100644
+
34
−
0
View file @
8e80dec5
before
'/:service_space_url_name/admin/agenda*'
do
unless
@user
.
has_permission?
(
Permission
::
SEE_AGENDA
,
@space
)
raise
Sinatra
::
NotFound
end
end
get
'/:service_space_url_name/admin/agenda/'
do
@breadcrumbs
<<
{
:text
=>
'Agenda'
}
date
=
params
[
:date
].
nil?
?
Time
.
now
.
midnight
:
Time
.
parse
(
params
[
:date
])
reservations
=
Reservation
.
includes
(
:user
,
:resource
,
:event
).
in_day
(
date
).
order
(
:start_time
)
events
=
Event
.
includes
(
:event_type
).
in_day
(
date
).
order
(
:start_time
)
# get the hours for this day to show
hours
=
SpaceHour
.
where
(
:service_space_id
=>
@space
.
id
)
.
where
(
'effective_date <= ?'
,
date
.
utc
.
strftime
(
'%Y-%m-%d %H:%M:%S'
))
.
order
(
:effective_date
=>
:desc
,
:id
=>
:desc
).
all
.
to_a
correct_hour
=
nil
hours
.
each
do
|
space_hour
|
if
date
.
wday
==
space_hour
.
day_of_week
&&
(
space_hour
.
effective_date
.
in_time_zone
.
midnight
==
date
.
in_time_zone
.
midnight
||
(
!
space_hour
.
one_off
&&
space_hour
.
effective_date
.
in_time_zone
.
midnight
<=
date
.
in_time_zone
.
midnight
))
correct_hour
=
space_hour
break
end
end
erb
:'admin/agenda'
,
:layout
=>
:fixed
,
:locals
=>
{
:reservations
=>
reservations
,
:events
=>
events
,
:date
=>
date
,
:space_hour
=>
correct_hour
}
end
\ No newline at end of file
This diff is collapsed.
Click to expand it.
views/admin/agenda.erb
0 → 100644
+
113
−
0
View file @
8e80dec5
<form
style=
"float: right; width: 320px;"
>
<div
class=
"offset-field-group"
>
<label
for=
"date"
>
Go to another date:
</label>
<div
class=
"date-time-select"
>
<span
class=
"wdn-icon-calendar"
></span>
<input
style=
"width: 90%;"
id=
"date"
name=
"date"
title=
"Reservation Date"
type=
"text"
class=
"datepicker"
value=
"
<%=
date
.
strftime
(
'%m/%d/%Y'
)
%>
"
/>
</div>
</div>
</form>
<div
id=
"pagetitle"
>
<h3>
Today's Agenda
<span
class=
"wdn-subhead"
>
<%=
date
.
strftime
(
'%B %d, %Y'
)
%>
</h3>
</div>
<h4>
Today's Hours
</h4>
<%
unless
space_hour
.
nil?
%>
<%=
space_hour
.
hours
.
map
do
|
record
|
start_time
=
date
+
record
[
:start
].
minutes
end_time
=
date
+
record
[
:end
].
minutes
"
#{
record
[
:status
].
capitalize_all
}
:
#{
start_time
.
in_time_zone
.
strftime
(
'%l:%M %P'
)
}
-
#{
end_time
.
in_time_zone
.
strftime
(
'%l:%M %P'
)
}
"
end
.
join
(
', '
)
%>
<%
else
%>
The space is open all day.
<%
end
%>
<h4>
Today's Reservations
</h4>
<%
if
reservations
.
empty?
%>
No reservations today. Hopefully someone will still come in to use the space!
<br>
<%
else
%>
<table>
<thead>
<tr>
<th>
Name
</th>
<th>
Tool
</th>
<th>
Time
</th>
</tr>
</thead>
<tbody>
<%
reservations
.
each
do
|
reservation
|
%>
<tr>
<td>
<%
if
reservation
.
user
%>
<%=
reservation
.
user
.
full_name
%>
<%
elsif
!
reservation
.
event
.
nil?
%>
<strong>
Event:
</strong>
<%=
reservation
.
event
.
title
%>
<%
end
%>
</td>
<td>
<%=
reservation
.
resource
.
name
%>
</td>
<td>
<%=
reservation
.
start_time
.
in_time_zone
.
strftime
(
'%l:%M %P'
)
%>
<br>
<%=
reservation
.
length
%>
minutes
</td>
</tr>
<%
end
%>
</tbody>
</table>
<%
end
%>
<h4>
Today's Events
</h4>
<%
if
events
.
empty?
%>
No events today. Perhaps you'd like to create one?
<br>
<a
href=
"/admin/events/create/"
class=
"wdn-button wdn-button-brand"
>
New Event
</a>
<%
else
%>
<table>
<thead>
<tr>
<th>
Title
</th>
<th>
Date/Location
</th>
<th>
Type
</th>
</tr>
</thead>
<tbody>
<%
events
.
each
do
|
event
|
%>
<tr>
<td>
<a
title=
"Edit Event"
href=
"
<%=
event
.
edit_link
%>
"
>
<%=
event
.
title
%>
</a>
</td>
<td>
<%=
event
.
start_time
.
in_time_zone
.
strftime
(
'%m/%d/%Y @ %l:%M %P'
)
%>
<br>
<%=
event
.
location
.
name
%>
</td>
<td>
<%=
event
.
type
.
name
%>
</td>
</tr>
<%
end
%>
</tbody>
</table>
<br>
<a
href=
"/admin/events/"
class=
"wdn-button wdn-button-triad"
>
Go To Events
</a>
<%
end
%>
<script
type=
"text/javascript"
>
WDN
.
initializePlugin
(
'
jqueryui
'
,
[
function
()
{
$
=
require
(
'
jquery
'
);
$
(
'
.datepicker
'
).
datepicker
();
$
(
"
LINK[href^='//unlcms.unl.edu/wdn/templates_4.0/scripts/plugins/ui/css/jquery-ui.min.css']
"
).
remove
();
$
(
'
#date
'
).
change
(
function
()
{
var
date
=
$
(
'
#date
'
).
val
().
split
(
'
/
'
);
window
.
location
=
window
.
location
.
href
.
split
(
'
?
'
)[
0
]
+
'
?date=
'
+
date
[
2
]
+
'
-
'
+
date
[
0
]
+
'
-
'
+
date
[
1
];
});
}]);
</script>
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