Module: Elabs::ContentFiltersHelper
- Defined in:
- app/helpers/elabs/content_filters_helper.rb
Instance Method Summary collapse
- #admin_order_by_link(title, field) ⇒ Object (also: #member_order_by_link)
- #all_filter_link ⇒ Object
- #all_sfw_status_link ⇒ Object
- #nsfw_only_link ⇒ Object
- #order_link(title, field) ⇒ Object
- #render_filters? ⇒ Boolean
- #sfw_only_link ⇒ Object
- #sfw_status_links ⇒ Object
Instance Method Details
#admin_order_by_link(title, field) ⇒ Object Also known as: member_order_by_link
54 55 56 57 58 59 60 61 62 63 64 |
# File 'app/helpers/elabs/content_filters_helper.rb', line 54 def admin_order_by_link(title, field) current_direction = params['order_by'] == field && params['direction'] ? params['direction'] : 'desc' direction = current_direction == 'asc' ? :desc : :asc = { order_by: field, direction: direction } icon = direction == :asc ? 'sort-up' : 'sort-down' link_to , class: 'filter-link' do icon_text icon, title, ['fw'], true end end |
#all_filter_link ⇒ Object
47 48 49 50 51 52 |
# File 'app/helpers/elabs/content_filters_helper.rb', line 47 def all_filter_link icon = params['with_content_only'] && params['with_content_only'] == 'false' ? 'dot-circle' : 'circle' link_to request.params.merge(with_content_only: 'false'), class: 'filter-link' do icon_text(icon, _('Show all'), ['fw'], true) end end |
#all_sfw_status_link ⇒ Object
40 41 42 43 44 45 |
# File 'app/helpers/elabs/content_filters_helper.rb', line 40 def all_sfw_status_link link_icon = params['sfw_status'] && %w[sfw_only nsfw_only].include?(params['sfw_status']) ? 'circle' : 'dot-circle' link_to request.params.merge(sfw_status: 'all'), class: 'filter-link' do icon_text link_icon, content_tag('span', _('Show all'), class: 'link'), %w[fw icon] end end |
#nsfw_only_link ⇒ Object
33 34 35 36 37 38 |
# File 'app/helpers/elabs/content_filters_helper.rb', line 33 def nsfw_only_link link_icon = params['sfw_status'] && params['sfw_status'] == 'nsfw_only' ? 'dot-circle' : 'circle' link_to request.params.merge(sfw_status: 'nsfw_only'), class: 'filter-link' do icon_text link_icon, content_tag('span', _('Only NSFW'), class: 'link'), %w[fw icon] end end |
#order_link(title, field) ⇒ Object
3 4 5 6 7 8 9 10 11 12 13 14 |
# File 'app/helpers/elabs/content_filters_helper.rb', line 3 def order_link(title, field) param_name = "order_by_#{field}" direction = params[param_name] && params[param_name] == 'asc' ? :desc : :asc = { param_name => direction } ['sfw_status'] = params['sfw_status'] if params['sfw_status'] link_icon = determine_sort_icon param_name, direction link_to , class: 'filter-link' do icon_text link_icon, content_tag('span', title, class: 'link'), %w[fw icon], true end end |
#render_filters? ⇒ Boolean
68 69 70 71 72 73 74 75 76 77 78 79 |
# File 'app/helpers/elabs/content_filters_helper.rb', line 68 def render_filters? %w[acts languages licenses tags users albums articles notes projects uploads].include?(controller_name) && action_name == 'index' end |
#sfw_only_link ⇒ Object
26 27 28 29 30 31 |
# File 'app/helpers/elabs/content_filters_helper.rb', line 26 def sfw_only_link link_icon = params['sfw_status'] && params['sfw_status'] == 'sfw_only' ? 'dot-circle' : 'circle' link_to request.params.merge(sfw_status: 'sfw_only'), class: 'filter-link' do icon_text link_icon, content_tag('span', _('Only SFW'), class: 'link'), %w[fw icon] end end |
#sfw_status_links ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'app/helpers/elabs/content_filters_helper.rb', line 16 def sfw_status_links out = [] out.push all_sfw_status_link out.push sfw_only_link out.push nsfw_only_link raw out.join('') end |