Adding new member report
This commit is contained in:
parent
d61289abaf
commit
04bab84293
|
@ -55,6 +55,11 @@ class UsersController < ApplicationController
|
||||||
@cardless_users = User.includes('cards').where(['users.member_level >= ?','50']).where('cards.id IS NULL')
|
@cardless_users = User.includes('cards').where(['users.member_level >= ?','50']).where('cards.id IS NULL')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
# New members (for emailing out)
|
||||||
|
def new_member_report
|
||||||
|
@new_users = User.where(:created_at => 3.months.ago..Date.today).where(:hidden => false).where(['member_level >= ?','1'])
|
||||||
|
end
|
||||||
|
|
||||||
# GET /users/1
|
# GET /users/1
|
||||||
# GET /users/1.json
|
# GET /users/1.json
|
||||||
def show
|
def show
|
||||||
|
|
|
@ -13,7 +13,7 @@ class Ability
|
||||||
can :read_details, Mac
|
can :read_details, Mac
|
||||||
can [:update], Mac, :user_id => nil
|
can [:update], Mac, :user_id => nil
|
||||||
can [:create,:update], Mac, :user_id => user.id
|
can [:create,:update], Mac, :user_id => user.id
|
||||||
can :read, User, :id => user.id #TODO: why can users update themselves?
|
can [:read,:new_member_report], User, :id => user.id #TODO: why can users update themselves? Maybe because Devise doesn't check users/edit?
|
||||||
can :read, UserCertification, :user_id => user.id
|
can :read, UserCertification, :user_id => user.id
|
||||||
|
|
||||||
# Instructors can manage certs and see users
|
# Instructors can manage certs and see users
|
||||||
|
|
|
@ -1,15 +1,17 @@
|
||||||
<h1>HeatSync People</h1>
|
<h1>HeatSync People</h1>
|
||||||
|
|
||||||
<% if can? :create, User %>
|
<% if can? :create, User %>
|
||||||
<%= link_to 'New User', new_user_path %>
|
<%= link_to 'New User', new_user_path %> |
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if can? :manage, User %>
|
<% if can? :manage, User %>
|
||||||
| <%= link_to 'Merge Users', users_merge_path %>
|
<%= link_to 'Merge Users', users_merge_path %> |
|
||||||
<% end %>
|
<% end %>
|
||||||
<% if current_user.admin? %>
|
<% if current_user.admin? %>
|
||||||
| <%= link_to 'Inactive Users', users_inactive_path %>
|
<%= link_to 'Inactive Users', users_inactive_path %> |
|
||||||
| <%= link_to 'Recent Activity', users_activity_path %>
|
<%= link_to 'Recent Activity', users_activity_path %> |
|
||||||
<% end %>
|
<% end %>
|
||||||
|
<%= link_to 'New Members Report', users_new_member_report_path %>
|
||||||
|
|
||||||
<% @certifications = Certification.all.sort_by(&:id) %>
|
<% @certifications = Certification.all.sort_by(&:id) %>
|
||||||
<table>
|
<table>
|
||||||
<col />
|
<col />
|
||||||
|
|
24
app/views/users/new_member_report.html.erb
Normal file
24
app/views/users/new_member_report.html.erb
Normal file
|
@ -0,0 +1,24 @@
|
||||||
|
<h1>New Members</h1>
|
||||||
|
<% if !@new_users.blank? %>
|
||||||
|
<% @new_users.sort_by(&:created_at).reverse!.group_by{|u| u.created_at.beginning_of_month}.each do |g| %>
|
||||||
|
<h2><%= g.first.to_formatted_s(:month_and_year) %></h2>
|
||||||
|
<% g.last.each do |user| %>
|
||||||
|
<p><b><%= user.name %> - <%= user.member_level_string %></b></p>
|
||||||
|
<p><b>What skills, knowledge and experience do you bring to the community?</b><br/>
|
||||||
|
<%= user.current_skills %>
|
||||||
|
</p>
|
||||||
|
<p><b>
|
||||||
|
What skills, knowledge and experiences are you looking for in HeatSync?
|
||||||
|
</b><br/>
|
||||||
|
<%= user.desired_skills %>
|
||||||
|
</p>
|
||||||
|
<p><b>
|
||||||
|
How'd you find out about HeatSync?
|
||||||
|
</b><br/>
|
||||||
|
<%= user.marketing_source %>
|
||||||
|
</p>
|
||||||
|
<p> </p>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
<% end %>
|
||||||
|
|
2
config/initializers/dates.rb
Normal file
2
config/initializers/dates.rb
Normal file
|
@ -0,0 +1,2 @@
|
||||||
|
Date::DATE_FORMATS[:month_and_year] = "%B %Y"
|
||||||
|
Time::DATE_FORMATS[:month_and_year] = "%B %Y"
|
|
@ -31,6 +31,7 @@ Dooraccess::Application.routes.draw do
|
||||||
|
|
||||||
match 'user_summary/:id' => 'users#user_summary' # User summary view
|
match 'user_summary/:id' => 'users#user_summary' # User summary view
|
||||||
match 'users/activity' => 'users#activity' # User activity
|
match 'users/activity' => 'users#activity' # User activity
|
||||||
|
match 'users/new_member_report' => 'users#new_member_report' # New member report (For emailing)
|
||||||
match 'users/merge' => 'users#merge_view', :via => :get # Merge view
|
match 'users/merge' => 'users#merge_view', :via => :get # Merge view
|
||||||
match 'users/merge' => 'users#merge_action', :via => :post # Merge action
|
match 'users/merge' => 'users#merge_action', :via => :post # Merge action
|
||||||
match 'users/inactive' => 'users#inactive' # Inactive users report
|
match 'users/inactive' => 'users#inactive' # Inactive users report
|
||||||
|
|
Loading…
Reference in New Issue
Block a user