Updating user index with new layout

This commit is contained in:
Will Bradley 2014-04-10 20:47:25 -07:00
parent 8f069cee4d
commit bedd80d555
5 changed files with 23 additions and 22 deletions

View File

@ -1,6 +1,7 @@
class UsersController < ApplicationController class UsersController < ApplicationController
load_and_authorize_resource load_and_authorize_resource
before_filter :authenticate_user! before_filter :authenticate_user!
layout 'resources'
def sort_by_cert(certs,id) def sort_by_cert(certs,id)
result = 0 result = 0

View File

@ -25,6 +25,8 @@
font-weight: bold; left: 10px; } font-weight: bold; left: 10px; }
.resource .thumbnail .disposed { color: red; } .resource .thumbnail .disposed { color: red; }
.resource .thumbnail h4 { position: absolute; bottom: 1px; margin-bottom: 1px; } .resource .thumbnail h4 { position: absolute; bottom: 1px; margin-bottom: 1px; }
.col_highlight { background-color: #f9f9f9; }
</style> </style>

View File

@ -1,23 +1,25 @@
<h1>HeatSync People</h1> <h1>HeatSync People</h1>
<p>
<% if can? :create, User %> <% if can? :create, User %>
<%= link_to 'New User', new_user_path %> | <%= link_to 'New User', new_user_path, class: "btn btn-success" %>
<% end %> <% end %>
<% if can? :manage, User %> <% if can? :manage, User %>
<%= link_to 'Merge Users', users_merge_path %> | <%= link_to 'Merge Users', users_merge_path, class: "btn btn-primary" %>
<% end %> <% end %>
<% if current_user.admin? %> <% if current_user.admin? %>
<%= link_to 'Inactive Users', users_inactive_path %> | <%= link_to 'Inactive Users', users_inactive_path, class: "btn btn-default" %>
<% end %> <% end %>
<% if can? :activity, User %> <% if can? :activity, User %>
<%= link_to 'Recent Activity', users_activity_path %> | <%= link_to 'Recent Activity', users_activity_path, class: "btn btn-default" %>
<% end %> <% end %>
<% if can? :new_member_report, User %> <% if can? :new_member_report, User %>
<%= link_to 'New Members Report', users_new_member_report_path %> <%= link_to 'New Members Report', users_new_member_report_path, class: "btn btn-default" %>
<% end %> <% end %>
</p>
<% @certifications = Certification.all.sort_by(&:id) %> <% @certifications = Certification.all.sort_by(&:id) %>
<table> <table class="table table-hover">
<col /> <col />
<col /> <col />
<% if current_user.admin? then %><col /><% end %> <% if current_user.admin? then %><col /><% end %>
@ -47,14 +49,12 @@
<% @certifications.each do |c| %> <% @certifications.each do |c| %>
<th><a href="?full=full&sort=cert&cert=<%= c.id %>"><%= c.name %></a></th> <th><a href="?full=full&sort=cert&cert=<%= c.id %>"><%= c.name %></a></th>
<% end %> <% end %>
<th></th>
<th></th>
</tr> </tr>
<% if !@users.blank? %> <% if !@users.blank? %>
<% @users.each do |user| %> <% @users.each do |user| %>
<tr<%= ' class=hidden' if user.hidden? %>> <tr<%= ' class=hidden' if user.hidden? %>>
<td><%= image_tag user.gravatar_url(:default => "http://members.heatsynclabs.org/assets/nil.png"), :class => :avatar %></td> <td><%= image_tag user.gravatar_url(:size => 25,:default => "http://members.heatsynclabs.org/assets/nil.png"), :class => :avatar %></td>
<td><%= link_to user.name, user %></td> <td><%= link_to user.name, user %></td>
<td><%= raw(user.member_status_symbol) %></td> <td><%= raw(user.member_status_symbol) %></td>
<% if current_user.admin? then %><td><%= user.email %></td><% end %> <% if current_user.admin? then %><td><%= user.email %></td><% end %>
@ -74,8 +74,6 @@
<% end %> <% end %>
</td> </td>
<% end %> <% end %>
<td><%= link_to 'Edit', edit_user_path(user) if can? :update, user %></td>
<td><%= link_to 'Destroy', user, :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE USER FROM THE DOOR SYSTEM! DISABLE THEM FIRST.', :method => :delete if can? :destroy, user %></td>
</tr> </tr>
<% end %> <% end %>
<% end %> <% end %>

View File

@ -6,9 +6,12 @@
<%= link_to image_tag('/facebook.png', :class => 'social-icon', :title => "Facebook"), @user.facebook_url, :class => 'social-link' if @user.facebook_url.present? %> <%= link_to image_tag('/facebook.png', :class => 'social-icon', :title => "Facebook"), @user.facebook_url, :class => 'social-link' if @user.facebook_url.present? %>
<%= link_to image_tag('/github.png', :class => 'social-icon', :title => "Github"), @user.github_url, :class => 'social-link' if @user.github_url.present? %> <%= link_to image_tag('/github.png', :class => 'social-icon', :title => "Github"), @user.github_url, :class => 'social-link' if @user.github_url.present? %>
<%= link_to image_tag('/website.png', :class => 'social-icon', :title => "Website"), @user.website_url, :class => 'social-link' if @user.website_url.present? %> <%= link_to image_tag('/website.png', :class => 'social-icon', :title => "Website"), @user.website_url, :class => 'social-link' if @user.website_url.present? %>
<%= link_to "Email User", user_compose_email_path(@user), :class => 'btn' %>
</h2>
<%= link_to 'Back', :back, :class => 'btn btn-default' %>
<%= link_to 'Email User', user_compose_email_path(@user), :class => 'btn btn-default' %>
<%= link_to 'Edit', edit_user_path(@user), class: "btn btn-primary" if can? :update, @user %>
<%= link_to 'Destroy', @user, class: "btn btn-danger", :confirm => 'Are you sure? WARNING: THIS DOES NOT REMOVE THE USER FROM THE DOOR SYSTEM! DISABLE THEM FIRST.', :method => :delete if can? :destroy, @user %>
</h2>
<% if current_user.admin? || @user.email_visible %> <% if current_user.admin? || @user.email_visible %>
<p> <p>
@ -77,7 +80,7 @@
</p> </p>
<% end %> <% end %>
<b>Certifications: </b><%= link_to "+ Add", (new_user_certification_path+"?user="+@user.id.to_s), :class => 'btn' if can? :create, UserCertification %> <b>Certifications: </b><%= link_to "+ Add", (new_user_certification_path+"?user="+@user.id.to_s), :class => 'btn btn-default' if can? :create, UserCertification %>
<ul> <ul>
<% @user.certifications.each do |certification| %> <% @user.certifications.each do |certification| %>
<li><%= link_to certification.name, certification %></li> <li><%= link_to certification.name, certification %></li>
@ -85,7 +88,7 @@
<% if @user.certifications.blank? %><li>n/a</li><% end %> <% if @user.certifications.blank? %><li>n/a</li><% end %>
</ul> </ul>
<p> <p>
<b>Card: </b><%= link_to "+ Add", (new_card_path+"?user="+@user.id.to_s), :class => 'btn' if can? :create, Card %> <b>Card: </b><%= link_to "+ Add", (new_card_path+"?user="+@user.id.to_s), :class => 'btn btn-default' if can? :create, Card %>
<% if current_user.admin? then %> <% if current_user.admin? then %>
<ul> <ul>
<% @user.cards.each do |c| %> <% @user.cards.each do |c| %>
@ -97,7 +100,7 @@
<% end %> <% end %>
</p> </p>
<b>Computers: </b><%= link_to "+ Add", new_mac_path, :class => 'btn' if can? :create, Mac %> <b>Computers: </b><%= link_to "+ Add", new_mac_path, :class => 'btn btn-default' if can? :create, Mac %>
<ul> <ul>
<% @user.macs.each do |mac| %> <% @user.macs.each do |mac| %>
<li><%= link_to mac.mac, mac %></li> <li><%= link_to mac.mac, mac %></li>
@ -166,7 +169,7 @@ margin-right: auto;
.clearfix { clear: both } .clearfix { clear: both }
</style> </style>
<b>Resources: </b><%= link_to "+ Add", new_resource_path, :class => 'btn' if can? :create, Resource %> <b>Resources: </b><%= link_to "+ Add", new_resource_path, :class => 'btn btn-default' if can? :create, Resource %>
<div class="row"><%= render @user.resources if @user.resources %></div> <div class="row"><%= render @user.resources if @user.resources %></div>
<div class="clearfix"></div> <div class="clearfix"></div>
</p> </p>
@ -174,7 +177,7 @@ margin-right: auto;
<p> <p>
<b>Waiver?</b> <b>Waiver?</b>
<%= @user.waiver.strftime("%B %d %Y") unless @user.waiver.blank? %><br/> <%= @user.waiver.strftime("%B %d %Y") unless @user.waiver.blank? %><br/>
<b>Contracts:</b> <%= link_to "+ Add", new_contract_path, :class => 'btn' if can? :create, Contract %> <b>Contracts:</b> <%= link_to "+ Add", new_contract_path, :class => 'btn btn-default' if can? :create, Contract %>
<ul> <ul>
<% @user.contracts.each do |contract| %> <% @user.contracts.each do |contract| %>
<li> <li>
@ -204,6 +207,3 @@ margin-right: auto;
<%= @user.current_sign_in_at %> <%= @user.current_sign_in_at %>
</p> </p>
<% end %> <% end %>
<% if can? :update, @user then %><%= link_to 'Edit', edit_user_path(@user) %> |<% end %>
<%= link_to 'Back', users_path %>

View File

@ -33,7 +33,7 @@
<h1>HeatSync People <h1>HeatSync People
<%= link_to 'New User', new_user_path, class: "btn btn-success" if can? :create, User %> <%= link_to 'New User', new_user_path, class: "btn btn-success" if can? :create, User %>
<%= link_to 'Merge Users', users_merge_path, class: "btn btn-default" if can? :manage, User %> <%= link_to 'Merge Users', users_merge_path, class: "btn btn-primary" if can? :manage, User %>
</h1> </h1>