Added nice front page stuff, fixing sqlite issues, adding user payments to profiles

This commit is contained in:
Will Bradley 2013-02-14 00:29:22 -07:00
parent ed75ea0e90
commit cefd4b3878
8 changed files with 44 additions and 6 deletions

View File

@ -6,7 +6,7 @@ def index
@num_users = User.count
@recent_users = User.where("created_at > ?", DateTime.now - 7.days).count
if can? :read, User then
@recent_user_names = User.where("created_at > ?", DateTime.now - 7.days)
@recent_user_names = User.where("member_level > 10").accessible_by(current_ability).order('created_at desc').limit(5)
end
@num_door_opens = DoorLog.where("key = 'G'").count
@today_door_opens = DoorLog.where("key = 'G' AND created_at > ?", DateTime.now - 1.day).count

View File

@ -36,6 +36,7 @@ class UsersController < ApplicationController
# GET /users/1
# GET /users/1.json
def show
@payments = Payment.where(:user_id => @user.id).order('date desc').limit(10)
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @user }

View File

@ -2,6 +2,7 @@
<%= link_to 'New Card', new_card_path if can? :create, Card %>
<%= link_to 'Upload all cards', upload_all_path if can? :upload_all, Card %>
<%= link_to 'Door Logs', door_logs_path if can? :read, DoorLog %>
<p>
<b>Most Active Card Last 7 Days:</b> <%= @most_active_card.name %> (<%= @most_active_card.accesses_this_week %> times)
</p>

View File

@ -1,8 +1,19 @@
<h2>Edit Your Profile</h2>
<h2>Profile:</h2>
<%= devise_error_messages! %>
<div class="payment_links">
<% if can? :read, resource.payments then %>
<h3>Recorded Payments:</h3>
<ul>
<% resource.payments.each do |payment| %>
<li><%= payment.date %></li>
<% end %>
</ul>
<hr/>
<% end %>
<% if resource.payment_method == "Dwolla" %>
<h3>Dwolla Payment Link</h3>
<% if resource.member_level == "25" %>

View File

@ -14,10 +14,10 @@
<tr>
<td>
<% if ((can? :read, @recent_user_names) && (@recent_user_names.count > 1)) then %>
<h2>New People:</h2>
<h2>New People: <em>(say hi!)</em></h2>
<ul>
<% @recent_user_names.each do |user| %>
<li><%= link_to user.name, user %></li>
<li><%= link_to user.name, user %> <%= raw(user.member_status_symbol) %> <em>(Signed up <%= user.created_at.strftime("%b %d") %>)</em></li>
<% end %>
</ul>
<% end %>
@ -45,7 +45,22 @@
<li><%= link_to "IRC", "irc://irc.freenode.net#heatsynclabs" %></li>
<li><%= link_to "Live Webcams", "http://live.heatsynclabs.org/" %></li>
<li>Lab Phone: (480) 751-1929</li>
<li>
<style type="text/css">
form input {font-family: 'Lucida Console', Monaco, monospace; }
</style>
<b>Send a Message!</b>
<form method="post" action="http://tweet.zyphon.com/signage.php">
<em>Type here and your message will show up on the LED sign in the front window!</em><br/>
<em>(Please be nice!)</em><br/>
<input type="text" name="msg" id="msg" value=" Hello" size="9" /> (max 9 chars per line)<br/>
<input type="text" name="msg2" id="msg2" value=" World" size="9" /><br/>
<input type="submit" name="submitbutton" id="submitbutton" value="Go!" />
</form>
</li>
</ul>
</td>
</tr>
</table>

View File

@ -18,7 +18,6 @@
<%= link_to 'Certifications', certifications_path if can? :read, Certification %>
<% end %>
<%= link_to 'Payments', payments_path if can? :read, Payment %>
<%= link_to 'Door Logs', door_logs_path if can? :read, DoorLog %>
<%= link_to 'Computers', macs_path if user_signed_in? && (can? :read, Mac) %>
<% if user_signed_in? then %><%= link_to 'Profile', edit_user_registration_path %><% end %>
<%= link_to 'Logout', destroy_user_session_path, :method => :delete if user_signed_in? %>

View File

@ -92,6 +92,17 @@
<% if @user.certifications.blank? %><li>n/a</li><% end %>
</ul>
<% if current_user.admin? then %>
<p>
<b>Payments:</b>
<ul>
<% @payments.each do |payment| %>
<li><%= payment.date %></li>
<% end %>
</ul>
</p>
<% end %>
<% if current_user.admin? then %>
<p>
<b>Created:</b>

View File

@ -22,4 +22,4 @@ production:
adapter: sqlite3
database: db/production.sqlite3
pool: 5
timeout: 300000
timeout: 5000