Module: IevkitViews::ApplicationHelper
- Included in:
- Report
- Defined in:
- app/helpers/ievkit_views/application_helper.rb
Instance Method Summary collapse
- #badge_count(datas, type = nil, *status) ⇒ Object
- #get_icon(name, count_error = 0, count_warning = 0) ⇒ Object
- #get_icon_title(name, count_error = 0, count_warning = 0) ⇒ Object
Instance Method Details
#badge_count(datas, type = nil, *status) ⇒ Object
3 4 5 6 |
# File 'app/helpers/ievkit_views/application_helper.rb', line 3 def badge_count(datas, type = nil, *status) datas = datas.select{ |d| status.include? d[:status] } type ? datas.count{ |d| d[:type] == type } : datas.count end |
#get_icon(name, count_error = 0, count_warning = 0) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'app/helpers/ievkit_views/application_helper.rb', line 8 def get_icon(name, count_error = 0, count_warning = 0) return 'question-sign' unless name.present? name = name.to_sym.downcase if name == :error && count_error > 0 'minus-sign' elsif name == :warning || (count_warning > 0 && name != :ignored) 'warning-sign' elsif name == :ignored 'ban-circle' else 'ok-sign' end end |
#get_icon_title(name, count_error = 0, count_warning = 0) ⇒ Object
22 23 24 25 26 27 28 29 30 |
# File 'app/helpers/ievkit_views/application_helper.rb', line 22 def get_icon_title(name, count_error = 0, count_warning = 0) name = name.to_sym.downcase fs_status = if (count_warning > 0 && name != :ignored) 'warning' else name.to_s end I18n.t("report.icons.#{fs_status.downcase}_txt", default: fs_status.to_s.humanize) end |