From cefd4b38782b452cc32d563b1fb180818605beb5 Mon Sep 17 00:00:00 2001 From: Will Bradley Date: Thu, 14 Feb 2013 00:29:22 -0700 Subject: [PATCH] Added nice front page stuff, fixing sqlite issues, adding user payments to profiles --- app/controllers/home_controller.rb | 2 +- app/controllers/users_controller.rb | 1 + app/views/cards/index.html.erb | 1 + app/views/devise/registrations/edit.html.erb | 13 ++++++++++++- app/views/home/index.html.erb | 19 +++++++++++++++++-- app/views/layouts/application.html.erb | 1 - app/views/users/show.html.erb | 11 +++++++++++ config/database.yml | 2 +- 8 files changed, 44 insertions(+), 6 deletions(-) diff --git a/app/controllers/home_controller.rb b/app/controllers/home_controller.rb index 7d19623..da2d5ef 100644 --- a/app/controllers/home_controller.rb +++ b/app/controllers/home_controller.rb @@ -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 diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb index 6e2e609..7a6571b 100644 --- a/app/controllers/users_controller.rb +++ b/app/controllers/users_controller.rb @@ -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 } diff --git a/app/views/cards/index.html.erb b/app/views/cards/index.html.erb index 59779f6..7ea1368 100644 --- a/app/views/cards/index.html.erb +++ b/app/views/cards/index.html.erb @@ -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 %>

Most Active Card Last 7 Days: <%= @most_active_card.name %> (<%= @most_active_card.accesses_this_week %> times)

diff --git a/app/views/devise/registrations/edit.html.erb b/app/views/devise/registrations/edit.html.erb index de75463..aca11bf 100644 --- a/app/views/devise/registrations/edit.html.erb +++ b/app/views/devise/registrations/edit.html.erb @@ -1,8 +1,19 @@ -

Edit Your Profile

+

Profile:

<%= devise_error_messages! %>