Module: Admin::UsersHelper

Defined in:
app/helpers/admin/users_helper.rb

Overview

Fat Free CRM Copyright © 2008-2011 by Michael Dvorkin

This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details.

You should have received a copy of the GNU Affero General Public License along with this program. If not, see <www.gnu.org/licenses/>.


Instance Method Summary collapse

Instance Method Details




31
32
33
# File 'app/helpers/admin/users_helper.rb', line 31

def link_to_confirm(user)
  link_to(t(:delete) + "?", confirm_admin_user_path(user), :method => :get, :remote => true)
end



25
26
27
28
# File 'app/helpers/admin/users_helper.rb', line 25

def link_to_reactivate(user)
  name = user.awaits_approval? ? t(:approve) + "!" : t(:reactivate) + "!"
  link_to(name, reactivate_admin_user_path(user), :method => :put, :remote => true)
end


20
21
22
# File 'app/helpers/admin/users_helper.rb', line 20

def link_to_suspend(user)
  link_to(t(:suspend) + "!", suspend_admin_user_path(user), :method => :put, :remote => true)
end

#user_summary(user) ⇒ Object

User summary info for RSS/ATOM feeds.




37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
# File 'app/helpers/admin/users_helper.rb', line 37

def user_summary(user)
  summary = []
  title_and_company = user.title.blank? ? '' : h(user.title)
  title_and_company << " #{t(:at)} #{user.company}" unless user.company.blank?
  summary << title_and_company unless title_and_company.blank?
  summary << t('pluralize.login', user.) if user.last_request_at && user. > 0
  summary << user.email
  summary << "#{t :phone_small}: #{user.phone}" unless user.phone.blank?
  summary << "#{t :mobile_small}: #{user.mobile}" unless user.mobile.blank?
  summary << if !user.suspended?
    t(:user_since, l(user.created_at.to_date, :format => :mmddyy))
  elsif user.awaits_approval?
    t(:user_signed_up_on, l(user.created_at, :format => :mmddhhss))
  else
    t(:user_suspended_on, l(user.created_at.to_date, :format => :mmddyy))
  end
  summary << if user.awaits_approval?
    t(:user_signed_up)
  elsif user.suspended?
    t(:user_suspended)
  elsif user.admin?
    t(:user_admin)
  else
    t(:user_active)
  end
  summary.join(', ')
end