Module: UsersHelper

Defined in:
app/helpers/users_helper.rb

Instance Method Summary (collapse)

Instance Method Details

- (Object) project_users_select_tag(user_element, default_name = nil)



36
37
38
39
# File 'app/helpers/users_helper.rb', line 36

def project_users_select_tag(user_element, default_name = nil)
  user_id_list = User.in_project(sessions_current_project_id)
  user_select_tag(user_element, user_id_list, default_name)
end

- (Object) user_last_seen_tag(user)



15
16
17
18
19
20
21
# File 'app/helpers/users_helper.rb', line 15

def user_last_seen_tag(user)
  if !user..blank?
    time_ago_in_words(user.) + '  ago'
  else
    (:em, 'never')
  end
end


7
8
9
10
11
12
13
# File 'app/helpers/users_helper.rb', line 7

def user_link(user)
  if sessions_current_user == user || sessions_current_user.is_administrator?
    link_to(user_tag(user), user)
  else
     :span, user_tag(user), class: :subtle
  end
end

- (HTML) user_select_tag(user_element, user_id_list, default_name = nil)

Parameters:

  • user_element (Symbol, String)
  • user_id_list (Array)
  • default_name, (String)

    if supplied, must be a user.name, user.email, or user.if

Returns:

  • (HTML)


27
28
29
30
31
32
33
34
# File 'app/helpers/users_helper.rb', line 27

def user_select_tag(user_element, user_id_list, default_name = nil)
  select_tag(user_element,
             options_for_select(user_id_list
                                  .collect { |u| [User.find(u).name, User.find(u).id] }
                                  .unshift(['All users', 'All users']),
                                default_name))

end

- (Object) user_select_tag_2(user_element, *users)



41
42
43
44
45
46
# File 'app/helpers/users_helper.rb', line 41

def user_select_tag_2(user_element, *users)
  a = users
  select_tag(user_element, options_for_select(User
                                                .in_project(sessions_current_project_id)
                                                .collect { |u| [User.find(u).name, User.find(u).id] }))
end

- (Object) user_tag(user)



3
4
5
# File 'app/helpers/users_helper.rb', line 3

def user_tag(user)
  user.name
end