Commit 30699289 authored by Jeff Sturek's avatar Jeff Sturek
Browse files

Merge branch 'pcf-pagination' into 'master'

DCF Pagination and DCF markup updates

See merge request dxg/unl-resource-scheduler!25
parents 691e4c6f 72ff97e7
......@@ -157,8 +157,8 @@ get '/' do
spaces = @user ? @user.service_spaces : []
app_wide_resources = Resource.where(:available_app_wide => true).all
page = params[:page].to_i
page = 1 if page.nil? || page <= 0
page = params[:page]
page = page.to_i >= 1 ? page.to_i : 1
reservations = []
total_pages = 1
......@@ -179,7 +179,8 @@ get '/' do
spaces: spaces,
resources: app_wide_resources,
reservations: reservations,
total_pages: total_pages
total_pages: total_pages,
page: page
}
end
......
require 'active_record'
class CreateDatabase < ActiveRecord::Migration
def change
create_table :maker_requests do |t|
t.string :name
t.string :resource_type
t.string :model
t.text :description
t.integer :service_space_id
t.integer :minutes_per_reservation
t.boolean :needs_authorization
t.boolean :needs_approval
end
add_column :event, :admin_notes, :text
end
end
This diff is collapsed.
This diff is collapsed.
......@@ -2,7 +2,7 @@
<div class="offset-field-group">
<label for="date">Go to another date:</label>
<div class="date-time-select">
<span class="wdn-icon-calendar"></span>
<span class="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>
......@@ -105,7 +105,7 @@ No events today. Perhaps you'd like to create one?<br>
</tbody>
</table>
<br>
<a href="<%= @space.admin_events_href %>" class="dcf-btn wdn-button-triad">Go To Events</a>
<a href="<%= @space.admin_events_href %>" class="dcf-btn dcf-btn-secondary">Go To Events</a>
<% end %>
<% append_script_declaration(%q[WDN.initializePlugin('jqueryui', [function() {
......
......@@ -6,8 +6,8 @@
</div>
<div style="margin-bottom: 16px;">
<a href="<%= resource.edit_hours_href %>?date=<%= (date-7.days).strftime('%Y-%m-%d') %>" class="dcf-btn wdn-button-triad" id="prev-week">&lt; PREV</a>
<a href="<%= resource.edit_hours_href %>?date=<%= (date+7.days).strftime('%Y-%m-%d') %>" class="dcf-btn wdn-button-triad" style="float: right;" id="next-week">NEXT &gt;</a>
<a href="<%= resource.edit_hours_href %>?date=<%= (date-7.days).strftime('%Y-%m-%d') %>" class="dcf-btn dcf-btn-secondary" id="prev-week">&lt; PREV</a>
<a href="<%= resource.edit_hours_href %>?date=<%= (date+7.days).strftime('%Y-%m-%d') %>" class="dcf-btn dcf-btn-secondary" style="float: right;" id="next-week">NEXT &gt;</a>
</div>
<table>
......
......@@ -49,34 +49,32 @@
</table>
</div>
<% if total_pages > 1 %>
<% append_script_declaration("WDN.loadCSS('/wdn/templates_4.1/css/modules/pagination.css');") %>
<div style="text-align: center;">
<div style="display: inline-block;">
<ul id="pending-pagination" class="wdn_pagination" data-tab="pending" style="padding-left: 0;">
<% if page != 1 %>
<li class="arrow prev"><a href="?tab=<%= tab %>&amp;page=<%= page-1 %>" title="Go to the previous page">← prev</a></li>
<% end %>
<% before_ellipsis_shown = false; after_ellipsis_shown = false %>
<% (1..total_pages).each do |i| %>
<% if i == page %>
<li class="selected"><span><%= i %></span></li>
<% elsif (i <= 3 || i >= total_pages - 2 || i == page - 1 ||
i == page - 2 || i == page + 1 || $i == page + 2) %>
<li><a href="?tab=<%= tab %>&amp;page=<%= i %>" title="Go to page <%= i %>"><%= i %></a></li>
<% elsif (i < page && !before_ellipsis_shown) %>
<li><span class="ellipsis">...</span></li>
<% before_ellipsis_shown = true %>
<% elsif (i > page && !after_ellipsis_shown) %>
<li><span class="ellipsis">...</span></li>
<% after_ellipsis_shown = true %>
<% end %>
<% end %>
<% if page != total_pages %>
<li class="arrow next"><a href="?tab=<%= tab %>&amp;page=<%= page+1 %>" title="Go to the next page">next →</a></li>
<% end %>
</ul>
</div>
</div>
<% append_script_declaration("WDN.initializePlugin('pagination');") %>
<nav class="dcf-pagination dcf-mt-3">
<ol class="dcf-list-bare dcf-list-inline">
<% if page != 1 %>
<li><a class="dcf-pagination-prev" href="?tab=<%= tab %>&amp;page=<%= page-1 %>">Prev</a></li>
<% end %>
<% before_ellipsis_shown = false; after_ellipsis_shown = false %>
<% (1..total_pages).each do |i| %>
<% if i == page %>
<li><span class="dcf-pagination-selected"><%= i %></span></li>
<% elsif (i <= 3 || i >= total_pages - 2 || i == page - 1 ||
i == page - 2 || i == page + 1 || $i == page + 2) %>
<li><a href="?tab=<%= tab %>&amp;page=<%= i %>"><%= i %></a></li>
<% elsif (i < page && !before_ellipsis_shown) %>
<li><span class="dcf-pagination-ellipsis">...</span></li>
<% before_ellipsis_shown = true %>
<% elsif (i > page && !after_ellipsis_shown) %>
<li><span class="dcf-pagination-ellipsis">...</span></li>
<% after_ellipsis_shown = true %>
<% end %>
<% end %>
<% if page != total_pages %>
<li><a class="dcf-pagination-next" href="?tab=<%= tab %>&amp;page=<%= page+1 %>">Next</a></li>
<% end %>
</ol>
</nav>
<% end %>
</div>
</div>
......
......@@ -6,8 +6,8 @@
</div>
<div style="margin-bottom: 16px;">
<a href="<%= @space.admin_hours_href %>?date=<%= (date-7.days).strftime('%Y-%m-%d') %>" class="dcf-btn wdn-button-triad" id="prev-week">&lt; PREV</a>
<a href="<%= @space.admin_hours_href %>?date=<%= (date+7.days).strftime('%Y-%m-%d') %>" class="dcf-btn wdn-button-triad" style="float: right;" id="next-week">NEXT &gt;</a>
<a href="<%= @space.admin_hours_href %>?date=<%= (date-7.days).strftime('%Y-%m-%d') %>" class="dcf-btn dcf-btn-secondary" id="prev-week">&lt; PREV</a>
<a href="<%= @space.admin_hours_href %>?date=<%= (date+7.days).strftime('%Y-%m-%d') %>" class="dcf-btn dcf-btn-secondary" style="float: right;" id="next-week">NEXT &gt;</a>
</div>
<table>
......
......@@ -72,7 +72,7 @@
<br>
<label for="start-date" ><span class="required">*</span> Start Date &amp; Time</label>
<div class="date-time-select"><span class="wdn-icon-calendar"></span>
<div class="date-time-select"><span class="icon-calendar"></span>
<input id="start-date" value="<%= event.start_time.in_time_zone.strftime('%m/%d/%Y') if !event.start_time.nil? %>" name="start_date" title="Start Date" type="text" class="datepicker" />
<div class="dcf-d-flex dcf-ai-center dcf-flex-grow-1 dcf-mt-4 dcf-mr-4">
......@@ -106,7 +106,7 @@
</div>
<label for="end-date">End Date &amp; Time (optional)</label>
<div class="date-time-select"><span class="wdn-icon-calendar"></span>
<div class="date-time-select"><span class="icon-calendar"></span>
<input id="end-date" value="<%= event.end_time.in_time_zone.strftime('%m/%d/%Y') if !event.end_time.nil? %>" name="end_date" title="End Date" type="text" class="datepicker" />
<div class="dcf-d-flex dcf-ai-center dcf-flex-grow-1 dcf-mt-4 dcf-mr-4">
......
......@@ -15,7 +15,7 @@
<label for="effective-date">Effective Date</label>
<div class="date-time-select">
<span class="wdn-icon-calendar dcf-float-left dcf-mt-2"></span>
<span class="icon-calendar dcf-float-left dcf-mt-2"></span>
<input style="width: 90%;" id="effective-date" name="effective_date" title="Effective Date" type="text" class="datepicker" value="<%= (space_hour.effective_date || Time.now).strftime('%m/%d/%Y') %>" />
</div>
</div>
......
......@@ -15,7 +15,7 @@
<label for="effective-date">Effective Date</label>
<div class="date-time-select">
<span class="wdn-icon-calendar"></span>
<span class="icon-calendar"></span>
<input style="width: 90%;" id="effective-date" name="effective_date" title="Effective Date" type="text" class="datepicker" value="<%= (resource_hour.effective_date || Time.now).strftime('%m/%d/%Y') %>" />
</div>
</div>
......@@ -79,7 +79,7 @@
</div>
<% end %>
</div>
<button id="add-hours" type="button" class="dcf-btn wdn-button-complement">Add Hours</button>
<button id="add-hours" type="button" class="dcf-btn dcf-btn-secondary">Add Hours</button>
</fieldset>
<button type="submit" class="dcf-btn dcf-btn-primary">Submit</button>
......
......@@ -19,7 +19,7 @@
</td>
<td class="table-actions">
<a href="/<%= @space.url_name %>/admin/resources/<%= resource.id %>/edit/" class="dcf-btn dcf-btn-primary">Edit</a>
<a href="/<%= @space.url_name %>/admin/resources/<%= resource.id %>/hours/" class="dcf-btn wdn-button-triad">Set Hours</a>
<a href="/<%= @space.url_name %>/admin/resources/<%= resource.id %>/hours/" class="dcf-btn dcf-btn-secondary">Set Hours</a>
<form method="POST" action="/<%= @space.url_name %>/admin/resources/<%= resource.id %>/delete/" class="delete-form delete-resource">
<button class="dcf-btn" type="submit">Delete</button>
</form>
......
......@@ -26,7 +26,7 @@
</div>
</div>
<br>
<button id="add-file" type="button" class="dcf-btn wdn-button-triad">Add another file</button>
<button id="add-file" type="button" class="dcf-btn dcf-btn-secondary">Add another file</button>
</fieldset>
</div>
......
<div id="pagetitle">
<h3>Manage Users<span class="dcf-subhead"><a id="show-toolbox" href="#">Show User Toolbox</a></span></h3>
<h3>Manage Users <span class="dcf-subhead"><a id="show-toolbox" href="#">Show User Toolbox</a></span></h3>
</div>
<div id="toolbox" class="toolbox" style="display: none;">
......@@ -7,7 +7,7 @@
<div class="tools">
<a class="dcf-btn dcf-btn-primary" href="<%= @space.admin_users_href %>add/">Add User</a>
<a class="dcf-btn dcf-btn-primary" href="<%= @space.admin_users_href %><%= @user.id %>/edit/">Edit My User</a>
<a class="dcf-btn wdn-button-triad" href="<%= @space.admin_users_href %><%= @user.id %>/manage/">My Resources</a>
<a class="dcf-btn dcf-btn-secondary" href="<%= @space.admin_users_href %><%= @user.id %>/manage/">My Resources</a>
</div>
</div>
......@@ -63,7 +63,7 @@
</td>
<td class="table-actions">
<a href="<%= @space.admin_users_href %><%= user.id %>/edit/" class="dcf-btn dcf-btn-primary dcf-mb-2">Edit</a>
<a href="<%= @space.admin_users_href %><%= user.id %>/manage/" class="dcf-btn wdn-button-triad dcf-mb-2">Resources</a>
<a href="<%= @space.admin_users_href %><%= user.id %>/manage/" class="dcf-btn dcf-btn-secondary dcf-mb-2">Resources</a>
<form class="delete-form delete-user" action="<%= @space.admin_users_href %><%= user.id %>/delete/" method="POST">
<button type="submit" class="dcf-btn dcf-mb-2">Delete</button>
</form>
......
......@@ -154,7 +154,7 @@ end
<div>
<h6 style="margin-top: 0px; margin-bottom: .25em;"><%= res.title ? (res.title.empty? ? 'Reserved' : res.title) : 'Reserved' %></h6>
<p style="margin-bottom: 10px;" class="eventicon-clock"><%= res.start_time.in_time_zone.strftime('%I:%M %p') %> - <%= res.end_time.in_time_zone.strftime('%I:%M %p') %></p>
<p style="margin-bottom: 10px;"><a href="<%= res.info_link %>"" class="dcf-btn dcf-btn-primary dcf-txt-sm">View</a> <a href="<%= res.download_link %>" class="download-ics dcf-btn wdn-button-triad dcf-txt-sm">Download</a></p>
<p style="margin-bottom: 10px;"><a href="<%= res.info_link %>"" class="dcf-btn dcf-btn-primary dcf-txt-sm">View</a> <a href="<%= res.download_link %>" class="download-ics dcf-btn dcf-btn-secondary dcf-txt-sm">Download</a></p>
<div class="close"><a href="#">&times;</a></div>
</div>
</div>
......
<div class="event-details">
<div>
<h3>
<%= event.title %><span class="dcf-subhead"><%= event.type.description %></span>
</h3>
<h3><%= event.title %> <span class="dcf-subhead"><%= event.type.description if event.type && event.type.description %></span></h3>
</div>
<div>
<span class="date-wrapper eventicon-calendar-empty">
......@@ -30,10 +28,10 @@
<% # the user is already signed up %>
<% if event.type.description == 'Free Event' %>
This event is noted on your homepage.<br>
<a href="<%= @space.href %>" class="dcf-btn wdn-button-triad">View Homepage</a>
<a href="<%= @space.href %>" class="dcf-btn dcf-btn-secondary">View Homepage</a>
<% else %>
You have signed up for this event.<br>
<a href='<%= @space.href %>' class="dcf-btn wdn-button-triad">View Homepage</a>
<a href='<%= @space.href %>' class="dcf-btn dcf-btn-secondary">View Homepage</a>
<% end %>
<% elsif @user %>
<% # the user is logged in but not signed up %>
......@@ -60,4 +58,4 @@
<% end %>
<% end %>
<% end %>
<a href="<%= event.download_link %>" class="download-ics dcf-btn wdn-button-triad">Download</a>
\ No newline at end of file
<a href="<%= event.download_link %>" class="download-ics dcf-btn dcf-btn-secondary">Download</a>
\ No newline at end of file
......@@ -55,7 +55,7 @@
<%= ERB.new(File.read(File.expand_path("#{ROOT}/public/wdn/templates_5.3/includes/global/site-affiliation-2.html"))).result %>
<%= ERB.new(File.read(File.expand_path("#{ROOT}/public/wdn/templates_5.3/includes/global/site-title-1.html"))).result %>
<!-- InstanceBeginEditable name="titlegraphic" -->
<a class="dcf-txt-h5" href="/">UNL Resource Scheduler</a>
<a class="dcf-txt-h5" href="/?no-space-redirect">UNL Resource Scheduler</a>
<!-- InstanceEndEditable -->
<%= ERB.new(File.read(File.expand_path("#{ROOT}/public/wdn/templates_5.3/includes/global/site-title-2.html"))).result %>
<%= ERB.new(File.read(File.expand_path("#{ROOT}/public/wdn/templates_5.3/includes/global/logo-lockup-2.html"))).result %>
......
<%
# redirect to space home if user has no all university reservations and only one space for user and no-direct is not set in query string
if !params.include?('no-space-redirect') && reservations.empty? && @user && spaces.length === 1
redirect spaces[0].href
end
%>
<div id="pagetitle">
<h3>Welcome to UNL Resource Scheduler<span class="dcf-subhead"><%= @user.full_name if @user %></span></h3>
<h1 class="dcf-txt-h3">Welcome to UNL Resource Scheduler <span class="dcf-subhead"><%= @user.full_name if @user %></span></h3>
</div>
<p>
......@@ -8,7 +15,7 @@ If you'd like your organization, building, or department in our scheduler, pleas
to set up a service space. Enjoy!
</p>
<h5 class="dcf-txt-center">Your Service Spaces</h5>
<h2 class="dcf-txt-h6 dcf-txt-center">Your Service Spaces</h5>
<% unless @user %>
Please login to see your service spaces.<br>
<a class="dcf-btn dcf-btn-primary" href="https://shib.unl.edu/idp/profile/cas/login?service=<%= "http://#{request.host}#{":" if request.port != 80}#{request.port if request.port != 80}#{request.path_info}" %>">Login</a>
......@@ -34,7 +41,7 @@ Please login to see your service spaces.<br>
<% end %>
<% unless resources.empty? %>
<h5 class="dcf-txt-center">Available Resources</h5>
<h2 class="dcf-txt-h6 dcf-txt-center">Available Resources</h5>
<p>These resources are available to everyone at the University. You will be required to log in to reserve them.
<table>
<thead>
......@@ -66,7 +73,7 @@ Please login to see your service spaces.<br>
<% if !reservations.empty? %>
<h4 class="dcf-mt-4">
<h2 class="dcf-txt-h6 dcf-mt-6">
My Reservations (for resources available UNL-wide)
</h4>
<table>
......@@ -94,7 +101,7 @@ My Reservations (for resources available UNL-wide)
<%= reservation.length %> minutes
</td>
<td class="table-actions">
<a href="<%= reservation.download_link %>" class="dcf-btn wdn-button-triad">Download</a>
<a href="<%= reservation.download_link %>" class="dcf-btn dcf-btn-secondary">Download</a>
<a href="<%= reservation.edit_link %>" class="dcf-btn dcf-btn-primary">Edit</a>
<form method="POST" action="<%= reservation.cancel_link %>" class="delete-form">
<button class="dcf-btn" type="submit">Remove</button>
......@@ -109,35 +116,34 @@ My Reservations (for resources available UNL-wide)
<% end %>
</tbody>
</table>
<% if total_pages > 1 %>
<% append_script_declaration("WDN.loadCSS('/wdn/templates_4.1/css/modules/pagination.css');") %>
<div style="text-align: center;">
<div style="display: inline-block;">
<ul class="wdn_pagination" data-tab="pending" style="padding-left: 0;">
<% if page != 1 %>
<li class="arrow prev"><a href="?page=<%= page-1 %>" title="Go to the previous page">← prev</a></li>
<% end %>
<% before_ellipsis_shown = false; after_ellipsis_shown = false %>
<% (1..total_pages).each do |i| %>
<% if i == page %>
<li class="selected"><span><%= i %></span></li>
<% elsif (i <= 3 || i >= total_pages - 2 || i == page - 1 ||
i == page - 2 || i == page + 1 || $i == page + 2) %>
<li><a href="?page=<%= i %>" title="Go to page <%= i %>"><%= i %></a></li>
<% elsif (i < page && !before_ellipsis_shown) %>
<li><span class="ellipsis">...</span></li>
<% before_ellipsis_shown = true %>
<% elsif (i > page && !after_ellipsis_shown) %>
<li><span class="ellipsis">...</span></li>
<% after_ellipsis_shown = true %>
<% end %>
<% append_script_declaration("WDN.initializePlugin('pagination');") %>
<nav class="dcf-pagination dcf-mt-3">
<ol class="dcf-list-bare dcf-list-inline">
<% if page != 1 %>
<li><a class="dcf-pagination-prev" href="?page=<%= page-1 %>">Prev</a></li>
<% end %>
<% before_ellipsis_shown = false; after_ellipsis_shown = false %>
<% (1..total_pages).each do |i| %>
<% if i == page %>
<li><span class="dcf-pagination-selected"><%= i %></span></li>
<% elsif (i <= 3 || i >= total_pages - 2 || i == page - 1 ||
i == page - 2 || i == page + 1 || $i == page + 2) %>
<li><a href="?page=<%= i %>"><%= i %></a></li>
<% elsif (i < page && !before_ellipsis_shown) %>
<li><span class="dcf-pagination-ellipsis">...</span></li>
<% before_ellipsis_shown = true %>
<% elsif (i > page && !after_ellipsis_shown) %>
<li><span class="dcf-pagination-ellipsis">...</span></li>
<% after_ellipsis_shown = true %>
<% end %>
<% if page != total_pages %>
<li class="arrow next"><a href="?page=<%= page+1 %>" title="Go to the next page">next →</a></li>
<% end %>
</ul>
</div>
</div>
<% end %>
<% if page != total_pages %>
<li><a class="dcf-pagination-next" href="?page=<%= page+1 %>">Next</a></li>
<% end %>
</l>
</nav>
<% end %>
<% end %>
\ No newline at end of file
......@@ -157,7 +157,7 @@ end
</div><div class="<%= second_div_class %>" style="<%= second_div_style %>">
<label for="date">Date</label>
<div class="date-time-select">
<span class="wdn-icon-calendar"></span>
<span class="icon-calendar"></span>
<input style="width: 90%;" id="date" name="date" title="Reservation Date" type="text" class="datepicker" value="<%= day.strftime('%m/%d/%Y') %>" />
</div>
<label for="start-minutes">Start Time</label>
......@@ -211,7 +211,7 @@ end
</optgroup>
</select>
<label for="recurs-until-date">until </label><br>
<span class="wdn-icon-calendar"></span>
<span class="icon-calendar"></span>
<input id="recurs-until-date" name="recurs_until_date" type="text" class="datepicker" value="<%= day.strftime('%m/%d/%Y') %>" />
</div>
<br><br>
......
......@@ -172,7 +172,7 @@ end
<h6 style="margin-top: 0px; margin-bottom: .25em;"><%= res.title ? (res.title.empty? ? 'Reserved' : res.title) : 'Reserved' %></h6>
<p style="margin-bottom: 10px;" class="eventicon-clock"><%= res.start_time.in_time_zone.strftime('%I:%M %p') %> - <%= res.end_time.in_time_zone.strftime('%I:%M %p') %><br>
Reserved by: <span class="italic"><%= res.user.full_name rescue nil %></span></p>
<p style="margin-bottom: 10px;"><a href="<%= res.download_link %>" class="download-ics dcf-btn wdn-button-triad dcf-txt-sm">Download</a></p>
<p style="margin-bottom: 10px;"><a href="<%= res.download_link %>" class="download-ics dcf-btn dcf-btn-secondary dcf-txt-sm">Download</a></p>
<div class="close"><a href="#">&times;</a></div>
</div>
</div>
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment