decidim-results 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 7e4356f2a615206f1b6dd421749991b3ee2246a0
4
- data.tar.gz: 4bca5a90b0eefb2187b6a83094481ea1e33c5dd1
3
+ metadata.gz: 3505cf64efa10eb56f890d11451823b59f53a2fd
4
+ data.tar.gz: '09d5d692d1ed94467470f738a590a016a65ce371'
5
5
  SHA512:
6
- metadata.gz: f1c71e1c04236bc51ef4aa65e9e79349e49414f3a0a738e391f81669c8ef734ffabddb8d5a4b0284ae251889ce877f97215775ec17ef7b98e61529210b8f4499
7
- data.tar.gz: 1bbf496bdee38cdfde0d41bc81c3bea55a19fae25416256feedffd602c1a93c080e170bc87d853948f0195062fa900d73cd924c563e431c8693a6b9890311d58
6
+ metadata.gz: d17f29bb0e37ddc1da9288f1c8998d8ee34696dbe6fa93a17e3e1d454b04a2a65159c4779e3eefb587c02f5a78241e3097b618f10dba3e98d0aa73e114a27eb8
7
+ data.tar.gz: 8a08b6a197ca024e37454b8168327d296b81d3912e444b1bbc05a0f0157db2c9356ab4c7f36f2133ebca3db48f46d7158d04d610b0e1ba96d8f47a98749d5a69
@@ -1,3 +1,4 @@
1
+ # frozen_string_literal: true
1
2
  module Decidim
2
3
  module Results
3
4
  class ResultWidgetsController < Decidim::WidgetsController
@@ -12,7 +12,7 @@ module Decidim
12
12
  private
13
13
 
14
14
  def results
15
- @results ||= search.results.page(params[:page]).per(12)
15
+ @results ||= search.results.order("title -> '#{I18n.locale}' ASC").page(params[:page]).per(12)
16
16
  end
17
17
 
18
18
  def result
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+ module Decidim
3
+ module Results
4
+ # A class used to find results filtered by features and a date range
5
+ class FilteredResults < 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 Results scoped to an array of features and filtered
27
+ # by a range of dates.
28
+ def query
29
+ results = Decidim::Results::Result.where(feature: @features)
30
+ results = results.where("created_at >= ?", @start_at) if @start_at.present?
31
+ results = results.where("created_at <= ?", @end_at) if @end_at.present?
32
+ results
33
+ end
34
+ end
35
+ end
36
+ end
@@ -20,7 +20,7 @@ module Decidim
20
20
  end
21
21
 
22
22
  def comments_count
23
- Decidim::Comments::Comment.where(commentable: proposals).count
23
+ Decidim::Comments::Comment.where(root_commentable: proposals).count
24
24
  end
25
25
 
26
26
  def attendees_count
@@ -1,10 +1,2 @@
1
- <div class="column">
2
- <article class="card card--result">
3
- <div class="card__content">
4
- <%= link_to model, class: "card__link" do %>
5
- <h5 class="card__title"><%= translated_attribute model.title %></h5>
6
- <% end %>
7
- <%== translated_attribute model.description %>
8
- </div>
9
- </article>
10
- </div>
1
+ <% content_for(:title, translated_attribute(model.title)) %>
2
+ <%== translated_attribute model.description %>
@@ -2,4 +2,78 @@ fr:
2
2
  activemodel:
3
3
  attributes:
4
4
  result:
5
- decidim_category_id: Catégorie
5
+ decidim_category_id: Catégorie
6
+ decidim_scope_id: Domaine d'application
7
+ description: Description
8
+ proposal_ids: Propositions incluses
9
+ title: Titre
10
+ decidim:
11
+ features:
12
+ results:
13
+ name: Résultats
14
+ settings:
15
+ global:
16
+ comments_enabled: Commentaires activés
17
+ step:
18
+ comments_blocked: Commentaires bloqués
19
+ resource_links:
20
+ included_proposals:
21
+ result_proposals: Propositions incluses dans ce résultat
22
+ meetings_through_proposals:
23
+ result_meetings: Rencontres connexes
24
+ results:
25
+ actions:
26
+ confirm_destroy: Êtes-vous sûr de vouloir supprimer ce résultat?
27
+ destroy: Supprimer
28
+ edit: Modifier
29
+ new: Nouveau
30
+ preview: Aperçu
31
+ title: Actions
32
+ admin:
33
+ models:
34
+ result:
35
+ name: Résultat
36
+ results:
37
+ create:
38
+ invalid: Il y a eu un problème pour créer ce résultat
39
+ success: Résultat créé avec succès
40
+ destroy:
41
+ success: Résultat supprimé avec succès
42
+ edit:
43
+ title: Modifier le résultat
44
+ update: Mettre à jour
45
+ index:
46
+ title: Résultats
47
+ new:
48
+ create: Créer
49
+ title: Nouveau résultat
50
+ update:
51
+ invalid: Il y a eu un problème pour mettre à jour ce résultat
52
+ success: Résultat mis à jour avec succès
53
+ models:
54
+ result:
55
+ fields:
56
+ title: Titre
57
+ results:
58
+ count:
59
+ results_count:
60
+ one: 1 résultat
61
+ other: "%{count} résultats"
62
+ filters:
63
+ category: Catégorie
64
+ category_prompt: Sélectionner une catégorie
65
+ scopes: Domaines d'application
66
+ search: Rechercher
67
+ filters_small_view:
68
+ close_modal: Fermer la fenêtre de dialogue
69
+ filter: Filtrer
70
+ filter_by: Filtrer par
71
+ unfold: Déplier
72
+ show:
73
+ stats:
74
+ attendees: Participants
75
+ comments: Commentaires
76
+ contributions: Contributions
77
+ meetings: Rencontre
78
+ proposals: Propositions
79
+ votes: Soutiens
@@ -16,6 +16,15 @@ Decidim.register_feature(:results) do |feature|
16
16
  resource.template = "decidim/results/results/linked_results"
17
17
  end
18
18
 
19
+ feature.register_stat :results_count, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |features, start_at, end_at|
20
+ Decidim::Results::FilteredResults.for(features, start_at, end_at).count
21
+ end
22
+
23
+ feature.register_stat :comments_count, tag: :comments do |features, start_at, end_at|
24
+ results = Decidim::Results::FilteredResults.for(features, start_at, end_at)
25
+ Decidim::Comments::Comment.where(root_commentable: results).count
26
+ end
27
+
19
28
  feature.settings(:global) do |settings|
20
29
  settings.attribute :comments_enabled, type: :boolean, default: true
21
30
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-results
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.8.1
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-04-27 00:00:00.000000000 Z
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.8.1
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.8.1
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.8.1
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.8.1
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: '0.8'
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: '0.8'
56
+ version: 0.9.1
57
57
  - !ruby/object:Gem::Dependency
58
58
  name: searchlight
59
59
  requirement: !ruby/object:Gem::Requirement
@@ -74,70 +74,70 @@ dependencies:
74
74
  requirements:
75
75
  - - "~>"
76
76
  - !ruby/object:Gem::Version
77
- version: 1.0.0.rc1
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.0.rc1
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.8.1
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.8.1
98
+ version: 0.1.0
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: decidim-comments
101
101
  requirement: !ruby/object:Gem::Requirement
102
102
  requirements:
103
103
  - - '='
104
104
  - !ruby/object:Gem::Version
105
- version: 0.0.8.1
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.8.1
112
+ version: 0.1.0
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: decidim-meetings
115
115
  requirement: !ruby/object:Gem::Requirement
116
116
  requirements:
117
117
  - - '='
118
118
  - !ruby/object:Gem::Version
119
- version: 0.0.8.1
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.8.1
126
+ version: 0.1.0
127
127
  - !ruby/object:Gem::Dependency
128
128
  name: decidim-proposals
129
129
  requirement: !ruby/object:Gem::Requirement
130
130
  requirements:
131
131
  - - '='
132
132
  - !ruby/object:Gem::Version
133
- version: 0.0.8.1
133
+ version: 0.1.0
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - '='
139
139
  - !ruby/object:Gem::Version
140
- version: 0.0.8.1
140
+ version: 0.1.0
141
141
  description: ''
142
142
  email:
143
143
  - josepjaume@gmail.com
@@ -161,6 +161,7 @@ files:
161
161
  - app/helpers/decidim/results/application_helper.rb
162
162
  - app/models/decidim/results/application_record.rb
163
163
  - app/models/decidim/results/result.rb
164
+ - app/queries/decidim/results/filtered_results.rb
164
165
  - app/services/decidim/results/result_search.rb
165
166
  - app/services/decidim/results/result_stats_calculator.rb
166
167
  - app/views/decidim/results/admin/results/_form.html.erb