decidim-proposals 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/commands/decidim/proposals/create_proposal_export.rb +36 -0
- data/app/controllers/decidim/proposals/admin/exports_controller.rb +24 -0
- data/app/controllers/decidim/proposals/proposal_votes_controller.rb +3 -1
- data/app/controllers/decidim/proposals/proposal_widgets_controller.rb +0 -5
- data/app/controllers/decidim/proposals/proposals_controller.rb +0 -1
- data/app/jobs/decidim/proposals/export_job.rb +21 -0
- data/app/models/decidim/proposals/proposal.rb +1 -1
- data/app/queries/decidim/proposals/filtered_proposals.rb +36 -0
- data/app/services/decidim/proposals/proposal_serializer.rb +72 -0
- data/app/views/decidim/proposals/admin/proposals/index.html.erb +15 -3
- data/app/views/decidim/proposals/proposal_widgets/show.html.erb +4 -25
- data/config/locales/ca.yml +4 -0
- data/config/locales/en.yml +6 -1
- data/config/locales/es.yml +4 -0
- data/config/locales/fr.yml +146 -1
- data/lib/decidim/proposals/admin_engine.rb +5 -0
- data/lib/decidim/proposals/feature.rb +14 -0
- metadata +23 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 57be816bd788ab639e3f356480d2e2b82099b816
|
4
|
+
data.tar.gz: 849c9453e5e32cd736d7172e10c45b310110fbe4
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4a680b98cdb8fcc5038a25cd50ff7dcd309b99e12fddba0905a960bd87fc5876ac6800c90faa458f117be54b1d8103d69e228a89374d51022e7fc1018f0f3418
|
7
|
+
data.tar.gz: 443db12a69fce3d32c4199e989c0536437bdf4b79f8158783c8b47a205ffc72eb7f2b597893df8ac7c12b2b28e28486f02c463e9ae2150092142082cbb128b52
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Proposals
|
4
|
+
# A command with all the business logic when a user creates a new proposal.
|
5
|
+
class CreateProposalExport < Rectify::Command
|
6
|
+
# Public: Initializes the command.
|
7
|
+
#
|
8
|
+
# form - A form object with the params.
|
9
|
+
# current_user - The current user.
|
10
|
+
def initialize(participatory_process)
|
11
|
+
@participatory_process = participatory_process
|
12
|
+
end
|
13
|
+
|
14
|
+
# Executes the command. Broadcasts these events:
|
15
|
+
#
|
16
|
+
# - :ok when everything is valid, together with the proposal.
|
17
|
+
# - :invalid if the proposal wasn't valid and we couldn't proceed.
|
18
|
+
#
|
19
|
+
# Returns nothing.
|
20
|
+
def call
|
21
|
+
return broadcast(:invalid) if participatory_process.invalid?
|
22
|
+
|
23
|
+
create_proposal_export
|
24
|
+
broadcast(:ok, export)
|
25
|
+
end
|
26
|
+
|
27
|
+
private
|
28
|
+
|
29
|
+
attr_reader :participatory_process
|
30
|
+
|
31
|
+
def create_proposal_export
|
32
|
+
ProposalsExporterJob.perform_later(participatory_process)
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Proposals
|
4
|
+
module Admin
|
5
|
+
# This controller allows admins to manage proposals in a participatory process.
|
6
|
+
class ExportsController < Admin::ApplicationController
|
7
|
+
def create
|
8
|
+
# call the new proposal export command
|
9
|
+
authorize! :read, Proposal
|
10
|
+
authorize! :export, Proposal
|
11
|
+
|
12
|
+
ExportJob.perform_later(
|
13
|
+
current_user,
|
14
|
+
current_feature,
|
15
|
+
params[:format]
|
16
|
+
)
|
17
|
+
|
18
|
+
flash[:notice] = t("decidim.proposals.exports.notice")
|
19
|
+
redirect_to :back
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
@@ -21,7 +21,9 @@ module Decidim
|
|
21
21
|
def destroy
|
22
22
|
authorize! :unvote, proposal
|
23
23
|
|
24
|
-
proposal.votes.where(author: current_user).
|
24
|
+
proposal.votes.where(author: current_user).destroy_all
|
25
|
+
proposal.reload
|
26
|
+
|
25
27
|
@from_proposals_list = params[:from_proposals_list] == "true"
|
26
28
|
render :update_buttons_and_counters
|
27
29
|
end
|
@@ -3,7 +3,6 @@
|
|
3
3
|
module Decidim
|
4
4
|
module Proposals
|
5
5
|
class ProposalWidgetsController < Decidim::WidgetsController
|
6
|
-
helper_method :model, :current_participatory_process
|
7
6
|
helper Proposals::ApplicationHelper
|
8
7
|
|
9
8
|
private
|
@@ -12,10 +11,6 @@ module Decidim
|
|
12
11
|
@model ||= Proposal.where(feature: params[:feature_id]).find(params[:proposal_id])
|
13
12
|
end
|
14
13
|
|
15
|
-
def current_participatory_process
|
16
|
-
@current_participatory_process ||= model.feature.participatory_process
|
17
|
-
end
|
18
|
-
|
19
14
|
def iframe_url
|
20
15
|
@iframe_url ||= proposal_proposal_widget_url(model)
|
21
16
|
end
|
@@ -0,0 +1,21 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Proposals
|
4
|
+
class ExportJob < ApplicationJob
|
5
|
+
queue_as :default
|
6
|
+
|
7
|
+
def perform(user, feature, format)
|
8
|
+
proposals = Proposal
|
9
|
+
.where(feature: feature)
|
10
|
+
.includes(:category, feature: { participatory_process: :organization })
|
11
|
+
|
12
|
+
export_data = Decidim::Exporters.const_get(format.upcase)
|
13
|
+
.new(proposals, ProposalSerializer).export
|
14
|
+
|
15
|
+
name = "proposals-#{I18n.localize(DateTime.now.to_date, format: :default)}-#{Time.now.seconds_since_midnight.to_i}"
|
16
|
+
|
17
|
+
ExportMailer.export(user, name, export_data).deliver_now
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|
21
|
+
end
|
@@ -18,7 +18,7 @@ module Decidim
|
|
18
18
|
|
19
19
|
validates :title, :body, presence: true
|
20
20
|
|
21
|
-
geocoded_by :address, http_headers:
|
21
|
+
geocoded_by :address, http_headers: ->(proposal) { { "Referer" => proposal.feature.organization.host } }
|
22
22
|
|
23
23
|
scope :accepted, -> { where(state: "accepted") }
|
24
24
|
scope :rejected, -> { where(state: "rejected") }
|
@@ -0,0 +1,36 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
module Decidim
|
3
|
+
module Proposals
|
4
|
+
# A class used to find proposals filtered by features and a date range
|
5
|
+
class FilteredProposals < 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 Proposals scoped to an array of features and filtered
|
27
|
+
# by a range of dates.
|
28
|
+
def query
|
29
|
+
proposals = Decidim::Proposals::Proposal.where(feature: @features)
|
30
|
+
proposals = proposals.where("created_at >= ?", @start_at) if @start_at.present?
|
31
|
+
proposals = proposals.where("created_at <= ?", @end_at) if @end_at.present?
|
32
|
+
proposals
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -0,0 +1,72 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Decidim
|
4
|
+
module Proposals
|
5
|
+
# This class serializes a Proposal so can be exported to CSV, JSON or other
|
6
|
+
# formats.
|
7
|
+
class ProposalSerializer
|
8
|
+
include Rails.application.routes.url_helpers
|
9
|
+
include Decidim::ResourceHelper
|
10
|
+
|
11
|
+
# Public: Initializes the serializer with a proposal.
|
12
|
+
def initialize(proposal)
|
13
|
+
@proposal = proposal
|
14
|
+
end
|
15
|
+
|
16
|
+
# Public: Exports a hash with the serialized data for this proposal.
|
17
|
+
def serialize
|
18
|
+
{
|
19
|
+
id: @proposal.id,
|
20
|
+
category: {
|
21
|
+
id: @proposal.category.try(:id),
|
22
|
+
name: @proposal.category.try(:name)
|
23
|
+
},
|
24
|
+
title: @proposal.title,
|
25
|
+
body: @proposal.body,
|
26
|
+
votes: @proposal.proposal_votes_count,
|
27
|
+
comments: @proposal.comments.count,
|
28
|
+
created_at: @proposal.created_at,
|
29
|
+
url: url,
|
30
|
+
feature: { id: feature.id },
|
31
|
+
meeting_urls: meetings
|
32
|
+
}
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
attr_reader :proposal
|
38
|
+
|
39
|
+
def feature
|
40
|
+
proposal.feature
|
41
|
+
end
|
42
|
+
|
43
|
+
def organization
|
44
|
+
feature.organization
|
45
|
+
end
|
46
|
+
|
47
|
+
def meetings
|
48
|
+
@proposal.linked_resources(:meetings, "proposals_from_meeting").map do |meeting|
|
49
|
+
decidim_resource_url(
|
50
|
+
meeting,
|
51
|
+
feature_id: feature,
|
52
|
+
participatory_process_id: participatory_process,
|
53
|
+
host: organization.host
|
54
|
+
)
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def participatory_process
|
59
|
+
feature.participatory_process
|
60
|
+
end
|
61
|
+
|
62
|
+
def url
|
63
|
+
Decidim::Proposals::Engine.routes.url_helpers.proposal_url(
|
64
|
+
proposal,
|
65
|
+
feature_id: feature,
|
66
|
+
participatory_process_id: participatory_process,
|
67
|
+
host: organization.host
|
68
|
+
)
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
72
|
+
end
|
@@ -3,9 +3,21 @@
|
|
3
3
|
<h2 class="card-title">
|
4
4
|
<%= t(".title") %>
|
5
5
|
|
6
|
-
|
7
|
-
|
8
|
-
|
6
|
+
<div class="button--title">
|
7
|
+
|
8
|
+
<% if feature_settings.official_proposals_enabled %>
|
9
|
+
<%= link_to t("actions.new", scope: "decidim.proposals", name: t("models.proposal.name", scope: "decidim.proposals.admin")), new_proposal_path, class: 'button tiny button--simple' if can? :manage, current_feature %>
|
10
|
+
<% end %>
|
11
|
+
|
12
|
+
<button class="exports dropdown tiny button button--simple" data-toggle="export-dropdown"><%= t "actions.export", scope: "decidim.proposals" %></button>
|
13
|
+
<div class="dropdown-pane" id="export-dropdown" data-dropdown data-auto-focus="true" data-close-on-click="true">
|
14
|
+
<ul class="vertical menu add-features">
|
15
|
+
<li class="exports--csv"><%= link_to "CSV", exports_path(feature_id: current_feature, participatory_process_id: current_participatory_process, format: :csv), method: :post %></li>
|
16
|
+
<li class="exports--json"><%= link_to "JSON", exports_path(feature_id: current_feature, participatory_process_id: current_participatory_process, format: :json), method: :post %></li>
|
17
|
+
</ul>
|
18
|
+
</div>
|
19
|
+
|
20
|
+
</div>
|
9
21
|
</h2>
|
10
22
|
</div>
|
11
23
|
|
@@ -1,25 +1,4 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
<%= link_to model do%>
|
6
|
-
<h5 class="card__title"><%= model.title %></h5>
|
7
|
-
<% end %>
|
8
|
-
<div class="card__author author-data author-data--small">
|
9
|
-
<div class="author-data__main">
|
10
|
-
<div class="author author--inline">
|
11
|
-
<span class="author__avatar author__avatar--small">
|
12
|
-
<%= image_tag model.author_avatar_url %>
|
13
|
-
</span>
|
14
|
-
<span class="author__name"><%= model.author_name %></span>
|
15
|
-
<%= l model.created_at, format: "%d/%m/%Y" %>
|
16
|
-
</div>
|
17
|
-
</div>
|
18
|
-
</div>
|
19
|
-
</div>
|
20
|
-
<%= render partial: "decidim/proposals/proposals/proposal_badge", locals: { proposal: model } %>
|
21
|
-
<p><%= truncate(model.body, length: 100) %></p>
|
22
|
-
<%= render partial: "decidim/proposals/proposals/tags", locals: { proposal: model } %>
|
23
|
-
</div>
|
24
|
-
</article>
|
25
|
-
</div>
|
1
|
+
<% content_for(:title, model.title) %>
|
2
|
+
|
3
|
+
<%= render partial: "decidim/proposals/proposals/proposal_badge", locals: { proposal: model } %>
|
4
|
+
<p><%= truncate(model.body, length: 100) %></p>
|
data/config/locales/ca.yml
CHANGED
@@ -29,9 +29,11 @@ ca:
|
|
29
29
|
proposal_answering_enabled: Resposta oficial a propostes activades
|
30
30
|
votes_blocked: Suports bloquejats
|
31
31
|
votes_enabled: Suports habilitats
|
32
|
+
votes_hidden: Vots ocults (si els vots estan habilitats, marcant aquesta opció amagarà el nombre de vots)
|
32
33
|
proposals:
|
33
34
|
actions:
|
34
35
|
answer: Respondre
|
36
|
+
export: Exporta
|
35
37
|
new: Nova
|
36
38
|
title: Accions
|
37
39
|
admin:
|
@@ -67,6 +69,8 @@ ca:
|
|
67
69
|
create:
|
68
70
|
error: Hi ha hagut errors en desar la proposta.
|
69
71
|
success: Proposta creada correctament.
|
72
|
+
exports:
|
73
|
+
notice: La seva exportació està actualment en curs. Rebràs un correu electrònic quan estigui complet.
|
70
74
|
models:
|
71
75
|
proposal:
|
72
76
|
fields:
|
data/config/locales/en.yml
CHANGED
@@ -30,10 +30,12 @@ en:
|
|
30
30
|
proposal_answering_enabled: Proposal answering enabled
|
31
31
|
votes_blocked: Votes blocked
|
32
32
|
votes_enabled: Votes enabled
|
33
|
-
votes_hidden: Votes hidden (if votes are enabled, checking this will hide
|
33
|
+
votes_hidden: Votes hidden (if votes are enabled, checking this will hide
|
34
|
+
the number of votes)
|
34
35
|
proposals:
|
35
36
|
actions:
|
36
37
|
answer: Answer
|
38
|
+
export: Export
|
37
39
|
new: New
|
38
40
|
title: Actions
|
39
41
|
admin:
|
@@ -69,6 +71,9 @@ en:
|
|
69
71
|
create:
|
70
72
|
error: There's been errors when saving the proposal.
|
71
73
|
success: Proposal created successfully.
|
74
|
+
exports:
|
75
|
+
notice: Your export is currently in progress. You'll receive an email when
|
76
|
+
it's complete.
|
72
77
|
models:
|
73
78
|
proposal:
|
74
79
|
fields:
|
data/config/locales/es.yml
CHANGED
@@ -29,9 +29,11 @@ es:
|
|
29
29
|
proposal_answering_enabled: Respuesta a propuestas activadas
|
30
30
|
votes_blocked: Votación bloqueada
|
31
31
|
votes_enabled: Votos habilitados
|
32
|
+
votes_hidden: Votos ocultos (si los votos están habilitados, marcando esta opción ocultará el número de votos)
|
32
33
|
proposals:
|
33
34
|
actions:
|
34
35
|
answer: Respuesta
|
36
|
+
export: Exportar
|
35
37
|
new: Nueva
|
36
38
|
title: Acciones
|
37
39
|
admin:
|
@@ -67,6 +69,8 @@ es:
|
|
67
69
|
create:
|
68
70
|
error: Ha habido errores al guardar la propuesta.
|
69
71
|
success: Propuesta creada correctamente.
|
72
|
+
exports:
|
73
|
+
notice: Su exportación está actualmente en curso. Recibirá un correo electrónico cuando esté completo.
|
70
74
|
models:
|
71
75
|
proposal:
|
72
76
|
fields:
|
data/config/locales/fr.yml
CHANGED
@@ -2,4 +2,149 @@ fr:
|
|
2
2
|
activemodel:
|
3
3
|
attributes:
|
4
4
|
proposal:
|
5
|
-
|
5
|
+
body: Corps de texte
|
6
|
+
category_id: Catégorie
|
7
|
+
scope_id: Domaine d'application
|
8
|
+
title: Titre
|
9
|
+
user_group_id: Créer une proposition en tant que
|
10
|
+
proposal_answer:
|
11
|
+
answer: Répondre
|
12
|
+
decidim:
|
13
|
+
features:
|
14
|
+
proposals:
|
15
|
+
actions:
|
16
|
+
create: Créer
|
17
|
+
vote: Voter
|
18
|
+
name: Propositions
|
19
|
+
settings:
|
20
|
+
global:
|
21
|
+
comments_enabled: Commentaires activés
|
22
|
+
geocoding_enabled: Géocodage activé
|
23
|
+
official_proposals_enabled: Propositions officielles activées
|
24
|
+
proposal_answering_enabled: Réponse aux propositions activée
|
25
|
+
vote_limit: Limite de vote
|
26
|
+
step:
|
27
|
+
comments_blocked: Commentaires bloqués
|
28
|
+
creation_enabled: Module propositions activé
|
29
|
+
proposal_answering_enabled: Réponse aux propositions activée
|
30
|
+
votes_blocked: Votes bloqués
|
31
|
+
votes_enabled: Votes activés
|
32
|
+
votes_hidden: Cacher les votes (si les votes sont activés, le compte des votes sera caché)
|
33
|
+
proposals:
|
34
|
+
actions:
|
35
|
+
answer: Répondre
|
36
|
+
export: Exporter
|
37
|
+
new: Nouveau
|
38
|
+
title: Actions
|
39
|
+
admin:
|
40
|
+
actions:
|
41
|
+
preview: Aperçu
|
42
|
+
models:
|
43
|
+
proposal:
|
44
|
+
name: Proposition
|
45
|
+
proposal_answers:
|
46
|
+
edit:
|
47
|
+
accepted: Publié
|
48
|
+
answer_proposal: Répondre
|
49
|
+
rejected: Refusée
|
50
|
+
title: Réponse à la proposition %{title}
|
51
|
+
proposals:
|
52
|
+
answer:
|
53
|
+
invalid: Il y a eu un problème concernant la réponse à cette proposition
|
54
|
+
success: La réponse à la proposition a publiée avec succès
|
55
|
+
create:
|
56
|
+
invalid: Il y a eu un problème lors de la création de cette proposition
|
57
|
+
success: Proposition créée avec succès
|
58
|
+
form:
|
59
|
+
select_a_category: Sélectionner une catégorie
|
60
|
+
index:
|
61
|
+
title: Propositions
|
62
|
+
new:
|
63
|
+
create: Créer
|
64
|
+
title: Créer une proposition
|
65
|
+
answers:
|
66
|
+
accepted: Publié
|
67
|
+
not_answered: Resté sans réponse
|
68
|
+
rejected: Refusée
|
69
|
+
create:
|
70
|
+
error: Il y a eu des erreurs lors de la sauvegarde de la proposition.
|
71
|
+
success: Proposition créée avec succès.
|
72
|
+
exports:
|
73
|
+
notice: Votre exportation est en cours. Vous recevrez un e-mail quand elle sera terminée.
|
74
|
+
models:
|
75
|
+
proposal:
|
76
|
+
fields:
|
77
|
+
category: Catégorie
|
78
|
+
official_proposal: Proposition officielle
|
79
|
+
scope: Domaine d'application
|
80
|
+
state: Etat
|
81
|
+
title: Titre
|
82
|
+
proposals:
|
83
|
+
count:
|
84
|
+
proposals_count:
|
85
|
+
one: 1 proposition
|
86
|
+
other: "%{count} propositions"
|
87
|
+
filters:
|
88
|
+
accepted: Publié
|
89
|
+
activity: Activité
|
90
|
+
all: Toutes
|
91
|
+
category: Catégorie
|
92
|
+
category_prompt: Sélectionner une catégorie
|
93
|
+
citizenship: Citoyenneté
|
94
|
+
official: Elu(e)
|
95
|
+
origin: Retour à l'original
|
96
|
+
rejected: Refusée
|
97
|
+
related_to: Liée à
|
98
|
+
scopes: Domaines d'application
|
99
|
+
search: Rechercher
|
100
|
+
state: État
|
101
|
+
voted: Voté
|
102
|
+
filters_small_view:
|
103
|
+
close_modal: Fermer la fenêtre de dialogue
|
104
|
+
filter: Filtrer
|
105
|
+
filter_by: Filtrer par
|
106
|
+
unfold: Déplier
|
107
|
+
index:
|
108
|
+
new_proposal: Nouvelle proposition
|
109
|
+
view_proposal: Voir la proposition
|
110
|
+
linked_proposals:
|
111
|
+
proposal_votes:
|
112
|
+
one: <span class="card--list__data__number">1</span>vote
|
113
|
+
other: <span class="card--list__data__number">%{count}</span>votes
|
114
|
+
new:
|
115
|
+
back: Retour
|
116
|
+
select_a_category: Veuillez sélectionner une catégorie
|
117
|
+
send: Envoyer
|
118
|
+
title: Nouvelle proposition
|
119
|
+
orders:
|
120
|
+
label: 'Classement des propositions par:'
|
121
|
+
most_voted: Les plus votées
|
122
|
+
random: Aléatoire
|
123
|
+
recent: Les plus récents
|
124
|
+
proposal:
|
125
|
+
view_proposal: Voir la proposition
|
126
|
+
show:
|
127
|
+
proposal_accepted_reason: 'Cette proposition a été acceptée parce que :'
|
128
|
+
proposal_rejected_reason: 'Cette proposition a été refusée parce que:'
|
129
|
+
report: Signaler
|
130
|
+
vote_button:
|
131
|
+
already_voted: Déjà voté
|
132
|
+
no_votes_remaining: Aucun vote restant
|
133
|
+
vote: Voter
|
134
|
+
votes_blocked: Votes désactivés
|
135
|
+
votes_count:
|
136
|
+
count:
|
137
|
+
one: VOTE
|
138
|
+
other: VOTES
|
139
|
+
votes_limit:
|
140
|
+
vote_limit:
|
141
|
+
description: Au lieu de voter autant de propositions que vous voulez, vous ne pouvez voter que jusqu'à %{limit} propositions.
|
142
|
+
left: Restant
|
143
|
+
title: Vous disposez de %{limit} votes à distribuer
|
144
|
+
votes: Votes
|
145
|
+
resource_links:
|
146
|
+
included_proposals:
|
147
|
+
proposal_projects: 'Proposition figurant dans ces projets :'
|
148
|
+
proposal_results: 'Proposition figurant dans ces résultats :'
|
149
|
+
proposals_from_meeting:
|
150
|
+
proposal_meetings: Rencontres connexes
|
@@ -10,7 +10,12 @@ module Decidim
|
|
10
10
|
routes do
|
11
11
|
resources :proposals, only: [:index, :new, :create] do
|
12
12
|
resources :proposal_answers, only: [:edit, :update]
|
13
|
+
|
14
|
+
collection do
|
15
|
+
resources :exports, only: [:create]
|
16
|
+
end
|
13
17
|
end
|
18
|
+
|
14
19
|
root to: "proposals#index"
|
15
20
|
end
|
16
21
|
|
@@ -37,6 +37,20 @@ Decidim.register_feature(:proposals) do |feature|
|
|
37
37
|
resource.template = "decidim/proposals/proposals/linked_proposals"
|
38
38
|
end
|
39
39
|
|
40
|
+
feature.register_stat :proposals_count, primary: true, priority: Decidim::StatsRegistry::HIGH_PRIORITY do |features, start_at, end_at|
|
41
|
+
Decidim::Proposals::FilteredProposals.for(features, start_at, end_at).count
|
42
|
+
end
|
43
|
+
|
44
|
+
feature.register_stat :votes_count, priority: Decidim::StatsRegistry::MEDIUM_PRIORITY do |features, start_at, end_at|
|
45
|
+
proposals = Decidim::Proposals::FilteredProposals.for(features, start_at, end_at)
|
46
|
+
Decidim::Proposals::ProposalVote.where(proposal: proposals).count
|
47
|
+
end
|
48
|
+
|
49
|
+
feature.register_stat :comments_count, tag: :comments do |features, start_at, end_at|
|
50
|
+
proposals = Decidim::Proposals::FilteredProposals.for(features, start_at, end_at)
|
51
|
+
Decidim::Comments::Comment.where(root_commentable: proposals).count
|
52
|
+
end
|
53
|
+
|
40
54
|
feature.seeds do
|
41
55
|
Decidim::ParticipatoryProcess.all.each do |process|
|
42
56
|
next unless process.steps.any?
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-proposals
|
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: 0.
|
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.
|
56
|
+
version: 0.9.1
|
57
57
|
- !ruby/object:Gem::Dependency
|
58
58
|
name: kaminari
|
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: 0.
|
77
|
+
version: 0.10.0
|
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: 0.
|
84
|
+
version: 0.10.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.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-meetings
|
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-results
|
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
|
- !ruby/object:Gem::Dependency
|
128
128
|
name: decidim-budgets
|
129
129
|
requirement: !ruby/object:Gem::Requirement
|
130
130
|
requirements:
|
131
131
|
- - '='
|
132
132
|
- !ruby/object:Gem::Version
|
133
|
-
version: 0.0
|
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
|
140
|
+
version: 0.1.0
|
141
141
|
description: A proposals component for decidim's participatory processes.
|
142
142
|
email:
|
143
143
|
- josepjaume@gmail.com
|
@@ -157,7 +157,9 @@ files:
|
|
157
157
|
- app/commands/decidim/proposals/admin/answer_proposal.rb
|
158
158
|
- app/commands/decidim/proposals/admin/create_proposal.rb
|
159
159
|
- app/commands/decidim/proposals/create_proposal.rb
|
160
|
+
- app/commands/decidim/proposals/create_proposal_export.rb
|
160
161
|
- app/controllers/decidim/proposals/admin/application_controller.rb
|
162
|
+
- app/controllers/decidim/proposals/admin/exports_controller.rb
|
161
163
|
- app/controllers/decidim/proposals/admin/proposal_answers_controller.rb
|
162
164
|
- app/controllers/decidim/proposals/admin/proposals_controller.rb
|
163
165
|
- app/controllers/decidim/proposals/application_controller.rb
|
@@ -171,13 +173,16 @@ files:
|
|
171
173
|
- app/helpers/decidim/proposals/map_helper.rb
|
172
174
|
- app/helpers/decidim/proposals/proposal_order_helper.rb
|
173
175
|
- app/helpers/decidim/proposals/proposal_votes_helper.rb
|
176
|
+
- app/jobs/decidim/proposals/export_job.rb
|
174
177
|
- app/models/decidim/proposals/abilities/admin_user.rb
|
175
178
|
- app/models/decidim/proposals/abilities/current_user.rb
|
176
179
|
- app/models/decidim/proposals/abilities/process_admin_user.rb
|
177
180
|
- app/models/decidim/proposals/application_record.rb
|
178
181
|
- app/models/decidim/proposals/proposal.rb
|
179
182
|
- app/models/decidim/proposals/proposal_vote.rb
|
183
|
+
- app/queries/decidim/proposals/filtered_proposals.rb
|
180
184
|
- app/services/decidim/proposals/proposal_search.rb
|
185
|
+
- app/services/decidim/proposals/proposal_serializer.rb
|
181
186
|
- app/views/decidim/proposals/admin/proposal_answers/edit.html.erb
|
182
187
|
- app/views/decidim/proposals/admin/proposals/_form.html.erb
|
183
188
|
- app/views/decidim/proposals/admin/proposals/index.html.erb
|