Orgas filtering can now use the near scope
This commit is contained in:
parent
12ba0c42dd
commit
01ae744c7b
|
@ -9,7 +9,7 @@ class OrgasController < ApplicationController
|
||||||
unless: :check_secret
|
unless: :check_secret
|
||||||
|
|
||||||
def index
|
def index
|
||||||
@unfiltered_orgas = apply_scopes(Orga.moderated).includes(:kind, :region)
|
@unfiltered_orgas = apply_scopes(Orga.moderated)
|
||||||
@search = @unfiltered_orgas.search params[:q]
|
@search = @unfiltered_orgas.search params[:q]
|
||||||
@search.sorts = 'updated_at desc' if @search.sorts.empty?
|
@search.sorts = 'updated_at desc' if @search.sorts.empty?
|
||||||
@orgas = @search.result.page params[:page]
|
@orgas = @search.result.page params[:page]
|
||||||
|
|
|
@ -2,16 +2,17 @@
|
||||||
- p = params[:q].clone
|
- p = params[:q].clone
|
||||||
|
|
||||||
%ul.counters
|
%ul.counters
|
||||||
- Kind.all.each do |kind|
|
-# The reorder and specific count are required for the "near" scope
|
||||||
|
- @unfiltered_orgas.reorder('').group(:kind).count(:id).each do |kind, count|
|
||||||
- p[:kind_id_eq] = kind.id
|
- p[:kind_id_eq] = kind.id
|
||||||
%li{ title: Kind.human_attribute_name("name_#{kind.name}") }
|
%li{ title: Kind.human_attribute_name("name_#{kind.name}") }
|
||||||
= link_to orgas_url(q: p) do
|
= link_to orgas_url(q: p) do
|
||||||
%em.fa{ class: "fa-#{kind.icon}" }
|
%em.fa{ class: "fa-#{kind.icon}" }
|
||||||
= @unfiltered_orgas.kind(kind).count
|
= count
|
||||||
|
|
||||||
%li
|
%li
|
||||||
- p[:kind_id_eq] = params[:q][:kind_id_eq]
|
- p[:kind_id_eq] = params[:q][:kind_id_eq]
|
||||||
- p[:active_eq] = true
|
- p[:active_eq] = true
|
||||||
= link_to orgas_url(q: p) do
|
= link_to orgas_url(q: p) do
|
||||||
%em.fa.fa-heartbeat
|
%em.fa.fa-heartbeat
|
||||||
= @unfiltered_orgas.active.count
|
= @unfiltered_orgas.active.count :id
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
:markdown
|
:markdown
|
||||||
#{t '.helper'}
|
#{t '.helper'}
|
||||||
|
|
||||||
= form_tag events_url, method: :get do
|
%fieldset
|
||||||
|
= form_tag events_url, method: :get do
|
||||||
.field.near_location
|
.field.near_location
|
||||||
= label_tag 'near[location]', t('.near_location')
|
= label_tag 'near[location]', t('.near_location')
|
||||||
= text_field_tag 'near[location]', params['near[location]'],
|
= text_field_tag 'near[location]', params['near[location]'],
|
||||||
|
@ -24,18 +25,6 @@
|
||||||
session[:region]),
|
session[:region]),
|
||||||
include_blank: true
|
include_blank: true
|
||||||
|
|
||||||
.helper
|
|
||||||
:markdown
|
|
||||||
#{t '.period_year_helper'}
|
|
||||||
.field.period_year
|
|
||||||
= label_tag 'period[year]', t('.period_year')
|
|
||||||
= number_field_tag 'period[year]', params['period[year]'],
|
|
||||||
placeholder: "Ex: #{(Time.zone.today + 7.days).year}"
|
|
||||||
.field.period_week
|
|
||||||
= label_tag 'period[week]', t('.period_week')
|
|
||||||
= number_field_tag 'period[week]', params['period[week]'],
|
|
||||||
placeholder: "Ex: #{(Time.zone.today + 7.days).cweek}"
|
|
||||||
|
|
||||||
.field.tags
|
.field.tags
|
||||||
= label_tag :tag, t('.tag')
|
= label_tag :tag, t('.tag')
|
||||||
= text_field_tag :tag
|
= text_field_tag :tag
|
||||||
|
@ -83,6 +72,22 @@
|
||||||
%em.fa.fa-users
|
%em.fa.fa-users
|
||||||
= t '.orgas'
|
= t '.orgas'
|
||||||
|
|
||||||
|
%fieldset
|
||||||
|
= form_tag events_url, method: :get do
|
||||||
|
.helper
|
||||||
|
:markdown
|
||||||
|
#{t '.period_year_helper'}
|
||||||
|
.field.period_year
|
||||||
|
= label_tag 'period[year]', t('.period_year')
|
||||||
|
= number_field_tag 'period[year]', params['period[year]'],
|
||||||
|
placeholder: "Ex: #{(Time.zone.today + 7.days).year}"
|
||||||
|
.field.period_week
|
||||||
|
= label_tag 'period[week]', t('.period_week')
|
||||||
|
= number_field_tag 'period[week]', params['period[week]'],
|
||||||
|
placeholder: "Ex: #{(Time.zone.today + 7.days).cweek}"
|
||||||
|
|
||||||
|
.actions
|
||||||
= button_tag formaction: digest_url(:markdown) do
|
= button_tag formaction: digest_url(:markdown) do
|
||||||
%em.fa.fa-hashtag
|
%em.fa.fa-hashtag
|
||||||
= t '.digest'
|
= t '.digest'
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user