decidim-proposals 0.16.1 → 0.17.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/documents/decidim/proposals/participatory_texts/participatory_text.md +52 -0
- data/app/assets/documents/decidim/proposals/participatory_texts/participatory_text.odt +0 -0
- data/app/cells/decidim/proposals/collaborative_draft_cell.rb +0 -4
- data/app/cells/decidim/proposals/participatory_text_proposal_cell.rb +0 -6
- data/app/cells/decidim/proposals/proposal_cell.rb +0 -4
- data/app/cells/decidim/proposals/proposal_m_cell.rb +5 -1
- data/app/commands/decidim/proposals/admin/import_proposals.rb +5 -1
- data/app/commands/decidim/proposals/vote_proposal.rb +4 -2
- data/app/commands/decidim/proposals/withdraw_proposal.rb +2 -2
- data/app/controllers/decidim/proposals/admin/participatory_texts_controller.rb +3 -3
- data/app/controllers/decidim/proposals/collaborative_drafts_controller.rb +4 -1
- data/app/controllers/decidim/proposals/proposals_controller.rb +4 -3
- data/app/forms/decidim/proposals/admin/import_participatory_text_form.rb +14 -0
- data/app/forms/decidim/proposals/admin/preview_participatory_text_form.rb +1 -1
- data/app/forms/decidim/proposals/admin/proposals_import_form.rb +1 -0
- data/app/helpers/decidim/proposals/participatory_texts_helper.rb +14 -0
- data/app/helpers/decidim/proposals/proposal_wizard_helper.rb +13 -0
- data/app/models/decidim/proposals/collaborative_draft.rb +5 -0
- data/app/permissions/decidim/proposals/permissions.rb +20 -6
- data/app/queries/decidim/proposals/metrics/accepted_proposals_metric_manage.rb +5 -1
- data/app/queries/decidim/proposals/metrics/proposals_metric_manage.rb +2 -2
- data/app/queries/decidim/proposals/metrics/votes_metric_manage.rb +1 -1
- data/app/services/decidim/proposals/proposal_builder.rb +34 -6
- data/app/views/decidim/proposals/admin/participatory_texts/new_import.html.erb +1 -1
- data/app/views/decidim/proposals/admin/proposals/_proposal-tr.html.erb +0 -1
- data/app/views/decidim/proposals/admin/proposals_imports/new.html.erb +3 -0
- data/app/views/decidim/proposals/collaborative_drafts/_accept_request_access_form.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/_collaborator_requests.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/_reject_request_access_form.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/_wizard_aside.html.erb +16 -0
- data/app/views/decidim/proposals/collaborative_drafts/compare.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/complete.html.erb +1 -1
- data/app/views/decidim/proposals/collaborative_drafts/new.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/_proposal_preview.html.erb +11 -1
- data/app/views/decidim/proposals/proposals/_vote_button.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/_wizard_aside.html.erb +5 -3
- data/app/views/decidim/proposals/proposals/compare.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/participatory_texts/_proposal_vote_button.html.erb +1 -1
- data/app/views/decidim/proposals/proposals/show.html.erb +20 -10
- data/config/locales/ar-SA.yml +139 -10
- data/config/locales/ca.yml +59 -44
- data/config/locales/cs-CZ.yml +13 -1
- data/config/locales/cs.yml +790 -0
- data/config/locales/de.yml +21 -6
- data/config/locales/en.yml +111 -95
- data/config/locales/es-MX.yml +22 -7
- data/config/locales/es-PY.yml +21 -6
- data/config/locales/es.yml +77 -62
- data/config/locales/eu.yml +25 -10
- data/config/locales/fi-pl.yml +15 -3
- data/config/locales/fi-plain.yml +766 -0
- data/config/locales/fi.yml +85 -70
- data/config/locales/fr.yml +21 -6
- data/config/locales/gl.yml +21 -6
- data/config/locales/hu.yml +22 -7
- data/config/locales/id-ID.yml +21 -6
- data/config/locales/it.yml +22 -7
- data/config/locales/nl.yml +25 -10
- data/config/locales/pl.yml +22 -7
- data/config/locales/pt-BR.yml +21 -6
- data/config/locales/pt.yml +21 -6
- data/config/locales/ru.yml +0 -7
- data/config/locales/sv.yml +21 -6
- data/config/locales/tr-TR.yml +21 -6
- data/config/locales/uk.yml +0 -7
- data/lib/decidim/content_renderers/proposal_renderer.rb +5 -7
- data/lib/decidim/proposals/admin_engine.rb +8 -9
- data/lib/decidim/proposals/doc_to_markdown.rb +10 -0
- data/lib/decidim/proposals/markdown_to_proposals.rb +15 -1
- data/lib/decidim/proposals/version.rb +1 -1
- metadata +23 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8bd0f06eca6fadd85f7cff679eed7d31d1350394010f46de1033cc1ce34f3566
|
4
|
+
data.tar.gz: da5186ec1edfb655823e1b5802976d5c753471c6b4f95102729c6e1cabaf0566
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ae4c19035219cd815b79c31253766c95ee56e549b73b15c91953beb36967c582383692a60330bdc6766d0e223994e55923d6fc05a7dbd6359184cb660f2f66f2
|
7
|
+
data.tar.gz: 474931fce6b3ba9e3f6261fc4f7f587e0ee81662a929b8483f8ce96c4116a69fbca9b2cf295e5a9c161b3f9a2be17502b876cf649e72c436ab3e98077c838b01
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# Section title 1: grouping content
|
2
|
+
|
3
|
+
Participatory texts relay on the parsing of Markdown texts to produce a structured document.
|
4
|
+
|
5
|
+
Participatory texts are divided into 3 types of blocks:
|
6
|
+
- Section: produced by main headers (paragraphs starting with "# ")
|
7
|
+
- Subsection: produced by secondary headers (paragraphs starting more than one "#") until 6 levels.
|
8
|
+
- Article: produced by paragraphs and lists.
|
9
|
+
|
10
|
+
## Subsection title 1.1
|
11
|
+
Parsing of Markdown is strict.
|
12
|
+
This means that, for paragraphs and lists, all blocks should be separated by a blank line between them.
|
13
|
+
The first, second and this third paragraphs, for example, will be grouped into a single participatory text article.
|
14
|
+
|
15
|
+
This paragraph instead, will produce a single participatory text article.
|
16
|
+
|
17
|
+
This paragraph also, will produce a third participatory text article.
|
18
|
+
|
19
|
+
## Subsection title 1.2
|
20
|
+
|
21
|
+
Inside a paragraph list or a list, **bold text** is supported, *italics text* is supported, __underlined text__ is supported.
|
22
|
+
As explained [here](https://daringfireball.net/projects/markdown/syntax#em) Markdown treats asterisks (\*) and underscores (\_) as indicators of emphasis. Text wrapped with one \* or \_ will be wrapped with an HTML <em> tag; double \*’s or \_’s will be wrapped with an HTML <strong> tag. E.g., this input:
|
23
|
+
- *single asterisks*
|
24
|
+
- _single underscores_
|
25
|
+
- **double asterisks**
|
26
|
+
- __double underscores__
|
27
|
+
|
28
|
+
You can use the following reference when writing your documents: [https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet](https://github.com/adam-p/markdown-here/wiki/Markdown-Cheatsheet).
|
29
|
+
|
30
|
+
# Section title 2: lists
|
31
|
+
|
32
|
+
Lists will be parsed as one block:
|
33
|
+
|
34
|
+
- consensus by simple majority: when a, b, and c appear in the creation.
|
35
|
+
- consensus by enhanced majority: when a, b, c and also d appear in the creation.
|
36
|
+
- consensus by absolute majority: when x, y and z appear in the creation.
|
37
|
+
- consensus by imposing whatever the organization wants: to be used at will.
|
38
|
+
- consensus by ignoring whatever resulted from the previous consensus: to be used when organization don't like the results of another consensus system.
|
39
|
+
|
40
|
+
Ordered lists reset numberings to the correct order (1,2,3,4,5 in this case):
|
41
|
+
|
42
|
+
1. one
|
43
|
+
2. two
|
44
|
+
3. three
|
45
|
+
1. four
|
46
|
+
1. five
|
47
|
+
|
48
|
+
# Section title 3: images and links
|
49
|
+
|
50
|
+
A link to Decidim's web site uses [this format](https://decidim.org).
|
51
|
+
|
52
|
+
![Important image for Decidim](https://meta.decidim.org/assets/decidim/decidim-logo-1f39092fb3e41d23936dc8aeadd054e2119807dccf3c395de88637e4187f0a3f.svg)
|
Binary file
|
@@ -12,8 +12,6 @@ module Decidim
|
|
12
12
|
include Messaging::ConversationHelper
|
13
13
|
include Decidim::SanitizeHelper
|
14
14
|
|
15
|
-
delegate :current_organization, to: :controller
|
16
|
-
|
17
15
|
def show
|
18
16
|
render
|
19
17
|
end
|
@@ -35,10 +33,6 @@ module Decidim
|
|
35
33
|
decidim_sanitize(strip_links(formatted))
|
36
34
|
end
|
37
35
|
|
38
|
-
def current_user
|
39
|
-
context[:current_user]
|
40
|
-
end
|
41
|
-
|
42
36
|
def resource_path
|
43
37
|
resource_locator(model).path
|
44
38
|
end
|
@@ -50,7 +50,7 @@ module Decidim
|
|
50
50
|
|
51
51
|
def statuses
|
52
52
|
return [:endorsements_count, :comments_count] if model.draft?
|
53
|
-
return [:creation_date, :endorsements_count, :comments_count]
|
53
|
+
return [:creation_date, :endorsements_count, :comments_count] if !has_link_to_resource? || !can_be_followed?
|
54
54
|
[:creation_date, :follow, :endorsements_count, :comments_count]
|
55
55
|
end
|
56
56
|
|
@@ -87,6 +87,10 @@ module Decidim
|
|
87
87
|
t("decidim.proposals.proposals.votes_count.need_more_votes")
|
88
88
|
end
|
89
89
|
end
|
90
|
+
|
91
|
+
def can_be_followed?
|
92
|
+
!model.withdrawn?
|
93
|
+
end
|
90
94
|
end
|
91
95
|
end
|
92
96
|
end
|
@@ -35,7 +35,7 @@ module Decidim
|
|
35
35
|
|
36
36
|
Decidim::Proposals::ProposalBuilder.copy(
|
37
37
|
original_proposal,
|
38
|
-
author:
|
38
|
+
author: proposal_author,
|
39
39
|
action_user: form.current_user,
|
40
40
|
extra_attributes: {
|
41
41
|
"component" => target_component
|
@@ -74,6 +74,10 @@ module Decidim
|
|
74
74
|
proposal.component == target_component
|
75
75
|
end
|
76
76
|
end
|
77
|
+
|
78
|
+
def proposal_author
|
79
|
+
form.keep_authors ? nil : @form.current_organization
|
80
|
+
end
|
77
81
|
end
|
78
82
|
end
|
79
83
|
end
|
@@ -26,8 +26,10 @@ module Decidim
|
|
26
26
|
return broadcast(:invalid) unless vote.valid?
|
27
27
|
|
28
28
|
ActiveRecord::Base.transaction do
|
29
|
-
|
30
|
-
|
29
|
+
@proposal.with_lock do
|
30
|
+
vote.save!
|
31
|
+
update_temporary_votes
|
32
|
+
end
|
31
33
|
end
|
32
34
|
|
33
35
|
Decidim::Gamification.increment_score(@current_user, :proposal_votes)
|
@@ -16,11 +16,11 @@ module Decidim
|
|
16
16
|
# Executes the command. Broadcasts these events:
|
17
17
|
#
|
18
18
|
# - :ok when everything is valid, together with the proposal.
|
19
|
-
# - :
|
19
|
+
# - :has_supports if the proposal already has supports or does not belong to current user.
|
20
20
|
#
|
21
21
|
# Returns nothing.
|
22
22
|
def call
|
23
|
-
return broadcast(:
|
23
|
+
return broadcast(:has_supports) if @proposal.votes.any?
|
24
24
|
|
25
25
|
transaction do
|
26
26
|
change_proposal_state_to_withdrawn
|
@@ -27,7 +27,7 @@ module Decidim
|
|
27
27
|
Admin::ImportParticipatoryText.call(@import) do
|
28
28
|
on(:ok) do
|
29
29
|
flash[:notice] = I18n.t("participatory_texts.import.success", scope: "decidim.proposals.admin")
|
30
|
-
redirect_to
|
30
|
+
redirect_to EngineRouter.admin_proxy(current_component).participatory_texts_path
|
31
31
|
end
|
32
32
|
|
33
33
|
on(:invalid) do
|
@@ -49,7 +49,7 @@ module Decidim
|
|
49
49
|
UpdateParticipatoryText.call(@preview_form) do
|
50
50
|
on(:ok) do
|
51
51
|
flash[:notice] = I18n.t("participatory_texts.update.success", scope: "decidim.proposals.admin")
|
52
|
-
redirect_to
|
52
|
+
redirect_to EngineRouter.admin_proxy(current_component).participatory_texts_path
|
53
53
|
end
|
54
54
|
|
55
55
|
on(:invalid) do |failures|
|
@@ -85,7 +85,7 @@ module Decidim
|
|
85
85
|
DiscardParticipatoryText.call(current_component) do
|
86
86
|
on(:ok) do
|
87
87
|
flash[:notice] = I18n.t("participatory_texts.discard.success", scope: "decidim.proposals.admin")
|
88
|
-
redirect_to
|
88
|
+
redirect_to EngineRouter.admin_proxy(current_component).participatory_texts_path
|
89
89
|
end
|
90
90
|
end
|
91
91
|
end
|
@@ -24,6 +24,7 @@ module Decidim
|
|
24
24
|
def index
|
25
25
|
@collaborative_drafts = search
|
26
26
|
.results
|
27
|
+
.not_hidden
|
27
28
|
.includes(:category)
|
28
29
|
.includes(:scope)
|
29
30
|
|
@@ -32,6 +33,7 @@ module Decidim
|
|
32
33
|
end
|
33
34
|
|
34
35
|
def show
|
36
|
+
raise ActionController::RoutingError, "Not Found" unless retrieve_collaborative_draft
|
35
37
|
@report_form = form(Decidim::ReportForm).from_params(reason: "spam")
|
36
38
|
@request_access_form = form(RequestAccessToCollaborativeDraftForm).from_params({})
|
37
39
|
@accept_request_form = form(AcceptAccessToCollaborativeDraftForm).from_params({})
|
@@ -96,6 +98,7 @@ module Decidim
|
|
96
98
|
enforce_permission_to :edit, :collaborative_draft, collaborative_draft: @collaborative_draft
|
97
99
|
|
98
100
|
@form = form(CollaborativeDraftForm).from_model(@collaborative_draft)
|
101
|
+
@form.attachment = form(AttachmentForm).from_model(@collaborative_draft.attachments.first)
|
99
102
|
end
|
100
103
|
|
101
104
|
def update
|
@@ -153,7 +156,7 @@ module Decidim
|
|
153
156
|
end
|
154
157
|
|
155
158
|
def retrieve_collaborative_draft
|
156
|
-
@collaborative_draft = CollaborativeDraft.where(component: current_component).
|
159
|
+
@collaborative_draft = CollaborativeDraft.not_hidden.where(component: current_component).find_by(id: params[:id])
|
157
160
|
end
|
158
161
|
|
159
162
|
def geocoded_collaborative_draft
|
@@ -53,6 +53,7 @@ module Decidim
|
|
53
53
|
end
|
54
54
|
|
55
55
|
def show
|
56
|
+
raise ActionController::RoutingError, "Not Found" unless set_proposal
|
56
57
|
@report_form = form(Decidim::ReportForm).from_params(reason: "spam")
|
57
58
|
end
|
58
59
|
|
@@ -204,8 +205,8 @@ module Decidim
|
|
204
205
|
flash[:notice] = I18n.t("proposals.update.success", scope: "decidim")
|
205
206
|
redirect_to Decidim::ResourceLocatorPresenter.new(@proposal).path
|
206
207
|
end
|
207
|
-
on(:
|
208
|
-
flash[:alert] = I18n.t("proposals.
|
208
|
+
on(:has_supports) do
|
209
|
+
flash[:alert] = I18n.t("proposals.withdraw.errors.has_supports", scope: "decidim")
|
209
210
|
redirect_to Decidim::ResourceLocatorPresenter.new(@proposal).path
|
210
211
|
end
|
211
212
|
end
|
@@ -241,7 +242,7 @@ module Decidim
|
|
241
242
|
end
|
242
243
|
|
243
244
|
def set_proposal
|
244
|
-
@proposal = Proposal.published.not_hidden.where(component: current_component).
|
245
|
+
@proposal = Proposal.published.not_hidden.where(component: current_component).find_by(id: params[:id])
|
245
246
|
end
|
246
247
|
|
247
248
|
def form_proposal_params
|
@@ -8,11 +8,14 @@ module Decidim
|
|
8
8
|
class ImportParticipatoryTextForm < Decidim::Form
|
9
9
|
include TranslatableAttributes
|
10
10
|
|
11
|
+
ACCEPTED_MIME_TYPES = Decidim::Proposals::DocToMarkdown::ACCEPTED_MIME_TYPES
|
12
|
+
|
11
13
|
translatable_attribute :title, String
|
12
14
|
translatable_attribute :description, String
|
13
15
|
attribute :document
|
14
16
|
|
15
17
|
validates :title, translatable_presence: true
|
18
|
+
validate :accepted_mime_type
|
16
19
|
|
17
20
|
def default_locale
|
18
21
|
current_participatory_space.organization.default_locale
|
@@ -25,6 +28,17 @@ module Decidim
|
|
25
28
|
def document_type
|
26
29
|
document.content_type
|
27
30
|
end
|
31
|
+
|
32
|
+
def accepted_mime_type
|
33
|
+
accepted_mime_types = ACCEPTED_MIME_TYPES.values + [Decidim::Proposals::DocToMarkdown::TEXT_PLAIN_MIME_TYPE]
|
34
|
+
return if accepted_mime_types.include?(document_type)
|
35
|
+
|
36
|
+
errors.add(:document,
|
37
|
+
I18n.t("activemodel.errors.models.participatory_text.attributes.document.invalid_document_type",
|
38
|
+
valid_mime_types: ACCEPTED_MIME_TYPES.keys.map do |m|
|
39
|
+
I18n.t("decidim.proposals.admin.participatory_texts.new_import.accepted_mime_types.#{m}")
|
40
|
+
end.join(", ")))
|
41
|
+
end
|
28
42
|
end
|
29
43
|
end
|
30
44
|
end
|
@@ -6,7 +6,7 @@ module Decidim
|
|
6
6
|
# A form object to be used when admin users want to review a collection of proposals
|
7
7
|
# from a participatory text.
|
8
8
|
class PreviewParticipatoryTextForm < Decidim::Form
|
9
|
-
attribute :proposals, Array[ProposalForm]
|
9
|
+
attribute :proposals, Array[Decidim::Proposals::Admin::ProposalForm]
|
10
10
|
|
11
11
|
def from_models(proposals)
|
12
12
|
self.proposals = proposals.collect do |proposal|
|
@@ -10,6 +10,7 @@ module Decidim
|
|
10
10
|
|
11
11
|
attribute :origin_component_id, Integer
|
12
12
|
attribute :import_proposals, Boolean
|
13
|
+
attribute :keep_authors, Boolean
|
13
14
|
attribute :states, Array
|
14
15
|
|
15
16
|
validates :origin_component_id, :origin_component, :states, :current_component, presence: true
|
@@ -21,6 +21,20 @@ module Decidim
|
|
21
21
|
translated_attribute(participatory_text.title)
|
22
22
|
end
|
23
23
|
end
|
24
|
+
|
25
|
+
# Public: A formatted collection of mime_type to be used
|
26
|
+
# in forms.
|
27
|
+
def mime_types_with_document_examples
|
28
|
+
links = ""
|
29
|
+
accepted_mime_types = Decidim::Proposals::DocToMarkdown::ACCEPTED_MIME_TYPES.keys
|
30
|
+
accepted_mime_types.each_with_index do |mime_type, index|
|
31
|
+
links += link_to t(".accepted_mime_types.#{mime_type}"),
|
32
|
+
asset_path("decidim/proposals/participatory_texts/participatory_text.#{mime_type}"),
|
33
|
+
download: "participatory_text.#{mime_type}"
|
34
|
+
links += ", " unless accepted_mime_types.length == index + 1
|
35
|
+
end
|
36
|
+
links
|
37
|
+
end
|
24
38
|
end
|
25
39
|
end
|
26
40
|
end
|
@@ -132,6 +132,19 @@ module Decidim
|
|
132
132
|
end
|
133
133
|
end
|
134
134
|
|
135
|
+
# Renders the back link except for step_2: compare
|
136
|
+
def proposal_wizard_aside_link_to_back(step)
|
137
|
+
url = case step
|
138
|
+
when :step_1
|
139
|
+
proposals_path
|
140
|
+
when :step_3
|
141
|
+
compare_proposal_path
|
142
|
+
when :step_4
|
143
|
+
edit_draft_proposal_path
|
144
|
+
end
|
145
|
+
url
|
146
|
+
end
|
147
|
+
|
135
148
|
def wizard_aside_back_text
|
136
149
|
case type_of
|
137
150
|
when :collaborative_drafts
|
@@ -122,6 +122,8 @@ module Decidim
|
|
122
122
|
can_publish_collaborative_draft?
|
123
123
|
when :request_access
|
124
124
|
can_request_access_collaborative_draft?
|
125
|
+
when :react_to_request_access
|
126
|
+
can_react_to_request_access_collaborative_draft?
|
125
127
|
end
|
126
128
|
end
|
127
129
|
|
@@ -129,23 +131,35 @@ module Decidim
|
|
129
131
|
@collaborative_draft ||= context.fetch(:collaborative_draft, nil)
|
130
132
|
end
|
131
133
|
|
134
|
+
def collaborative_drafts_enabled?
|
135
|
+
component_settings.collaborative_drafts_enabled
|
136
|
+
end
|
137
|
+
|
132
138
|
def can_create_collaborative_draft?
|
133
|
-
toggle_allow(
|
139
|
+
return toggle_allow(false) unless collaborative_drafts_enabled?
|
140
|
+
toggle_allow(current_settings&.creation_enabled? && authorized?(:create))
|
134
141
|
end
|
135
142
|
|
136
143
|
def can_edit_collaborative_draft?
|
137
|
-
toggle_allow(
|
144
|
+
return toggle_allow(false) unless collaborative_drafts_enabled? && collaborative_draft.open?
|
145
|
+
toggle_allow(collaborative_draft.editable_by?(user))
|
138
146
|
end
|
139
147
|
|
140
148
|
def can_publish_collaborative_draft?
|
141
|
-
toggle_allow(
|
149
|
+
return toggle_allow(false) unless collaborative_drafts_enabled? && collaborative_draft.open?
|
150
|
+
toggle_allow(collaborative_draft.created_by?(user))
|
142
151
|
end
|
143
152
|
|
144
153
|
def can_request_access_collaborative_draft?
|
145
|
-
return toggle_allow(false) unless
|
146
|
-
return toggle_allow(false) if collaborative_draft.
|
154
|
+
return toggle_allow(false) unless collaborative_drafts_enabled? && collaborative_draft.open?
|
155
|
+
return toggle_allow(false) if collaborative_draft.requesters.include?(user)
|
156
|
+
toggle_allow(!collaborative_draft.editable_by?(user))
|
157
|
+
end
|
158
|
+
|
159
|
+
def can_react_to_request_access_collaborative_draft?
|
160
|
+
return toggle_allow(false) unless collaborative_drafts_enabled? && collaborative_draft.open?
|
147
161
|
return toggle_allow(false) if collaborative_draft.requesters.include? user
|
148
|
-
toggle_allow(collaborative_draft
|
162
|
+
toggle_allow(collaborative_draft.created_by?(user))
|
149
163
|
end
|
150
164
|
end
|
151
165
|
end
|
@@ -19,10 +19,14 @@ module Decidim
|
|
19
19
|
components = Decidim::Component.where(participatory_space: spaces).published
|
20
20
|
@query = Decidim::Proposals::Proposal.where(component: components).joins(:component)
|
21
21
|
.left_outer_joins(:category)
|
22
|
-
@query = @query.where("decidim_proposals_proposals.
|
22
|
+
@query = @query.where("decidim_proposals_proposals.created_at <= ?", end_time).accepted
|
23
23
|
@query = @query.group("decidim_categorizations.id", :participatory_space_type, :participatory_space_id)
|
24
24
|
@query
|
25
25
|
end
|
26
|
+
|
27
|
+
def quantity
|
28
|
+
@quantity ||= query.where("decidim_proposals_proposals.created_at >= ?", start_time).count
|
29
|
+
end
|
26
30
|
end
|
27
31
|
end
|
28
32
|
end
|
@@ -32,12 +32,12 @@ module Decidim
|
|
32
32
|
return @query if @query
|
33
33
|
|
34
34
|
spaces = Decidim.participatory_space_manifests.flat_map do |manifest|
|
35
|
-
manifest.participatory_spaces.call(@organization)
|
35
|
+
manifest.participatory_spaces.call(@organization)
|
36
36
|
end
|
37
37
|
components = Decidim::Component.where(participatory_space: spaces).published
|
38
38
|
@query = Decidim::Proposals::Proposal.where(component: components).joins(:component)
|
39
39
|
.left_outer_joins(:category)
|
40
|
-
@query = @query.where("decidim_proposals_proposals.published_at <= ?", end_time).except_withdrawn
|
40
|
+
@query = @query.where("decidim_proposals_proposals.published_at <= ?", end_time).except_withdrawn.not_hidden
|
41
41
|
@query = @query.group("decidim_categorizations.decidim_category_id",
|
42
42
|
:participatory_space_type,
|
43
43
|
:participatory_space_id)
|