Creating sweet user summary page
This commit is contained in:
parent
17aa2b971c
commit
03a0588073
|
@ -19,7 +19,6 @@ pre {
|
||||||
font-size: 11px;
|
font-size: 11px;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
div {
|
div {
|
||||||
&.field, &.actions {
|
&.field, &.actions {
|
||||||
margin-bottom: 10px;
|
margin-bottom: 10px;
|
||||||
|
|
|
@ -17,10 +17,11 @@ class UsersController < ApplicationController
|
||||||
def index
|
def index
|
||||||
unless params[:full] # by default, show summary
|
unless params[:full] # by default, show summary
|
||||||
|
|
||||||
@users = @users.joins(:payments).where("payments.date > ?", (DateTime.now - 60.days)).uniq
|
@users = @users.paying + @users.volunteer
|
||||||
|
#.joins(:payments).where("payments.date > ? OR ", (DateTime.now - 60.days)).uniq
|
||||||
|
|
||||||
respond_to do |format|
|
respond_to do |format|
|
||||||
format.html { render 'summary' }
|
format.html { render 'summary', layout: 'resources' }
|
||||||
format.json { render :json => @users }
|
format.json { render :json => @users }
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
@ -7,4 +7,25 @@ module ApplicationHelper
|
||||||
sort_dir = params[:dir] == 'up' ? 'down' : 'up'
|
sort_dir = params[:dir] == 'up' ? 'down' : 'up'
|
||||||
link_to_unless condition, title, request.parameters.merge( {:sort => column, :dir => sort_dir} )
|
link_to_unless condition, title, request.parameters.merge( {:sort => column, :dir => sort_dir} )
|
||||||
end
|
end
|
||||||
|
|
||||||
|
def li_link_to(name = nil, options = nil, html_options = nil, &block)
|
||||||
|
html_options, options, name = options, name, block if block_given?
|
||||||
|
options ||= {}
|
||||||
|
|
||||||
|
html_options = convert_options_to_data_attributes(options, html_options)
|
||||||
|
|
||||||
|
url = url_for(options)
|
||||||
|
html_options['href'] ||= url
|
||||||
|
|
||||||
|
if current_page?(url)
|
||||||
|
content_tag(:li, class: "active") do
|
||||||
|
content_tag(:a, name || url, html_options, &block)
|
||||||
|
end
|
||||||
|
else
|
||||||
|
content_tag(:li) do
|
||||||
|
content_tag(:a, name || url, html_options, &block)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
||||||
end
|
end
|
||||||
|
|
|
@ -18,6 +18,9 @@ class User < ActiveRecord::Base
|
||||||
has_many :macs
|
has_many :macs
|
||||||
has_many :resources
|
has_many :resources
|
||||||
|
|
||||||
|
scope :volunteer, -> { where('member_level >= 10 AND member_level < 25') }
|
||||||
|
scope :paying, -> { joins(:payments).where("payments.date > ?", (DateTime.now - 90.days)).uniq }
|
||||||
|
|
||||||
validates_format_of [:twitter_url, :facebook_url, :github_url, :website_url], :with => URI::regexp(%w(http https)), :allow_blank => true
|
validates_format_of [:twitter_url, :facebook_url, :github_url, :website_url], :with => URI::regexp(%w(http https)), :allow_blank => true
|
||||||
|
|
||||||
# disable # validates_presence_of :postal_code
|
# disable # validates_presence_of :postal_code
|
||||||
|
|
|
@ -33,9 +33,14 @@
|
||||||
<%= link_to 'Membership Application', new_user_registration_path unless user_signed_in? %>
|
<%= link_to 'Membership Application', new_user_registration_path unless user_signed_in? %>
|
||||||
</div>
|
</div>
|
||||||
<div id="content">
|
<div id="content">
|
||||||
|
<% if notice %>
|
||||||
<p class="notice"><%= raw(notice) %></p>
|
<p class="notice"><%= raw(notice) %></p>
|
||||||
|
<% end %>
|
||||||
|
<% if alert %>
|
||||||
<p class="alert"><%= raw(alert) %></p>
|
<p class="alert"><%= raw(alert) %></p>
|
||||||
<%= yield %>
|
<% end %>
|
||||||
|
|
||||||
|
<%= yield %>
|
||||||
</div>
|
</div>
|
||||||
<%= raw Setting.analytics_code if Setting.present? %>
|
<%= raw Setting.analytics_code if Setting.present? %>
|
||||||
</body>
|
</body>
|
||||||
|
|
|
@ -60,18 +60,23 @@
|
||||||
|
|
||||||
<div class="collapse navbar-collapse" id="mainmenu-collapse">
|
<div class="collapse navbar-collapse" id="mainmenu-collapse">
|
||||||
<ul class="nav navbar-nav">
|
<ul class="nav navbar-nav">
|
||||||
<li>
|
<% if can? :read, User %>
|
||||||
<%= link_to 'People', users_path if can? :read, User %>
|
<li class="dropdown <%= "active" if current_page?(controller: :users) %>">
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">People <b class="caret"></b></a>
|
||||||
|
<ul class="dropdown-menu">
|
||||||
|
<%= li_link_to 'People', users_path if can? :read, User %>
|
||||||
|
<%= li_link_to 'People - Full Table View', {:controller => "users", :full => "full"} if can? :read, User %>
|
||||||
|
<%= li_link_to 'Inactive Users', users_inactive_path if can? :inactive_report, User %>
|
||||||
|
<%= li_link_to 'Recent Activity', users_activity_path if can? :activity, User %>
|
||||||
|
<%= li_link_to 'New Members Report', users_new_member_report_path if can? :new_member_report, User %>
|
||||||
|
</ul>
|
||||||
</li>
|
</li>
|
||||||
<li class="active">
|
<% end %>
|
||||||
<%= link_to 'Tools & Resources', resources_path if can? :read, Resource %>
|
<%= li_link_to 'Tools & Resources', resources_path if can? :read, Resource %>
|
||||||
</li>
|
<%= li_link_to 'Doors', cards_path if can? :manage, Card %>
|
||||||
<li>
|
|
||||||
<%= link_to 'Access Cards', cards_path if can? :manage, Card %>
|
|
||||||
</li>
|
|
||||||
<li class="dropdown">
|
|
||||||
<% if can? :create, UserCertification %>
|
<% if can? :create, UserCertification %>
|
||||||
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Certifications <b class="caret"></b></a>
|
<li class="dropdown <%= 'active' if current_page?(controller: :certifications) %>" >
|
||||||
|
<a href="#" class="dropdown-toggle" data-toggle="dropdown">Certs <b class="caret"></b></a>
|
||||||
<ul class="dropdown-menu">
|
<ul class="dropdown-menu">
|
||||||
<li>
|
<li>
|
||||||
<%= link_to 'Classes', certifications_path if can? :read, Certification %>
|
<%= link_to 'Classes', certifications_path if can? :read, Certification %>
|
||||||
|
@ -80,31 +85,17 @@
|
||||||
<%= link_to 'User Certs', user_certifications_path if can? :create, UserCertification %>
|
<%= link_to 'User Certs', user_certifications_path if can? :create, UserCertification %>
|
||||||
</li>
|
</li>
|
||||||
</ul>
|
</ul>
|
||||||
|
</li>
|
||||||
<% else %>
|
<% else %>
|
||||||
<%= link_to 'Certifications', certifications_path if can? :read, Certification %>
|
<%= li_link_to 'Certifications', certifications_path if can? :read, Certification %>
|
||||||
<% end %>
|
<% end %>
|
||||||
</li>
|
<%= li_link_to 'Computers', macs_path if user_signed_in? || (can? :read, Mac) %>
|
||||||
<li>
|
<%= li_link_to 'Payments', payments_path if can? :create, Payment %>
|
||||||
<%= link_to 'Payments', payments_path if can? :create, Payment %>
|
<%= li_link_to 'Settings', settings_path if can? :read, Setting %>
|
||||||
</li>
|
<%= li_link_to 'Profile', edit_user_registration_path if user_signed_in? %>
|
||||||
<li>
|
<%= li_link_to 'Logout', destroy_user_session_path, :method => :delete if user_signed_in? %>
|
||||||
<%= link_to 'Computers', macs_path if user_signed_in? || (can? :read, Mac) %>
|
<%= li_link_to 'Login', new_user_session_path unless user_signed_in? %>
|
||||||
</li>
|
<%= li_link_to 'Membership Application', new_user_registration_path unless user_signed_in? %>
|
||||||
<li>
|
|
||||||
<%= link_to 'Settings', settings_path if can? :read, Setting %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<% if user_signed_in? then %><%= link_to 'Profile', edit_user_registration_path %><% end %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<%= link_to 'Logout', destroy_user_session_path, :method => :delete if user_signed_in? %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<%= link_to 'Login', new_user_session_path unless user_signed_in? %>
|
|
||||||
</li>
|
|
||||||
<li>
|
|
||||||
<%= link_to 'Membership Application', new_user_registration_path unless user_signed_in? %>
|
|
||||||
</li>
|
|
||||||
</ul>
|
</ul>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,13 +1,15 @@
|
||||||
<h1 class="col-sm-6">Lab Resources
|
<div class="row">
|
||||||
|
<h1 class="col-md-8">Lab Resources
|
||||||
<%= link_to 'Add Resource', new_resource_path, :class => "btn btn-success" if can? :create, Resource %>
|
<%= link_to 'Add Resource', new_resource_path, :class => "btn btn-success" if can? :create, Resource %>
|
||||||
<%= link_to 'Categories', resource_categories_path, :class => "btn btn-primary" if can? :read, ResourceCategory %>
|
<%= link_to 'Categories', resource_categories_path, :class => "btn btn-primary" if can? :read, ResourceCategory %>
|
||||||
<a class="btn btn-default" onclick="$('#accordion .collapse').collapse('toggle')" />Expand/Collapse All</a>
|
<a class="btn btn-default" onclick="$('#accordion .collapse').collapse('toggle')" />Expand/Collapse All</a>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<span class="col-sm-2">
|
<span class="col-md-2 col-xs-6">
|
||||||
<h3>Featured item:</h3>
|
<h3>Featured item:</h3>
|
||||||
<%= render @featured_resource %>
|
<%= render @featured_resource %>
|
||||||
</span>
|
</span>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="row">
|
<div class="row">
|
||||||
<% unless @resources.blank? %>
|
<% unless @resources.blank? %>
|
||||||
|
@ -22,7 +24,7 @@
|
||||||
<div id="collapse_cat_<%= resource_category.id %>" class="panel-collapse collapse">
|
<div id="collapse_cat_<%= resource_category.id %>" class="panel-collapse collapse">
|
||||||
<div class="panel-body">
|
<div class="panel-body">
|
||||||
<% resources.each do |resource| %>
|
<% resources.each do |resource| %>
|
||||||
<div class="col-sm-2">
|
<div class="col-xs-2">
|
||||||
<%= render resource %>
|
<%= render resource %>
|
||||||
</div>
|
</div>
|
||||||
<% end %>
|
<% end %>
|
||||||
|
|
5
app/views/users/_badges.html.erb
Normal file
5
app/views/users/_badges.html.erb
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
<%= raw(user.member_status_symbol) %>
|
||||||
|
<%= link_to image_tag('/twitter.png', :class => 'social-icon', :title => "Twitter"), user.twitter_url, :class => 'social-link' if user.twitter_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('/website.png', :class => 'social-icon', :title => "Website"), user.website_url, :class => 'social-link' if user.website_url.present? %>
|
|
@ -1,6 +1,8 @@
|
||||||
<div class="thumbnail col-lg-1 col-sm-2 col-xs-4">
|
<div class="thumbnail col-lg-1 col-sm-2 col-xs-4">
|
||||||
<%= image_tag user.gravatar_url(:default => "http://members.heatsynclabs.org/pirate.png") %>
|
<%= image_tag user.gravatar_url(:default => "http://members.heatsynclabs.org/pirate.png") %>
|
||||||
<span class="badges"><%= raw(user.member_status_symbol) %></span>
|
<span class="badges">
|
||||||
|
<%= render partial: 'badges', locals: {user: user} %>
|
||||||
|
</span>
|
||||||
|
|
||||||
<h4><%= link_to user.name, user %></h4>
|
<h4><%= link_to user.name, user %></h4>
|
||||||
</div>
|
</div>
|
||||||
|
|
|
@ -1,41 +1,33 @@
|
||||||
<link href="/bootstrap/css/bootstrap.min.css" type="text/css" rel="stylesheet" />
|
|
||||||
<link href="/bootstrap/css/bootstrap-theme.min.css" type="text/css" rel="stylesheet" />
|
|
||||||
<script src="/bootstrap/js/bootstrap.min.js" type="text/javascript" ></script>
|
|
||||||
|
|
||||||
<style type="text/css">
|
<style type="text/css">
|
||||||
.users .thumbnail {
|
.users .thumbnail {
|
||||||
height: 200px;
|
height: 200px;
|
||||||
position: relative;
|
position: relative;
|
||||||
}
|
}
|
||||||
.users .badges { position: absolute; top: 125px; }
|
.users .badges { position: absolute; bottom: 3em; }
|
||||||
|
.users .badges img {
|
||||||
|
float: left;
|
||||||
|
width: 24px;
|
||||||
|
height: 24px;
|
||||||
|
background-color: white;
|
||||||
|
border-radius: 12px;
|
||||||
|
}
|
||||||
.users .thumbnail h4 { position: absolute; bottom: 1px; margin-bottom: 1px; }
|
.users .thumbnail h4 { position: absolute; bottom: 1px; margin-bottom: 1px; }
|
||||||
|
|
||||||
</style>
|
</style>
|
||||||
|
|
||||||
|
<% if user_signed_in? && current_user.current_sign_in_at < Date.parse("2014-03-01") %>
|
||||||
|
<div class="alert alert-info">Looking for the old table view? Find it in the menu under People, Full Table View.</div>
|
||||||
|
<% end %>
|
||||||
|
|
||||||
<h1>HeatSync People
|
<h1>HeatSync People
|
||||||
<%= link_to 'Full Table View', {:controller => "users", :full => "full"}, class: "btn btn-primary" %>
|
<%= 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 %>
|
||||||
</h1>
|
</h1>
|
||||||
|
|
||||||
<% if can? :create, User %>
|
|
||||||
<%= link_to 'New User', new_user_path %> |
|
|
||||||
<% end %>
|
|
||||||
<% if can? :manage, User %>
|
|
||||||
<%= link_to 'Merge Users', users_merge_path %> |
|
|
||||||
<% end %>
|
|
||||||
<% if current_user.admin? %>
|
|
||||||
<%= link_to 'Inactive Users', users_inactive_path %> |
|
|
||||||
<% end %>
|
|
||||||
<% if can? :activity, User %>
|
|
||||||
<%= link_to 'Recent Activity', users_activity_path %> |
|
|
||||||
<% end %>
|
|
||||||
<% if can? :new_member_report, User %>
|
|
||||||
<%= link_to 'New Members Report', users_new_member_report_path %>
|
|
||||||
<% end %>
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<div class="users">
|
<div class="users">
|
||||||
<%= render @users.sort_by(&:member_status).reverse %>
|
<%= render @users.sort_by{|u| [-u.member_status, u.name] } %>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<% if current_user.orientation.blank? then %>
|
<% if current_user.orientation.blank? then %>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user