decidim-proposals 0.3.2 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/assets/config/decidim_proposals_manifest.js +1 -0
- data/app/assets/javascripts/decidim/proposals/add_proposal.js.es6 +23 -0
- data/app/forms/decidim/proposals/proposal_form.rb +7 -1
- data/app/models/decidim/proposals/proposal.rb +14 -2
- data/app/views/decidim/proposals/proposals/_proposal.html.erb +1 -0
- data/app/views/decidim/proposals/proposals/new.html.erb +5 -0
- data/config/locales/fr.yml +11 -11
- data/db/migrate/20170307085300_migrate_proposal_reports_data_to_reports.rb +1 -1
- data/lib/decidim/proposals/feature.rb +1 -1
- metadata +15 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0e402f0c7815c844f71feab64eb6c0ba24eb0212
|
4
|
+
data.tar.gz: 6272d3cf287ba6e1bd302cf89165ead266c41fe5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 17d7d9569a92625edd185177e230107c81c41d6209fd6448180aa662bb939fa4169cc05838638b089ed3c9b73ee017fd5029e05ec098c4e5329944f461a94387
|
7
|
+
data.tar.gz: 8f91779210c7b26b0b133e0b9e941a9966088adfcd4c7ff99f389b1542073a57bc9380cd7244334a925a75ddf556f517576bb5fd047a1d89b0e68e1616fee80f
|
@@ -0,0 +1,23 @@
|
|
1
|
+
$(() => {
|
2
|
+
window.DecidimProposals = window.DecidimProposals || {};
|
3
|
+
|
4
|
+
window.DecidimProposals.bindProposalAddress = () => {
|
5
|
+
const $checkbox = $('#proposal_has_address');
|
6
|
+
const $addressInput = $('#address_input');
|
7
|
+
|
8
|
+
if ($checkbox.length > 0) {
|
9
|
+
const toggleInput = () => {
|
10
|
+
if ($checkbox[0].checked) {
|
11
|
+
$addressInput.show();
|
12
|
+
} else {
|
13
|
+
$addressInput.hide();
|
14
|
+
}
|
15
|
+
}
|
16
|
+
toggleInput();
|
17
|
+
$checkbox.on('change', toggleInput);
|
18
|
+
}
|
19
|
+
};
|
20
|
+
|
21
|
+
window.DecidimProposals.bindProposalAddress();
|
22
|
+
});
|
23
|
+
|
@@ -14,11 +14,13 @@ module Decidim
|
|
14
14
|
attribute :category_id, Integer
|
15
15
|
attribute :scope_id, Integer
|
16
16
|
attribute :user_group_id, Integer
|
17
|
+
attribute :has_address, Boolean
|
17
18
|
|
18
19
|
validates :title, :body, presence: true, etiquette: true
|
19
20
|
validates :title, length: { maximum: 150 }
|
20
21
|
validates :body, length: { maximum: 500 }, etiquette: true
|
21
|
-
validates :address, geocoding: true, if: -> {
|
22
|
+
validates :address, geocoding: true, if: ->(form) { Decidim.geocoder.present? && form.has_address? }
|
23
|
+
validates :address, presence: true, if: ->(form) { form.has_address? }
|
22
24
|
validates :category, presence: true, if: ->(form) { form.category_id.present? }
|
23
25
|
validates :scope, presence: true, if: ->(form) { form.scope_id.present? }
|
24
26
|
|
@@ -47,6 +49,10 @@ module Decidim
|
|
47
49
|
def scope
|
48
50
|
@scope ||= process_scope || organization_scopes.where(id: scope_id).first
|
49
51
|
end
|
52
|
+
|
53
|
+
def has_address?
|
54
|
+
current_feature.settings.geocoding_enabled? && has_address
|
55
|
+
end
|
50
56
|
end
|
51
57
|
end
|
52
58
|
end
|
@@ -21,8 +21,8 @@ module Decidim
|
|
21
21
|
|
22
22
|
geocoded_by :address, http_headers: ->(proposal) { { "Referer" => proposal.feature.organization.host } }
|
23
23
|
|
24
|
-
scope :accepted,
|
25
|
-
scope :rejected,
|
24
|
+
scope :accepted, -> { where(state: "accepted") }
|
25
|
+
scope :rejected, -> { where(state: "rejected") }
|
26
26
|
|
27
27
|
def self.order_randomly(seed)
|
28
28
|
transaction do
|
@@ -91,6 +91,18 @@ module Decidim
|
|
91
91
|
def reported_content_url
|
92
92
|
ResourceLocatorPresenter.new(self).url
|
93
93
|
end
|
94
|
+
|
95
|
+
# Public: Overrides the `notifiable?` Notifiable concern method.
|
96
|
+
# When a proposal is commented the proposal's author is notified if it is not the same
|
97
|
+
# who has commented the proposal and if the proposal's author has comment notifications enabled.
|
98
|
+
def notifiable?(context)
|
99
|
+
context[:author] != author && author.comments_notifications?
|
100
|
+
end
|
101
|
+
|
102
|
+
# Public: Overrides the `users_to_notify` Notifiable concern method.
|
103
|
+
def users_to_notify
|
104
|
+
[author]
|
105
|
+
end
|
94
106
|
end
|
95
107
|
end
|
96
108
|
end
|
@@ -8,6 +8,7 @@
|
|
8
8
|
<div class="card__author author-data author-data--small">
|
9
9
|
<%= render partial: "author", locals: { proposal: proposal } %>
|
10
10
|
</div>
|
11
|
+
<%= feature_reference(proposal, class: "reference--text-left") %>
|
11
12
|
</div>
|
12
13
|
<%= render partial: "proposal_badge", locals: { proposal: proposal } %>
|
13
14
|
<p><%= truncate(proposal.body, length: 100) %></p>
|
@@ -20,6 +20,9 @@
|
|
20
20
|
|
21
21
|
<% if feature_settings.geocoding_enabled? %>
|
22
22
|
<div class="field">
|
23
|
+
<%= form.check_box :has_address %>
|
24
|
+
</div>
|
25
|
+
<div class="field" id="address_input">
|
23
26
|
<%= form.text_field :address %>
|
24
27
|
</div>
|
25
28
|
<% end %>
|
@@ -50,3 +53,5 @@
|
|
50
53
|
</div>
|
51
54
|
</div>
|
52
55
|
</div>
|
56
|
+
|
57
|
+
<%= javascript_include_tag "decidim/proposals/add_proposal" %>
|
data/config/locales/fr.yml
CHANGED
@@ -4,7 +4,7 @@ fr:
|
|
4
4
|
proposal:
|
5
5
|
body: Corps de texte
|
6
6
|
category_id: Catégorie
|
7
|
-
scope_id:
|
7
|
+
scope_id: Zone d'application
|
8
8
|
title: Titre
|
9
9
|
user_group_id: Créer une proposition en tant que
|
10
10
|
proposal_answer:
|
@@ -21,12 +21,12 @@ fr:
|
|
21
21
|
comments_enabled: Commentaires activés
|
22
22
|
geocoding_enabled: Géocodage activé
|
23
23
|
official_proposals_enabled: Propositions officielles activées
|
24
|
-
proposal_answering_enabled:
|
24
|
+
proposal_answering_enabled: '"Réponses aux propositions" activé'
|
25
25
|
vote_limit: Limite de vote
|
26
26
|
step:
|
27
27
|
comments_blocked: Commentaires bloqués
|
28
28
|
creation_enabled: Module propositions activé
|
29
|
-
proposal_answering_enabled:
|
29
|
+
proposal_answering_enabled: '"Réponses aux propositions" activé'
|
30
30
|
votes_blocked: Votes bloqués
|
31
31
|
votes_enabled: Votes activés
|
32
32
|
votes_hidden: Cacher les votes (si les votes sont activés, le compte des votes sera caché)
|
@@ -43,7 +43,7 @@ fr:
|
|
43
43
|
name: Proposition
|
44
44
|
proposal_answers:
|
45
45
|
edit:
|
46
|
-
accepted:
|
46
|
+
accepted: Retenue
|
47
47
|
answer_proposal: Répondre
|
48
48
|
rejected: Refusée
|
49
49
|
title: Réponse à la proposition %{title}
|
@@ -62,7 +62,7 @@ fr:
|
|
62
62
|
create: Créer
|
63
63
|
title: Créer une proposition
|
64
64
|
answers:
|
65
|
-
accepted:
|
65
|
+
accepted: Retenues
|
66
66
|
not_answered: Resté sans réponse
|
67
67
|
rejected: Refusée
|
68
68
|
create:
|
@@ -73,7 +73,7 @@ fr:
|
|
73
73
|
fields:
|
74
74
|
category: Catégorie
|
75
75
|
official_proposal: Proposition officielle
|
76
|
-
scope:
|
76
|
+
scope: Zone d'application
|
77
77
|
state: Etat
|
78
78
|
title: Titre
|
79
79
|
proposals:
|
@@ -82,7 +82,7 @@ fr:
|
|
82
82
|
one: 1 proposition
|
83
83
|
other: "%{count} propositions"
|
84
84
|
filters:
|
85
|
-
accepted:
|
85
|
+
accepted: Retenues
|
86
86
|
activity: Activité
|
87
87
|
all: Toutes
|
88
88
|
category: Catégorie
|
@@ -92,10 +92,10 @@ fr:
|
|
92
92
|
origin: Retour à l'original
|
93
93
|
rejected: Refusée
|
94
94
|
related_to: Liée à
|
95
|
-
scopes:
|
95
|
+
scopes: Zones d'application
|
96
96
|
search: Rechercher
|
97
97
|
state: État
|
98
|
-
voted:
|
98
|
+
voted: Votées
|
99
99
|
filters_small_view:
|
100
100
|
close_modal: Fermer la fenêtre de dialogue
|
101
101
|
filter: Filtrer
|
@@ -111,7 +111,7 @@ fr:
|
|
111
111
|
new:
|
112
112
|
back: Retour
|
113
113
|
select_a_category: Veuillez sélectionner une catégorie
|
114
|
-
send:
|
114
|
+
send: Publier
|
115
115
|
title: Nouvelle proposition
|
116
116
|
orders:
|
117
117
|
label: 'Classement des propositions par:'
|
@@ -119,7 +119,7 @@ fr:
|
|
119
119
|
random: Aléatoire
|
120
120
|
recent: Les plus récents
|
121
121
|
show:
|
122
|
-
proposal_accepted_reason: 'Cette proposition a été
|
122
|
+
proposal_accepted_reason: 'Cette proposition a été retenue parce que :'
|
123
123
|
proposal_rejected_reason: 'Cette proposition a été refusée parce que:'
|
124
124
|
report: Signaler
|
125
125
|
vote_button:
|
@@ -7,7 +7,7 @@ class MigrateProposalReportsDataToReports < ActiveRecord::Migration[5.0]
|
|
7
7
|
end
|
8
8
|
|
9
9
|
def change
|
10
|
-
Decidim::Proposals::ProposalReport.
|
10
|
+
Decidim::Proposals::ProposalReport.find_each do |proposal_report|
|
11
11
|
moderation = Decidim::Moderation.find_or_create_by!(reportable: proposal_report.proposal,
|
12
12
|
participatory_process: proposal_report.proposal.feature.participatory_process)
|
13
13
|
Decidim::Report.create!(moderation: moderation,
|
@@ -72,7 +72,7 @@ Decidim.register_feature(:proposals) do |feature|
|
|
72
72
|
end
|
73
73
|
|
74
74
|
feature.seeds do
|
75
|
-
Decidim::ParticipatoryProcess.
|
75
|
+
Decidim::ParticipatoryProcess.find_each do |process|
|
76
76
|
next unless process.steps.any?
|
77
77
|
|
78
78
|
feature = Decidim::Feature.create!(
|
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.
|
4
|
+
version: 0.4.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-07-12 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: decidim-core
|
@@ -18,28 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - '='
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 0.
|
21
|
+
version: 0.4.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.4.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.
|
35
|
+
version: 0.4.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.4.0
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: rectify
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -88,56 +88,56 @@ dependencies:
|
|
88
88
|
requirements:
|
89
89
|
- - '='
|
90
90
|
- !ruby/object:Gem::Version
|
91
|
-
version: 0.
|
91
|
+
version: 0.4.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.4.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.
|
105
|
+
version: 0.4.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.4.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.
|
119
|
+
version: 0.4.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.
|
126
|
+
version: 0.4.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.
|
133
|
+
version: 0.4.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.
|
140
|
+
version: 0.4.0
|
141
141
|
description: A proposals component for decidim's participatory processes.
|
142
142
|
email:
|
143
143
|
- josepjaume@gmail.com
|
@@ -152,6 +152,7 @@ files:
|
|
152
152
|
- app/assets/config/decidim_proposals_manifest.css
|
153
153
|
- app/assets/config/decidim_proposals_manifest.js
|
154
154
|
- app/assets/images/decidim/proposals/icon.svg
|
155
|
+
- app/assets/javascripts/decidim/proposals/add_proposal.js.es6
|
155
156
|
- app/assets/javascripts/decidim/proposals/social_share.js
|
156
157
|
- app/assets/stylesheets/decidim/proposals/social_share.css.scss
|
157
158
|
- app/commands/decidim/proposals/admin/answer_proposal.rb
|