Module: Chaltron::UsersHelper

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

Instance Method Summary collapse

Instance Method Details



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'app/helpers/chaltron/users_helper.rb', line 11

def display_side_filter_link(url, active, text, count)

  klass = 'list-group-item list-group-item-action'
  klass += ' active' if active

  badge_klass = 'badge badge-pill float-right'
  if active
    badge_klass += ' badge-light'
  else
    badge_klass += ' badge-primary'
  end

  link_to url, class: klass do
    (:span, count, class: badge_klass) + text
  end

end

#display_username(user) ⇒ Object



2
3
4
5
6
7
8
9
# File 'app/helpers/chaltron/users_helper.rb', line 2

def display_username(user)
  if user == current_user
    link_to(user.username, user) + ' '.html_safe +
      (:span, I18n.t('chaltron.users.it_s_you'), class: 'badge badge-success')
  else
    link_to user.username, user
  end
end