Skip to content

Commit

Permalink
Merge pull request #67 from YaleSTC/static_pages
Browse files Browse the repository at this point in the history
Static pages
  • Loading branch information
caseywatts committed Nov 14, 2014
2 parents 7595239 + a2eaf50 commit 19448ea
Show file tree
Hide file tree
Showing 20 changed files with 162 additions and 12 deletions.
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,9 @@ gem 'yaleldap'
# httparty for connecting to the Yale API
gem 'httparty'

# gem that makes static pages easier
gem 'high_voltage'

group :development do
gem 'pry'
# gem 'better_errors'
Expand Down
2 changes: 2 additions & 0 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@ GEM
rspec (>= 2.14, < 4.0)
haml (4.0.5)
tilt
high_voltage (2.2.1)
highline (1.6.21)
hike (1.2.3)
hitimes (1.2.2)
Expand Down Expand Up @@ -307,6 +308,7 @@ DEPENDENCIES
factory_girl_rails
fuubar
guard-rspec
high_voltage
httparty
jbuilder (~> 2.0)
jquery-rails
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# CardSwipr
## Features
### Event Attendance
CardSwipr helps you take attendance at meetings and events. Attendees swipe in with this easy interface, the application looks them up in the Yale Phonebook, and collects their information in a list. When the event's over you can even download a `.csv` output of the attendees' information.
CardSwipr helps you take attendance at meetings and events. Attendees swipe in with this easy interface, the application looks them up in the Yale Phonebook, and collects their information in a list. When the event's over you can even download a spreadsheet (`.csv`) output of the attendees' information.

![Swipe Screen](READMEImages/SwipeScreenScreenshot.png)

Expand Down
Binary file added app/assets/images/CardSwiprInputTypes.jpg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
3 changes: 3 additions & 0 deletions app/assets/javascripts/pages.js.coffee
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# Place all the behaviors and hooks related to the matching controller here.
# All this logic will automatically be available in application.js.
# You can use CoffeeScript in this file: http://coffeescript.org/
3 changes: 3 additions & 0 deletions app/assets/stylesheets/pages.css.scss
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
// Place all the styles related to the pages controller here.
// They will automatically be included in application.css.
// You can use Sass (SCSS) here: http://sass-lang.com/
2 changes: 1 addition & 1 deletion app/controllers/events_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def create
respond_to do |format|
if @event.save
format.html { redirect_to events_path, notice: 'Event was successfully created.' }
format.json { render action: 'show', status: :created, location: @event }
format.json { render action: 'index', status: :created }
else
format.html { render action: 'new' }
format.json { render json: @event.errors, status: :unprocessable_entity }
Expand Down
5 changes: 5 additions & 0 deletions app/controllers/pages_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
class PagesController < ApplicationController
include HighVoltage::StaticPage

skip_authorization_check
end
2 changes: 2 additions & 0 deletions app/helpers/pages_helper.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
module PagesHelper
end
Binary file modified app/views/.DS_Store
Binary file not shown.
13 changes: 11 additions & 2 deletions app/views/attendance_entries/index.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
This table shows only the most useful Yale Phonebook (LDAP) attributes - you can see more details in two ways:
<ol>
<li>For an individual you can view <strong>More Details</strong> to see a lot more about them</li>
<li>You can <strong>download the CSV file</strong> to see all of the information. CSV is a "comma separated values" file, and you can open it right in Microsoft Excel.</li>
<li>You can <strong>download the spreadsheet (CSV)</strong> to see all of the information. CSV is a "comma separated values" file, and you can open it right in Microsoft Excel.</li>
</ol>
</p>

Expand All @@ -28,7 +28,7 @@
<span class="glyphicon glyphicon-credit-card"></span> Event Swipe-In
<% end %>
<%= link_to event_attendance_entries_path(@event, :format => :csv), :class => "btn btn-default" do %>
<span class="glyphicon glyphicon-download-alt"></span> Download CSV
<span class="glyphicon glyphicon-download-alt"></span> Spreadsheet
<% end %>
</div>
<div class="pull-right">
Expand All @@ -48,6 +48,11 @@
<th>Netid</th>
<th>Email</th>
<th>Swipe-In Time</th>
<th>
<%= link_to event_attendance_entries_path(@event, :format => :csv), :class => "btn btn-default" do %>
<span class="glyphicon glyphicon-download-alt"></span> Spreadsheet
<% end %>
</th>
<th></th>
</tr>
</thead>
Expand All @@ -64,6 +69,10 @@
<td>
<div class="btn-group">
<%= link_to 'More Details', attendance_entry_path(attendance_entry), :class => "btn btn-default" %>
</div>
</td>
<td>
<div class="btn-group">
<%= link_to 'Edit', edit_attendance_entry_path(attendance_entry), :class => "btn btn-default" %>
</div>
<div class="btn-group">
Expand Down
5 changes: 5 additions & 0 deletions app/views/events/swipe.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,11 @@
</div>

<div class="row">
<p class="pull-right">
<%= link_to event_attendance_entries_path(@event), :class => "btn" do %>
<span class="glyphicon glyphicon-list-alt"></span> List
<% end %>
</p>
<p class="pull-right">
<span class="badge"><%= @count%></span> recorded.
</p>
Expand Down
8 changes: 8 additions & 0 deletions app/views/layouts/_navigation.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@

<div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
<ul class="nav navbar-nav">
<li>
<%= link_to page_path('hardware') do %>
<span class="glyphicon glyphicon-flash"></span> Hardware
<% end %>
</li>
<% if can? :read, Event %>
<li>
<%= link_to events_path do %>
Expand All @@ -26,6 +31,9 @@
<% end %>
</ul>
<ul class="nav navbar-nav navbar-right">
<li>
<%= link_to 'About', page_path('about') %>
</li>
<li>
<%= link_to "#{current_user.full_name}", edit_user_path(current_user) if current_user %>
</li>
Expand Down
32 changes: 32 additions & 0 deletions app/views/pages/about.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<div class="row">
When a lookup happens, there are two steps:
<ol>
<li>We use the number scanned in from the card and turn it into Yale UPI (University Personal Identifier)</li>
<li>We use the Yale UPI to lookup the person in the <a href="http://directory.yale.edu/phonebook/index.htm">Yale Directory</a> via the <a href="http://en.wikipedia.org/wiki/Lightweight_Directory_Access_Protocol">LDAP</a> protocol.</li>
</ol>

<pre>
+---------------+ +---------------+ +-----------+
| YaleIDLookup | | YaleCardSwipe | | YaleLDAP |
+---------------+ +---------------+ +-----------+
| | |
| magnetic or prox number | |
|-------------------------------->| |
| | ---------------------------------\ |
| |-| lookup in YaleIDCardLookup API | |
| | |--------------------------------| |
| | |
| UPI | |
|<--------------------------------| |
| | |
| UPI | |
|------------------------------------------------------------------------->|
| | | --------------------------\
| | |-| directory lookup (LDAP) |
| | | |-------------------------|
| | |
| | useful hash of person attributes |
|<-------------------------------------------------------------------------|
| | |
</pre>
</div>
38 changes: 38 additions & 0 deletions app/views/pages/hardware.html.erb
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
<div class="row">
<h1>Hardware Recommendations</h1>
</div>
<div class="row">
<div class="col-md-8">
<h2>Guidelines</h2>
<p>
Prox Card &gt; Magnetic Stripe &gt; Keyboard
</p>
<ol>
<li><strong>Prox Card</strong> is the most convenient, but also the most expensive. The device must be configured (once) to work with Yale IDs. Configuration settings are on the wiki page below.</li>
<li><strong>Magnetic Stripe</strong> works well, but many people accidentally have to swipe a second time (flipping it around).</li>
<li><strong>Keyboard</strong> is quick when someone has trouble getting their card out.</li>
</ol>
<h2>Where Can I Get A Device?</h2>
<p>
<ol>
<li>Bass Library - Borrow one from <a href="https://reservations.yale.edu/bmec">Bass Library</a> (they may have some as of January 2014)</li>
<li>Buy One - Order Online (see below)</li>
<li>Keyboard Only - CardSwipr can be useful without a usb device. You can input people by netid, and it will still generate a useful list for you.</li>
</ol>
</p>
<h3>I want my own, which one should I buy?</h3>
<p>
ITS doesn't officially endorse any particular brand/model, but a crowdsourced list can be found on this page.
</p>
<p>
<a class="btn btn-default" href="https://github.com/YaleSTC/cardswipr/wiki/USB-Device-Recommendations/">Crowdsourced Wiki Page</a>
</p>
<h3>The one I bought worked / didn't work</h3>
<p>
Let us know! If you successfully/unsucessfully use another model, please update the hardware recommendations page. To edit the page, you must create a (free) github account.
</p>
</div>
<div class="col-md-4">
<%= image_tag "CardSwiprInputTypes.jpg", class: "img-responsive img-thumbnail" %>
</div>
</div>
Original file line number Diff line number Diff line change
@@ -1,19 +1,35 @@
<h1>CardSwipr</h1>
<div class="row">

<div class="col-md-5">
<h3>Events
<%= link_to events_path, class: "btn btn-lg btn-default pull-right" do %>
<div class="col-md-3">
<h3>
<%= link_to page_path('hardware'), class: "btn btn-lg btn-default" do %>
<span class="glyphicon glyphicon-flash"></span> Hardware
<% end %>
</h3>
<p>Input can be
<ol>
<li>prox card (tap)</li>
<li>magstripe (swipe)</li>
<li>netid/email (keyboard)</li>
</ol>
</p>
<%= image_tag "CardSwiprInputTypes.jpg", class: "img-responsive img-thumbnail" %>
</div>

<div class="col-md-6">
<h3>
<%= link_to events_path, class: "btn btn-lg btn-default" do %>
<span class="glyphicon glyphicon-list"></span> Events
<% end %>
</h3>
<p>CardSwipr helps you take attendance at meetings and events. Attendees swipe in with this easy interface, the application looks them up in the Yale Phonebook, and collects their information in a list. When the event's over you can even download a .csv output of the attendees' information.</p>
<p>CardSwipr helps you take attendance at meetings and events. Attendees swipe in with this easy interface, the application looks them up in the Yale Phonebook, and collects their information in a list. When the event's over you can even download a spreadsheet (.csv) output of the attendees' information.</p>
<%= image_tag "SwipeScreenScreenshot.png", class: "img-responsive img-thumbnail" %>
</div>

<div class="col-md-5 col-md-offset-1">
<h3>Walk In Center
<%= link_to distribution_personlookup_path, class: "btn btn-lg btn-default pull-right" do %>
<div class="col-md-3">
<h3>
<%= link_to distribution_personlookup_path, class: "btn btn-lg btn-default" do %>
<span class="glyphicon glyphicon-search"></span> Walk In Center
<% end %>
</h3>
Expand Down
5 changes: 5 additions & 0 deletions config/initializers/high_voltage.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
HighVoltage.configure do |config|
config.routes = false
# config.home_page = 'home'
# config.route_drawer = HighVoltage::RouteDrawers::Root
end
10 changes: 9 additions & 1 deletion config/routes.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
UsbDistribution::Application.routes.draw do

# if routing the root path, update for your controller
root to: 'pages#show', id: 'home'

resources :events do
resources :attendance_entries, :path => :attendance, shallow: true
get 'swipe'
Expand All @@ -11,12 +14,17 @@

get '/distribution/personlookup', as: :distribution_personlookup

root to: 'distribution#home'
# root to: 'distribution#home'
# get "/pages/*id" => 'pages#show', as: :page, format: false


get '/unauthorized', :to => redirect('/unauthorized.html')
get '/status', :to => redirect('/status.html')
get '/logout', :to => "application#logout"

# High Voltage routes
get "/*id" => 'pages#show', as: :page, format: false

# The priority is based upon order of creation: first created -> highest priority.
# See how all your routes lay out with "rake routes".

Expand Down
7 changes: 7 additions & 0 deletions test/controllers/pages_controller_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
require 'test_helper'

class PagesControllerTest < ActionController::TestCase
# test "the truth" do
# assert true
# end
end
4 changes: 4 additions & 0 deletions test/helpers/pages_helper_test.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
require 'test_helper'

class PagesHelperTest < ActionView::TestCase
end

0 comments on commit 19448ea

Please sign in to comment.