diff --git a/app/assets/stylesheets/application.css b/app/assets/stylesheets/application.css
index 3b5cc66..e184bb7 100644
--- a/app/assets/stylesheets/application.css
+++ b/app/assets/stylesheets/application.css
@@ -11,3 +11,9 @@
*= require_self
*= require_tree .
*/
+table { border-spacing: 0; }
+td, th { padding: 0.5em; }
+.col_highlight { background-color: #ccc; }
+dt { font-weight: bold; }
+.notice { color: green; }
+.alert { color: red; }
diff --git a/app/controllers/user_certifications_controller.rb b/app/controllers/user_certifications_controller.rb
index f531d56..0d59664 100644
--- a/app/controllers/user_certifications_controller.rb
+++ b/app/controllers/user_certifications_controller.rb
@@ -4,6 +4,11 @@ class UserCertificationsController < ApplicationController
load_and_authorize_resource :certification, :through => :user_certification
before_filter :authenticate_user!
+ # Load users and certs based on current ability
+ before_filter :only => [:new, :edit, :create, :update] do
+ @users = User.accessible_by(current_ability).sort_by(&:name)
+ @certifications = Certification.accessible_by(current_ability).sort_by(&:name)
+ end
# GET /user_certifications
# GET /user_certifications.json
@@ -19,6 +24,9 @@ class UserCertificationsController < ApplicationController
# GET /user_certifications/1
# GET /user_certifications/1.json
def show
+ @created_by = User.find(@user_certification.created_by) unless @user_certification.created_by.blank?
+ @updated_by = User.find(@user_certification.updated_by) unless @user_certification.updated_by.blank?
+
respond_to do |format|
format.html # show.html.erb
format.json { render :json => @user_certification }
@@ -28,8 +36,6 @@ class UserCertificationsController < ApplicationController
# GET /user_certifications/new
# GET /user_certifications/new.json
def new
- @users = User.accessible_by(current_ability).sort_by(&:name)
- @certifications = Certification.accessible_by(current_ability).sort_by(&:name)
respond_to do |format|
format.html # new.html.erb
@@ -44,6 +50,9 @@ class UserCertificationsController < ApplicationController
# POST /user_certifications
# POST /user_certifications.json
def create
+ #Log who created this
+ @user_certification.created_by = current_user.id
+
respond_to do |format|
if @user_certification.save
format.html { redirect_to UserCertification, :notice => 'User certification was successfully created.' }
@@ -58,6 +67,9 @@ class UserCertificationsController < ApplicationController
# PUT /user_certifications/1
# PUT /user_certifications/1.json
def update
+ #Log who updated this
+ @user_certification.updated_by = current_user.id
+
respond_to do |format|
if @user_certification.update_attributes(params[:user_certification])
format.html { redirect_to UserCertification, :notice => 'User certification was successfully updated.' }
diff --git a/app/views/cards/index.html.erb b/app/views/cards/index.html.erb
index 5cebebe..53ff18d 100644
--- a/app/views/cards/index.html.erb
+++ b/app/views/cards/index.html.erb
@@ -3,6 +3,11 @@
<%= link_to 'New Card', new_card_path if can? :create, Card %>
<%= link_to 'Upload all cards', upload_all_path if can? :upload_all, Card %>
+
+
+
+
+
User |
Note |
diff --git a/app/views/layouts/application.html.erb b/app/views/layouts/application.html.erb
index 2032197..b682488 100644
--- a/app/views/layouts/application.html.erb
+++ b/app/views/layouts/application.html.erb
@@ -17,6 +17,7 @@
<%= link_to 'Certifications', certifications_path if can? :read, Certification %>
<% end %>
<%= link_to 'Logs', door_logs_path if can? :read, DoorLog %>
+ <% if user_signed_in? then %><%= link_to 'Profile', edit_user_registration_path %><% end %>
<%= link_to 'Sign out', destroy_user_session_path, :method => :delete if user_signed_in? %>
<%= link_to 'Sign in', new_user_session_path unless user_signed_in? %>
diff --git a/app/views/user_certifications/show.html.erb b/app/views/user_certifications/show.html.erb
index 9301f8a..7ffc0db 100644
--- a/app/views/user_certifications/show.html.erb
+++ b/app/views/user_certifications/show.html.erb
@@ -8,6 +8,15 @@
<%= @user_certification.certification.name %>
+
+ Created: by <%= link_to @created_by.name, @created_by unless @created_by.blank? %>
+ at <%= @user_certification.created_at %>
+
+
+
+ Updated: by <%= link_to @updated_by.name, @updated_by unless @updated_by.blank? %>
+ at <%= @user_certification.updated_at %>
+
<%= link_to 'Edit', edit_user_certification_path(@user_certification) %> |
<%= link_to 'Back', user_certifications_path %>
diff --git a/app/views/users/index.html.erb b/app/views/users/index.html.erb
index a3f7ce1..be8d1c3 100644
--- a/app/views/users/index.html.erb
+++ b/app/views/users/index.html.erb
@@ -4,6 +4,15 @@
<%= link_to 'New User', new_user_path %>
<% end %>
+
+
+
+ <% if current_user.admin? %><% end %>
+
+
+
+
+
Name |
Email |
diff --git a/app/views/users/show.html.erb b/app/views/users/show.html.erb
index 99bf233..f0fa713 100644
--- a/app/views/users/show.html.erb
+++ b/app/views/users/show.html.erb
@@ -11,29 +11,29 @@
Waiver?
- <%= @user.waiver %>
+ <%= @user.waiver.strftime("%B %d %Y") unless @user.waiver.blank? %>
<% if current_user.admin? then %>
Orientation?
- <%= @user.orientation %>
+ <%= @user.orientation.strftime("%B %d %Y") unless @user.orientation.blank? %>
<% end %>
Member?
- <%= @user.member %>
+ <%= raw(@user.member_status) %>
Instructor?
- <%= @user.instructor %>
+ <%= @user.instructor? %>
Admin?
- <%= @user.admin %>
+ <%= @user.admin? %>
<% if current_user.admin? then %>
@@ -53,5 +53,5 @@
<% if @user.certifications.blank? %>n/a<% end %>
-<%= link_to 'Edit', edit_user_path(@user) %> |
+<% if can? :update, @user then %><%= link_to 'Edit', edit_user_path(@user) %> |<% end %>
<%= link_to 'Back', users_path %>
diff --git a/db/migrate/20130125133047_add_updated_by_to_user_certifications.rb b/db/migrate/20130125133047_add_updated_by_to_user_certifications.rb
new file mode 100644
index 0000000..2457751
--- /dev/null
+++ b/db/migrate/20130125133047_add_updated_by_to_user_certifications.rb
@@ -0,0 +1,5 @@
+class AddUpdatedByToUserCertifications < ActiveRecord::Migration
+ def change
+ add_column :user_certifications, :updated_by, :integer
+ end
+end
diff --git a/db/migrate/20130125133237_add_created_by_to_user_certifications.rb b/db/migrate/20130125133237_add_created_by_to_user_certifications.rb
new file mode 100644
index 0000000..885c32b
--- /dev/null
+++ b/db/migrate/20130125133237_add_created_by_to_user_certifications.rb
@@ -0,0 +1,5 @@
+class AddCreatedByToUserCertifications < ActiveRecord::Migration
+ def change
+ add_column :user_certifications, :created_by, :integer
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 08238f1..75b7cc3 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -10,7 +10,7 @@
#
# It's strongly recommended to check this file into your version control system.
-ActiveRecord::Schema.define(:version => 20130125124102) do
+ActiveRecord::Schema.define(:version => 20130125133237) do
create_table "cards", :force => true do |t|
t.string "card_number"
@@ -40,6 +40,8 @@ ActiveRecord::Schema.define(:version => 20130125124102) do
t.integer "certification_id"
t.datetime "created_at", :null => false
t.datetime "updated_at", :null => false
+ t.integer "updated_by"
+ t.integer "created_by"
end
create_table "users", :force => true do |t|