decidim-budgets 0.0.8.1 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/queries/decidim/budgets/filtered_projects.rb +36 -0
- data/config/locales/ca.yml +1 -0
- data/config/locales/en.yml +1 -0
- data/config/locales/es.yml +1 -0
- data/config/locales/fr.yml +35 -3
- data/lib/decidim/budgets/feature.rb +9 -0
- metadata +17 -16
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0f033511d1ba6f2eb85e4b074b5af9ee81bcd74
|
4
|
+
data.tar.gz: 84ed6e3719e5ff1364499207cbb2c28d56b98dc5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 898d3323eb23ce2430028cb625fd2614fcb71108781eed2be8aa3fd6a1ac8c55cb21a8669531cf404f61b31dc0887e0bf20c3ed4b983f4a4e8069f65dbe4966d
|
7
|
+
data.tar.gz: 447f8697dbc481639f222a25648a7c66737dde8ca55ca8902c6aa23f93888cb0d03a9ad7d1b21dbdd049efb78c8da15e0b8ab6f3a567605b070ea010ba0c07f3
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Budgets
|
4
|
+
# A class used to find projects filtered by features and a date range
|
5
|
+
class FilteredProjects < Rectify::Query
|
6
|
+
# Syntactic sugar to initialize the class and return the queried objects.
|
7
|
+
#
|
8
|
+
# features - An array of Decidim::Feature
|
9
|
+
# start_at - A date to filter resources created after it
|
10
|
+
# end_at - A date to filter resources created before it.
|
11
|
+
def self.for(features, start_at = nil, end_at = nil)
|
12
|
+
new(features, start_at, end_at).query
|
13
|
+
end
|
14
|
+
|
15
|
+
# Initializes the class.
|
16
|
+
#
|
17
|
+
# features - An array of Decidim::Feature
|
18
|
+
# start_at - A date to filter resources created after it
|
19
|
+
# end_at - A date to filter resources created before it.
|
20
|
+
def initialize(features, start_at = nil, end_at = nil)
|
21
|
+
@features = features
|
22
|
+
@start_at = start_at
|
23
|
+
@end_at = end_at
|
24
|
+
end
|
25
|
+
|
26
|
+
# Finds the Projects scoped to an array of features and filtered
|
27
|
+
# by a range of dates.
|
28
|
+
def query
|
29
|
+
projects = Decidim::Budgets::Project.where(feature: @features)
|
30
|
+
projects = projects.where("created_at >= ?", @start_at) if @start_at.present?
|
31
|
+
projects = projects.where("created_at <= ?", @end_at) if @end_at.present?
|
32
|
+
projects
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
data/config/locales/ca.yml
CHANGED
data/config/locales/en.yml
CHANGED
data/config/locales/es.yml
CHANGED
data/config/locales/fr.yml
CHANGED
@@ -4,7 +4,7 @@ fr:
|
|
4
4
|
project:
|
5
5
|
budget: Budget
|
6
6
|
decidim_category_id: Catégorie
|
7
|
-
decidim_scope_id:
|
7
|
+
decidim_scope_id: Domaine d'application
|
8
8
|
description: Description
|
9
9
|
proposal_ids: Propositions liées
|
10
10
|
title: Titre
|
@@ -15,6 +15,7 @@ fr:
|
|
15
15
|
confirm_destroy: Êtes-vous certain de vouloir supprimer ce projet?
|
16
16
|
destroy: Supprimer
|
17
17
|
edit: Modifier
|
18
|
+
new: Nouveau
|
18
19
|
preview: Aperçu
|
19
20
|
title: Actions
|
20
21
|
admin:
|
@@ -29,11 +30,13 @@ fr:
|
|
29
30
|
success: Projet supprimé avec succès
|
30
31
|
edit:
|
31
32
|
title: Éditer un projet
|
33
|
+
update: Mettre à jour
|
32
34
|
index:
|
33
35
|
finished_orders: Commandes terminées
|
34
36
|
pending_orders: Commandes en attente
|
35
37
|
title: Projets
|
36
38
|
new:
|
39
|
+
create: Créer
|
37
40
|
title: Nouveau résultat
|
38
41
|
update:
|
39
42
|
invalid: Il y a eu un problème de mise à jour de ce projet
|
@@ -70,7 +73,7 @@ fr:
|
|
70
73
|
filters:
|
71
74
|
category: Catégorie
|
72
75
|
category_prompt: Sélectionner une catégorie
|
73
|
-
scopes:
|
76
|
+
scopes: Domaines d'application
|
74
77
|
search: Rechercher
|
75
78
|
filters_small_view:
|
76
79
|
close_modal: Fermer la vue
|
@@ -90,8 +93,37 @@ fr:
|
|
90
93
|
count:
|
91
94
|
one: 1 soutien
|
92
95
|
other: "%{count} soutiens"
|
96
|
+
remove: Supprimer
|
97
|
+
project_budget_button:
|
98
|
+
add: Ajouter
|
99
|
+
added: Ajouté
|
100
|
+
show:
|
101
|
+
budget: Budget
|
102
|
+
view_all_projects: Voir tous les projets
|
93
103
|
features:
|
94
104
|
budgets:
|
105
|
+
actions:
|
106
|
+
vote: Voter
|
107
|
+
name: Budgets
|
95
108
|
settings:
|
96
109
|
global:
|
97
|
-
|
110
|
+
comments_enabled: Commentaires activés
|
111
|
+
total_budget: Budget total
|
112
|
+
vote_threshold_percent: Pourcentage de seuil de vote
|
113
|
+
step:
|
114
|
+
comments_blocked: Commentaires bloqués
|
115
|
+
show_votes: Afficher les votes
|
116
|
+
votes_enabled: Votes activés
|
117
|
+
orders:
|
118
|
+
checkout:
|
119
|
+
error: Une erreur s'est produite lors du traitement de votre vote
|
120
|
+
success: Votre vote a été enregistré avec succès
|
121
|
+
destroy:
|
122
|
+
error: Une erreur s'est produite lors de l'annulation de votre vote
|
123
|
+
success: Votre vote a été annulé avec succès
|
124
|
+
resource_links:
|
125
|
+
included_proposals:
|
126
|
+
project_proposals: 'Propositions incluses dans ce projet:'
|
127
|
+
index:
|
128
|
+
confirmed_orders_count: Nombre de votes comptés
|
129
|
+
total_budget: Budget total
|
@@ -19,6 +19,15 @@ Decidim.register_feature(:budgets) do |feature|
|
|
19
19
|
resource.template = "decidim/budgets/projects/linked_projects"
|
20
20
|
end
|
21
21
|
|
22
|
+
feature.register_stat :projects_count, primary: true do |features, start_at, end_at|
|
23
|
+
Decidim::Budgets::FilteredProjects.for(features, start_at, end_at).count
|
24
|
+
end
|
25
|
+
|
26
|
+
feature.register_stat :comments_count, tag: :comments do |features, start_at, end_at|
|
27
|
+
projects = Decidim::Budgets::FilteredProjects.for(features, start_at, end_at)
|
28
|
+
Decidim::Comments::Comment.where(root_commentable: projects).count
|
29
|
+
end
|
30
|
+
|
22
31
|
feature.settings(:global) do |settings|
|
23
32
|
settings.attribute :total_budget, type: :integer, default: 100_000_000
|
24
33
|
settings.attribute :vote_threshold_percent, type: :integer, default: 70
|
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.0
|
4
|
+
version: 0.1.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: 2017-
|
13
|
+
date: 2017-05-18 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-core
|
@@ -18,42 +18,42 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.0
|
21
|
+
version: 0.1.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.0
|
28
|
+
version: 0.1.0
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: decidim-comments
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - '='
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.0
|
35
|
+
version: 0.1.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.0
|
42
|
+
version: 0.1.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rectify
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
46
46
|
requirements:
|
47
47
|
- - "~>"
|
48
48
|
- !ruby/object:Gem::Version
|
49
|
-
version:
|
49
|
+
version: 0.9.1
|
50
50
|
type: :runtime
|
51
51
|
prerelease: false
|
52
52
|
version_requirements: !ruby/object:Gem::Requirement
|
53
53
|
requirements:
|
54
54
|
- - "~>"
|
55
55
|
- !ruby/object:Gem::Version
|
56
|
-
version:
|
56
|
+
version: 0.9.1
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: searchlight
|
59
59
|
requirement: !ruby/object:Gem::Requirement
|
@@ -74,56 +74,56 @@ dependencies:
|
|
74
74
|
requirements:
|
75
75
|
- - "~>"
|
76
76
|
- !ruby/object:Gem::Version
|
77
|
-
version: 1.0.
|
77
|
+
version: 1.0.1
|
78
78
|
type: :runtime
|
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: 1.0.
|
84
|
+
version: 1.0.1
|
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.0
|
91
|
+
version: 0.1.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.0
|
98
|
+
version: 0.1.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.0
|
105
|
+
version: 0.1.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.0
|
112
|
+
version: 0.1.0
|
113
113
|
- !ruby/object:Gem::Dependency
|
114
114
|
name: decidim-admin
|
115
115
|
requirement: !ruby/object:Gem::Requirement
|
116
116
|
requirements:
|
117
117
|
- - '='
|
118
118
|
- !ruby/object:Gem::Version
|
119
|
-
version: 0.0
|
119
|
+
version: 0.1.0
|
120
120
|
type: :development
|
121
121
|
prerelease: false
|
122
122
|
version_requirements: !ruby/object:Gem::Requirement
|
123
123
|
requirements:
|
124
124
|
- - '='
|
125
125
|
- !ruby/object:Gem::Version
|
126
|
-
version: 0.0
|
126
|
+
version: 0.1.0
|
127
127
|
description: ''
|
128
128
|
email:
|
129
129
|
- josepjaume@gmail.com
|
@@ -164,6 +164,7 @@ files:
|
|
164
164
|
- app/models/decidim/budgets/line_item.rb
|
165
165
|
- app/models/decidim/budgets/order.rb
|
166
166
|
- app/models/decidim/budgets/project.rb
|
167
|
+
- app/queries/decidim/budgets/filtered_projects.rb
|
167
168
|
- app/services/decidim/budgets/project_search.rb
|
168
169
|
- app/views/decidim/budgets/admin/projects/_form.html.erb
|
169
170
|
- app/views/decidim/budgets/admin/projects/edit.html.erb
|