Organisation types can be associated to regions now

This commit is contained in:
echarp 2017-07-06 16:00:36 +02:00
parent 1de8e3ef14
commit c2a47847a2
2 changed files with 6 additions and 6 deletions

View File

@ -9,8 +9,8 @@ class OrgasController < ApplicationController
unless: :check_secret unless: :check_secret
def index def index
@search = apply_scopes(Orga.moderated).includes(:kind, :region) @unfiltered_orgas = apply_scopes(Orga.moderated).includes(:kind, :region)
.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]
end end

View File

@ -5,13 +5,13 @@
- Kind.all.each do |kind| - Kind.all.each do |kind|
- 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, region: params[:region]) do
%em.fa{ class: "fa-#{kind.icon}" } %em.fa{ class: "fa-#{kind.icon}" }
= Orga.moderated.region(params[:region] || 'all').kind(kind).count = @unfiltered_orgas.kind(kind).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, region: params[:region]) do
%em.fa.fa-heartbeat %em.fa.fa-heartbeat
= Orga.moderated.active.region(params[:region] || 'all').count = @unfiltered_orgas.active.count