decidim-proposals 0.26.5 → 0.26.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/app/cells/decidim/proposals/collaborative_draft_m_cell.rb +1 -1
- data/app/commands/decidim/proposals/admin/notify_proposal_answer.rb +2 -0
- data/app/helpers/decidim/proposals/application_helper.rb +14 -3
- data/app/helpers/decidim/proposals/proposals_helper.rb +1 -1
- data/app/views/decidim/proposals/admin/participatory_texts/_article-preview.html.erb +2 -2
- data/app/views/decidim/proposals/collaborative_drafts/_edit_form_fields.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/show.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/_linked_proposals.html.erb +2 -1
- data/config/locales/ar.yml +254 -0
- data/config/locales/ca.yml +2 -2
- data/config/locales/es-MX.yml +1 -1
- data/config/locales/es-PY.yml +1 -1
- data/config/locales/es.yml +2 -2
- data/config/locales/eu.yml +35 -35
- data/config/locales/fa-IR.yml +1 -0
- data/config/locales/fi.yml +4 -4
- data/config/locales/hu.yml +1 -1
- data/config/locales/is-IS.yml +0 -1
- data/config/locales/ja.yml +13 -13
- data/config/locales/kaa.yml +1 -0
- data/config/locales/nl.yml +1 -1
- data/config/locales/pt-BR.yml +1 -1
- data/config/locales/pt.yml +1 -1
- data/config/locales/ru.yml +0 -1
- data/config/locales/uk.yml +0 -1
- data/config/locales/zh-TW.yml +966 -0
- data/lib/decidim/proposals/component.rb +7 -6
- data/lib/decidim/proposals/import/proposal_answer_creator.rb +31 -23
- data/lib/decidim/proposals/proposal_serializer.rb +9 -1
- data/lib/decidim/proposals/version.rb +1 -1
- metadata +20 -18
@@ -28,19 +28,19 @@ Decidim.register_component(:proposals) do |component|
|
|
28
28
|
component.settings(:global) do |settings|
|
29
29
|
settings.attribute :scopes_enabled, type: :boolean, default: false
|
30
30
|
settings.attribute :scope_id, type: :scope
|
31
|
-
settings.attribute :vote_limit, type: :integer, default: 0
|
32
|
-
settings.attribute :minimum_votes_per_user, type: :integer, default: 0
|
33
|
-
settings.attribute :proposal_limit, type: :integer, default: 0
|
31
|
+
settings.attribute :vote_limit, type: :integer, default: 0, required: true
|
32
|
+
settings.attribute :minimum_votes_per_user, type: :integer, default: 0, required: true
|
33
|
+
settings.attribute :proposal_limit, type: :integer, default: 0, required: true
|
34
34
|
settings.attribute :proposal_length, type: :integer, default: 500
|
35
35
|
settings.attribute :proposal_edit_time, type: :enum, default: "limited", choices: -> { %w(limited infinite) }
|
36
|
-
settings.attribute :proposal_edit_before_minutes, type: :integer, default: 5
|
37
|
-
settings.attribute :threshold_per_proposal, type: :integer, default: 0
|
36
|
+
settings.attribute :proposal_edit_before_minutes, type: :integer, default: 5, required: true
|
37
|
+
settings.attribute :threshold_per_proposal, type: :integer, default: 0, required: true
|
38
38
|
settings.attribute :can_accumulate_supports_beyond_threshold, type: :boolean, default: false
|
39
39
|
settings.attribute :proposal_answering_enabled, type: :boolean, default: true
|
40
40
|
settings.attribute :default_sort_order, type: :select, default: "default", choices: -> { POSSIBLE_SORT_ORDERS }
|
41
41
|
settings.attribute :official_proposals_enabled, type: :boolean, default: true
|
42
42
|
settings.attribute :comments_enabled, type: :boolean, default: true
|
43
|
-
settings.attribute :comments_max_length, type: :integer, required:
|
43
|
+
settings.attribute :comments_max_length, type: :integer, required: true
|
44
44
|
settings.attribute :geocoding_enabled, type: :boolean, default: false
|
45
45
|
settings.attribute :attachments_allowed, type: :boolean, default: false
|
46
46
|
settings.attribute :resources_permissions_enabled, type: :boolean, default: true
|
@@ -131,6 +131,7 @@ Decidim.register_component(:proposals) do |component|
|
|
131
131
|
|
132
132
|
collection = Decidim::Proposals::Proposal
|
133
133
|
.published
|
134
|
+
.not_hidden
|
134
135
|
.where(component: component_instance)
|
135
136
|
.includes(:scope, :category, :component)
|
136
137
|
|
@@ -32,34 +32,41 @@ module Decidim
|
|
32
32
|
resource,
|
33
33
|
current_user
|
34
34
|
) do
|
35
|
-
resource.save!
|
35
|
+
resource.try(:save!)
|
36
36
|
end
|
37
|
-
|
37
|
+
|
38
|
+
notify
|
38
39
|
end
|
39
40
|
|
40
41
|
private
|
41
42
|
|
43
|
+
attr_reader :initial_state
|
44
|
+
|
42
45
|
def resource
|
43
|
-
@resource ||=
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
proposal
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
proposal
|
46
|
+
@resource ||= fetch_resource
|
47
|
+
end
|
48
|
+
|
49
|
+
def fetch_resource
|
50
|
+
proposal = Decidim::Proposals::Proposal.find_by(id: id)
|
51
|
+
return nil unless proposal
|
52
|
+
return nil if proposal.emendation?
|
53
|
+
|
54
|
+
if proposal.component != component
|
55
|
+
proposal.errors.add(:component, :invalid)
|
56
|
+
return proposal
|
57
|
+
end
|
58
|
+
|
59
|
+
proposal.answer = answer
|
60
|
+
proposal.answered_at = Time.current
|
61
|
+
@initial_state = proposal.state
|
62
|
+
|
63
|
+
if POSSIBLE_ANSWER_STATES.include?(state)
|
64
|
+
proposal.state = state
|
65
|
+
proposal.state_published_at = Time.current if component.current_settings.publish_answers_immediately?
|
66
|
+
else
|
67
|
+
proposal.errors.add(:state, :invalid)
|
62
68
|
end
|
69
|
+
proposal
|
63
70
|
end
|
64
71
|
|
65
72
|
def id
|
@@ -86,8 +93,9 @@ module Decidim
|
|
86
93
|
context[:current_user]
|
87
94
|
end
|
88
95
|
|
89
|
-
def notify
|
90
|
-
|
96
|
+
def notify
|
97
|
+
state = initial_state || resource.try(:state)
|
98
|
+
::Decidim::Proposals::Admin::NotifyProposalAnswer.call(resource, state)
|
91
99
|
end
|
92
100
|
end
|
93
101
|
end
|
@@ -8,6 +8,7 @@ module Decidim
|
|
8
8
|
include Decidim::ApplicationHelper
|
9
9
|
include Decidim::ResourceHelper
|
10
10
|
include Decidim::TranslationsHelper
|
11
|
+
include HtmlToPlainText
|
11
12
|
|
12
13
|
# Public: Initializes the serializer with a proposal.
|
13
14
|
def initialize(proposal)
|
@@ -32,7 +33,7 @@ module Decidim
|
|
32
33
|
},
|
33
34
|
component: { id: component.id },
|
34
35
|
title: proposal.title,
|
35
|
-
body: proposal.body,
|
36
|
+
body: convert_to_plain_text(proposal.body),
|
36
37
|
address: proposal.address,
|
37
38
|
latitude: proposal.latitude,
|
38
39
|
longitude: proposal.longitude,
|
@@ -93,6 +94,13 @@ module Decidim
|
|
93
94
|
|
94
95
|
Decidim::ResourceLocatorPresenter.new(proposal.amendable).url
|
95
96
|
end
|
97
|
+
|
98
|
+
# Recursively strips HTML tags from given Hash strings using convert_to_text from Premailer
|
99
|
+
def convert_to_plain_text(value)
|
100
|
+
return value.transform_values { |v| convert_to_plain_text(v) } if value.is_a?(Hash)
|
101
|
+
|
102
|
+
convert_to_text(value)
|
103
|
+
end
|
96
104
|
end
|
97
105
|
end
|
98
106
|
end
|
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.26.
|
4
|
+
version: 0.26.7
|
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: 2023-
|
13
|
+
date: 2023-05-11 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.26.
|
21
|
+
version: 0.26.7
|
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.26.
|
28
|
+
version: 0.26.7
|
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.26.
|
35
|
+
version: 0.26.7
|
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.26.
|
42
|
+
version: 0.26.7
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: doc2text
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -80,84 +80,84 @@ dependencies:
|
|
80
80
|
requirements:
|
81
81
|
- - '='
|
82
82
|
- !ruby/object:Gem::Version
|
83
|
-
version: 0.26.
|
83
|
+
version: 0.26.7
|
84
84
|
type: :development
|
85
85
|
prerelease: false
|
86
86
|
version_requirements: !ruby/object:Gem::Requirement
|
87
87
|
requirements:
|
88
88
|
- - '='
|
89
89
|
- !ruby/object:Gem::Version
|
90
|
-
version: 0.26.
|
90
|
+
version: 0.26.7
|
91
91
|
- !ruby/object:Gem::Dependency
|
92
92
|
name: decidim-assemblies
|
93
93
|
requirement: !ruby/object:Gem::Requirement
|
94
94
|
requirements:
|
95
95
|
- - '='
|
96
96
|
- !ruby/object:Gem::Version
|
97
|
-
version: 0.26.
|
97
|
+
version: 0.26.7
|
98
98
|
type: :development
|
99
99
|
prerelease: false
|
100
100
|
version_requirements: !ruby/object:Gem::Requirement
|
101
101
|
requirements:
|
102
102
|
- - '='
|
103
103
|
- !ruby/object:Gem::Version
|
104
|
-
version: 0.26.
|
104
|
+
version: 0.26.7
|
105
105
|
- !ruby/object:Gem::Dependency
|
106
106
|
name: decidim-budgets
|
107
107
|
requirement: !ruby/object:Gem::Requirement
|
108
108
|
requirements:
|
109
109
|
- - '='
|
110
110
|
- !ruby/object:Gem::Version
|
111
|
-
version: 0.26.
|
111
|
+
version: 0.26.7
|
112
112
|
type: :development
|
113
113
|
prerelease: false
|
114
114
|
version_requirements: !ruby/object:Gem::Requirement
|
115
115
|
requirements:
|
116
116
|
- - '='
|
117
117
|
- !ruby/object:Gem::Version
|
118
|
-
version: 0.26.
|
118
|
+
version: 0.26.7
|
119
119
|
- !ruby/object:Gem::Dependency
|
120
120
|
name: decidim-dev
|
121
121
|
requirement: !ruby/object:Gem::Requirement
|
122
122
|
requirements:
|
123
123
|
- - '='
|
124
124
|
- !ruby/object:Gem::Version
|
125
|
-
version: 0.26.
|
125
|
+
version: 0.26.7
|
126
126
|
type: :development
|
127
127
|
prerelease: false
|
128
128
|
version_requirements: !ruby/object:Gem::Requirement
|
129
129
|
requirements:
|
130
130
|
- - '='
|
131
131
|
- !ruby/object:Gem::Version
|
132
|
-
version: 0.26.
|
132
|
+
version: 0.26.7
|
133
133
|
- !ruby/object:Gem::Dependency
|
134
134
|
name: decidim-meetings
|
135
135
|
requirement: !ruby/object:Gem::Requirement
|
136
136
|
requirements:
|
137
137
|
- - '='
|
138
138
|
- !ruby/object:Gem::Version
|
139
|
-
version: 0.26.
|
139
|
+
version: 0.26.7
|
140
140
|
type: :development
|
141
141
|
prerelease: false
|
142
142
|
version_requirements: !ruby/object:Gem::Requirement
|
143
143
|
requirements:
|
144
144
|
- - '='
|
145
145
|
- !ruby/object:Gem::Version
|
146
|
-
version: 0.26.
|
146
|
+
version: 0.26.7
|
147
147
|
- !ruby/object:Gem::Dependency
|
148
148
|
name: decidim-participatory_processes
|
149
149
|
requirement: !ruby/object:Gem::Requirement
|
150
150
|
requirements:
|
151
151
|
- - '='
|
152
152
|
- !ruby/object:Gem::Version
|
153
|
-
version: 0.26.
|
153
|
+
version: 0.26.7
|
154
154
|
type: :development
|
155
155
|
prerelease: false
|
156
156
|
version_requirements: !ruby/object:Gem::Requirement
|
157
157
|
requirements:
|
158
158
|
- - '='
|
159
159
|
- !ruby/object:Gem::Version
|
160
|
-
version: 0.26.
|
160
|
+
version: 0.26.7
|
161
161
|
description: A proposals component for decidim's participatory spaces.
|
162
162
|
email:
|
163
163
|
- josepjaume@gmail.com
|
@@ -469,6 +469,7 @@ files:
|
|
469
469
|
- config/locales/et-EE.yml
|
470
470
|
- config/locales/et.yml
|
471
471
|
- config/locales/eu.yml
|
472
|
+
- config/locales/fa-IR.yml
|
472
473
|
- config/locales/fi-pl.yml
|
473
474
|
- config/locales/fi-plain.yml
|
474
475
|
- config/locales/fi.yml
|
@@ -487,6 +488,7 @@ files:
|
|
487
488
|
- config/locales/it.yml
|
488
489
|
- config/locales/ja.yml
|
489
490
|
- config/locales/ka-GE.yml
|
491
|
+
- config/locales/kaa.yml
|
490
492
|
- config/locales/ko-KR.yml
|
491
493
|
- config/locales/ko.yml
|
492
494
|
- config/locales/lb-LU.yml
|