decidim-process_groups_content_block 0.16.1 → 0.16.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/app/cells/decidim/process_groups_content_block/content_blocks/highlighted_process_groups_cell.rb +1 -10
- data/app/queries/decidim/process_groups_content_block/organization_active_participatory_process_groups.rb +32 -0
- data/lib/decidim/process_groups_content_block/version.rb +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 4b661f9f6b0a4db684add997a30a7f30616395eeb19115776e9a83d7d1b4f27a
|
|
4
|
+
data.tar.gz: fcdd78f86c21415c8707e197c643cededb282308921e908ae7e35f2c2f5083df
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: fb1d830cf507318b2f8ff4365f2ae64edb97a6964586ee4f843dc9846d6592842e7dac35a130f773fcbc99d701373e09eb7ab90a43865838a5a8451e01911df6
|
|
7
|
+
data.tar.gz: a909a7bbd83c58556763649dd4a394301a88829c9a12467a248f92e5b1f55211a160dbab824117d111fba6351fda0208f52417ebd990a1a55e3924d0af1c1020
|
|
@@ -16,18 +16,9 @@ module Decidim
|
|
|
16
16
|
end
|
|
17
17
|
|
|
18
18
|
def highlighted_groups
|
|
19
|
-
|
|
19
|
+
OrganizationActiveParticipatoryProcessGroups
|
|
20
20
|
.new(current_organization)
|
|
21
21
|
.query
|
|
22
|
-
.joins(:participatory_processes)
|
|
23
|
-
.where.not(decidim_participatory_processes: { published_at: nil })
|
|
24
|
-
.where(
|
|
25
|
-
"decidim_participatory_processes.end_date IS NULL "\
|
|
26
|
-
"OR decidim_participatory_processes.end_date > ?",
|
|
27
|
-
Time.current
|
|
28
|
-
)
|
|
29
|
-
.group("decidim_participatory_process_groups.id")
|
|
30
|
-
.having("COUNT(decidim_participatory_processes.id) > 0")
|
|
31
22
|
end
|
|
32
23
|
|
|
33
24
|
def i18n_scope
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
# frozen_string_literal: true
|
|
2
|
+
|
|
3
|
+
module Decidim
|
|
4
|
+
module ProcessGroupsContentBlock
|
|
5
|
+
# This query class filters participatory process groups given an organization and a filter.
|
|
6
|
+
class OrganizationActiveParticipatoryProcessGroups < Decidim::ParticipatoryProcesses::OrganizationPrioritizedParticipatoryProcessGroups
|
|
7
|
+
def query
|
|
8
|
+
ids = super
|
|
9
|
+
.joins(:participatory_processes)
|
|
10
|
+
.where.not(decidim_participatory_processes: { published_at: nil })
|
|
11
|
+
.where(
|
|
12
|
+
"decidim_participatory_processes.end_date IS NULL "\
|
|
13
|
+
"OR decidim_participatory_processes.end_date > ?",
|
|
14
|
+
Time.current
|
|
15
|
+
)
|
|
16
|
+
.group("decidim_participatory_process_groups.id")
|
|
17
|
+
.having("COUNT(decidim_participatory_processes.id) > 0")
|
|
18
|
+
.pluck(:id)
|
|
19
|
+
|
|
20
|
+
Decidim::ParticipatoryProcessGroup
|
|
21
|
+
.where(id: ids)
|
|
22
|
+
.order(Arel.sql("name ->> '#{current_locale}' ASC"))
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
private
|
|
26
|
+
|
|
27
|
+
def current_locale
|
|
28
|
+
I18n.locale.to_s
|
|
29
|
+
end
|
|
30
|
+
end
|
|
31
|
+
end
|
|
32
|
+
end
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: decidim-process_groups_content_block
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.16.
|
|
4
|
+
version: 0.16.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Antti Hukkanen
|
|
@@ -93,6 +93,7 @@ files:
|
|
|
93
93
|
- app/cells/decidim/process_groups_content_block/content_blocks/highlighted_process_groups/_all_groups.erb
|
|
94
94
|
- app/cells/decidim/process_groups_content_block/content_blocks/highlighted_process_groups/show.erb
|
|
95
95
|
- app/cells/decidim/process_groups_content_block/content_blocks/highlighted_process_groups_cell.rb
|
|
96
|
+
- app/queries/decidim/process_groups_content_block/organization_active_participatory_process_groups.rb
|
|
96
97
|
- config/locales/en.yml
|
|
97
98
|
- config/locales/fi.yml
|
|
98
99
|
- lib/decidim/process_groups_content_block.rb
|