decidim-budgets 0.20.1 → 0.21.0
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/controllers/decidim/budgets/projects_controller.rb +18 -2
- data/app/helpers/decidim/budgets/application_helper.rb +1 -0
- data/app/services/decidim/budgets/project_search.rb +8 -0
- data/app/types/decidim/budgets/budgets_type.rb +32 -0
- data/app/types/decidim/budgets/project_type.rb +25 -0
- data/app/views/decidim/budgets/projects/_filters.html.erb +2 -2
- data/config/locales/ar.yml +1 -1
- data/config/locales/ca.yml +1 -1
- data/config/locales/cs.yml +1 -1
- data/config/locales/de.yml +1 -1
- data/config/locales/el.yml +1 -0
- data/config/locales/en.yml +1 -1
- data/config/locales/es-MX.yml +1 -1
- data/config/locales/es-PY.yml +1 -1
- data/config/locales/es.yml +1 -1
- data/config/locales/eu.yml +1 -1
- data/config/locales/fi-plain.yml +1 -1
- data/config/locales/fi.yml +1 -1
- data/config/locales/fr.yml +1 -1
- data/config/locales/gl.yml +1 -1
- data/config/locales/hu.yml +1 -1
- data/config/locales/id-ID.yml +1 -1
- data/config/locales/is-IS.yml +1 -1
- data/config/locales/it.yml +1 -1
- data/config/locales/nl.yml +1 -1
- data/config/locales/no.yml +1 -1
- data/config/locales/pl.yml +1 -1
- data/config/locales/pt-BR.yml +1 -1
- data/config/locales/pt.yml +1 -1
- data/config/locales/ru.yml +1 -1
- data/config/locales/sv.yml +1 -1
- data/config/locales/tr-TR.yml +1 -1
- data/config/locales/uk.yml +1 -1
- data/lib/decidim/budgets/component.rb +7 -0
- data/lib/decidim/budgets/version.rb +1 -1
- metadata +15 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 74e9586e7151e64001736d0bff69a2faf0a9c323defe134d4088c66800c41702
|
4
|
+
data.tar.gz: fe6dec03b3312ee9ab2052f115a7c39bbd0ad9a1552756b7fccf2b0469c844da
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e2cab9e2fb0ee2494ecce9488257ef242846886d86809b220e3ed6bf3c2858ad30b9db06e60371b8cf38cb1a51ca79d81132b91d8c2b0d89f551ef132c5f06c
|
7
|
+
data.tar.gz: b47182fb5d57b24c193fe9b70a83d5fdb57232cf10ef38ed78195499255a8a70d9bb7ed05be7a6f3c6275a057b6e2e922d03c7d68c29630672c120d1aee5e387
|
@@ -27,11 +27,27 @@ module Decidim
|
|
27
27
|
def default_filter_params
|
28
28
|
{
|
29
29
|
search_text: "",
|
30
|
-
scope_id:
|
31
|
-
category_id:
|
30
|
+
scope_id: default_filter_scope_params,
|
31
|
+
category_id: default_filter_category_params
|
32
32
|
}
|
33
33
|
end
|
34
34
|
|
35
|
+
def default_filter_category_params
|
36
|
+
return "all" unless current_component.participatory_space.categories.any?
|
37
|
+
|
38
|
+
["all"] + current_component.participatory_space.categories.map { |category| category.id.to_s }
|
39
|
+
end
|
40
|
+
|
41
|
+
def default_filter_scope_params
|
42
|
+
return "all" unless current_component.participatory_space.scopes.any?
|
43
|
+
|
44
|
+
if current_component.participatory_space.scope
|
45
|
+
["all", current_component.participatory_space.scope.id] + current_component.participatory_space.scope.children.map { |scope| scope.id.to_s }
|
46
|
+
else
|
47
|
+
%w(all global) + current_component.participatory_space.scopes.map { |scope| scope.id.to_s }
|
48
|
+
end
|
49
|
+
end
|
50
|
+
|
35
51
|
def context_params
|
36
52
|
{ component: current_component, organization: current_organization }
|
37
53
|
end
|
@@ -19,6 +19,14 @@ module Decidim
|
|
19
19
|
.or(query.where(localized_search_text_in(:description), text: "%#{search_text}%"))
|
20
20
|
end
|
21
21
|
|
22
|
+
def search_category_id
|
23
|
+
super
|
24
|
+
end
|
25
|
+
|
26
|
+
def search_scope_id
|
27
|
+
super
|
28
|
+
end
|
29
|
+
|
22
30
|
# Returns the random projects for the current page.
|
23
31
|
def results
|
24
32
|
Project.where(id: super.pluck(:id))
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Budgets
|
5
|
+
BudgetsType = GraphQL::ObjectType.define do
|
6
|
+
interfaces [-> { Decidim::Core::ComponentInterface }]
|
7
|
+
|
8
|
+
name "Budgets"
|
9
|
+
description "A budget component of a participatory space."
|
10
|
+
|
11
|
+
connection :projects, ProjectType.connection_type do
|
12
|
+
resolve ->(component, _args, _ctx) {
|
13
|
+
ProjectTypeHelper.base_scope(component).includes(:component)
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
field(:project, ProjectType) do
|
18
|
+
argument :id, !types.ID
|
19
|
+
|
20
|
+
resolve ->(component, args, _ctx) {
|
21
|
+
ProjectTypeHelper.base_scope(component).find_by(id: args[:id])
|
22
|
+
}
|
23
|
+
end
|
24
|
+
end
|
25
|
+
|
26
|
+
module ProjectTypeHelper
|
27
|
+
def self.base_scope(component)
|
28
|
+
Project.where(component: component)
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Budgets
|
5
|
+
ProjectType = GraphQL::ObjectType.define do
|
6
|
+
interfaces [
|
7
|
+
-> { Decidim::Core::ScopableInterface },
|
8
|
+
-> { Decidim::Core::AttachableInterface },
|
9
|
+
-> { Decidim::Comments::CommentableInterface },
|
10
|
+
-> { Decidim::Core::CategorizableInterface }
|
11
|
+
]
|
12
|
+
|
13
|
+
name "Project"
|
14
|
+
description "A project"
|
15
|
+
|
16
|
+
field :id, !types.ID, "The internal ID for this project"
|
17
|
+
field :title, Decidim::Core::TranslatedFieldType, "The title for this project"
|
18
|
+
field :description, Decidim::Core::TranslatedFieldType, "The description for this project"
|
19
|
+
field :budget, types.Int, "The budget for this project"
|
20
|
+
field :createdAt, Decidim::Core::DateTimeType, "When this project was created", property: :created_at
|
21
|
+
field :updatedAt, Decidim::Core::DateTimeType, "When this project was updated", property: :updated_at
|
22
|
+
field :reference, types.String, "The reference for this project"
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -13,10 +13,10 @@
|
|
13
13
|
</div>
|
14
14
|
|
15
15
|
<% if current_participatory_space.has_subscopes? %>
|
16
|
-
<%=
|
16
|
+
<%= form.check_boxes_tree :scope_id, filter_scopes_values, legend_title: t(".scope") %>
|
17
17
|
<% end %>
|
18
18
|
|
19
19
|
<% if current_component.categories.any? %>
|
20
|
-
<%= form.
|
20
|
+
<%= form.check_boxes_tree :category_id, filter_categories_values, legend_title: t(".category") %>
|
21
21
|
<% end %>
|
22
22
|
<% end %>
|
data/config/locales/ar.yml
CHANGED
data/config/locales/ca.yml
CHANGED
data/config/locales/cs.yml
CHANGED
data/config/locales/de.yml
CHANGED
@@ -0,0 +1 @@
|
|
1
|
+
el:
|
data/config/locales/en.yml
CHANGED
data/config/locales/es-MX.yml
CHANGED
data/config/locales/es-PY.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/config/locales/eu.yml
CHANGED
data/config/locales/fi-plain.yml
CHANGED
data/config/locales/fi.yml
CHANGED
data/config/locales/fr.yml
CHANGED
data/config/locales/gl.yml
CHANGED
data/config/locales/hu.yml
CHANGED
data/config/locales/id-ID.yml
CHANGED
data/config/locales/is-IS.yml
CHANGED
data/config/locales/it.yml
CHANGED
data/config/locales/nl.yml
CHANGED
data/config/locales/no.yml
CHANGED
data/config/locales/pl.yml
CHANGED
data/config/locales/pt-BR.yml
CHANGED
data/config/locales/pt.yml
CHANGED
data/config/locales/ru.yml
CHANGED
data/config/locales/sv.yml
CHANGED
data/config/locales/tr-TR.yml
CHANGED
data/config/locales/uk.yml
CHANGED
@@ -13,6 +13,8 @@ Decidim.register_component(:budgets) do |component|
|
|
13
13
|
|
14
14
|
component.newsletter_participant_entities = ["Decidim::Budgets::Order"]
|
15
15
|
|
16
|
+
component.query_type = "Decidim::Budgets::BudgetsType"
|
17
|
+
|
16
18
|
component.actions = %(vote)
|
17
19
|
|
18
20
|
component.on(:before_destroy) do |instance|
|
@@ -43,6 +45,11 @@ Decidim.register_component(:budgets) do |component|
|
|
43
45
|
Decidim::Comments::Comment.where(root_commentable: projects).count
|
44
46
|
end
|
45
47
|
|
48
|
+
component.register_stat :followers_count, tag: :followers, priority: Decidim::StatsRegistry::LOW_PRIORITY do |components, start_at, end_at|
|
49
|
+
projects_ids = Decidim::Budgets::FilteredProjects.for(components, start_at, end_at).pluck(:id)
|
50
|
+
Decidim::Follow.where(decidim_followable_type: "Decidim::Budgets::Project", decidim_followable_id: projects_ids).count
|
51
|
+
end
|
52
|
+
|
46
53
|
component.settings(:global) do |settings|
|
47
54
|
settings.attribute :projects_per_page, type: :integer, default: 12
|
48
55
|
settings.attribute :total_budget, type: :integer, default: 100_000_000
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-budgets
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.21.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Josep Jaume Rey Peroy
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date: 2020-
|
13
|
+
date: 2020-04-08 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-comments
|
@@ -18,28 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.21.0
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - '='
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 0.
|
28
|
+
version: 0.21.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: decidim-core
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.21.0
|
36
36
|
type: :runtime
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - '='
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.21.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: kaminari
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -74,42 +74,42 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - '='
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 0.
|
77
|
+
version: 0.21.0
|
78
78
|
type: :development
|
79
79
|
prerelease: false
|
80
80
|
version_requirements: !ruby/object:Gem::Requirement
|
81
81
|
requirements:
|
82
82
|
- - '='
|
83
83
|
- !ruby/object:Gem::Version
|
84
|
-
version: 0.
|
84
|
+
version: 0.21.0
|
85
85
|
- !ruby/object:Gem::Dependency
|
86
86
|
name: decidim-dev
|
87
87
|
requirement: !ruby/object:Gem::Requirement
|
88
88
|
requirements:
|
89
89
|
- - '='
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: 0.
|
91
|
+
version: 0.21.0
|
92
92
|
type: :development
|
93
93
|
prerelease: false
|
94
94
|
version_requirements: !ruby/object:Gem::Requirement
|
95
95
|
requirements:
|
96
96
|
- - '='
|
97
97
|
- !ruby/object:Gem::Version
|
98
|
-
version: 0.
|
98
|
+
version: 0.21.0
|
99
99
|
- !ruby/object:Gem::Dependency
|
100
100
|
name: decidim-proposals
|
101
101
|
requirement: !ruby/object:Gem::Requirement
|
102
102
|
requirements:
|
103
103
|
- - '='
|
104
104
|
- !ruby/object:Gem::Version
|
105
|
-
version: 0.
|
105
|
+
version: 0.21.0
|
106
106
|
type: :development
|
107
107
|
prerelease: false
|
108
108
|
version_requirements: !ruby/object:Gem::Requirement
|
109
109
|
requirements:
|
110
110
|
- - '='
|
111
111
|
- !ruby/object:Gem::Version
|
112
|
-
version: 0.
|
112
|
+
version: 0.21.0
|
113
113
|
description: A budgets component for decidim's participatory spaces.
|
114
114
|
email:
|
115
115
|
- josepjaume@gmail.com
|
@@ -167,6 +167,8 @@ files:
|
|
167
167
|
- app/queries/decidim/budgets/metrics/budget_participants_metric_measure.rb
|
168
168
|
- app/serializers/decidim/budgets/data_portability_budgets_order_serializer.rb
|
169
169
|
- app/services/decidim/budgets/project_search.rb
|
170
|
+
- app/types/decidim/budgets/budgets_type.rb
|
171
|
+
- app/types/decidim/budgets/project_type.rb
|
170
172
|
- app/views/decidim/budgets/admin/projects/_form.html.erb
|
171
173
|
- app/views/decidim/budgets/admin/projects/edit.html.erb
|
172
174
|
- app/views/decidim/budgets/admin/projects/index.html.erb
|
@@ -196,6 +198,7 @@ files:
|
|
196
198
|
- config/locales/cs.yml
|
197
199
|
- config/locales/de.yml
|
198
200
|
- config/locales/el-GR.yml
|
201
|
+
- config/locales/el.yml
|
199
202
|
- config/locales/en.yml
|
200
203
|
- config/locales/eo-UY.yml
|
201
204
|
- config/locales/es-MX.yml
|