Module: Chaltron::UsersHelper
- Defined in:
- app/helpers/chaltron/users_helper.rb
Instance Method Summary collapse
- #display_side_filter_link(url, active, text, count) ⇒ Object
- #display_username(user, link = true) ⇒ Object
Instance Method Details
#display_side_filter_link(url, active, text, count) ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'app/helpers/chaltron/users_helper.rb', line 16 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 content_tag(:span, count, class: badge_klass) + text end end |
#display_username(user, link = true) ⇒ Object
2 3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/chaltron/users_helper.rb', line 2 def display_username(user, link = true) capture do if link concat link_to(user.username, user) else concat content_tag(:span, user.username) end concat content_tag(:span, I18n.t('chaltron.users.it_s_you'), class: 'badge badge-success ml-2') if user == current_user concat content_tag :span, t('.disabled'), class: 'badge badge-danger ml-2' if user.disabled? end end |