decidim-plans 0.16.9 → 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/commands/decidim/plans/admin/create_plan.rb +11 -1
- data/app/commands/decidim/plans/admin/export_plans_to_budgets.rb +2 -1
- data/app/commands/decidim/plans/admin/update_plan.rb +11 -1
- data/app/commands/decidim/plans/create_plan.rb +11 -1
- data/app/commands/decidim/plans/publish_plan.rb +6 -3
- data/app/commands/decidim/plans/update_plan.rb +11 -1
- data/app/models/decidim/plans/plan.rb +0 -3
- data/app/views/decidim/plans/plans/_attached_proposals.html.erb +9 -3
- data/app/views/decidim/plans/plans/_linked_plans.html.erb +32 -0
- data/app/views/decidim/plans/plans/_plan_preview.html.erb +11 -1
- data/app/views/decidim/plans/plans/preview.html.erb +7 -4
- data/config/locales/en.yml +9 -2
- data/config/locales/fi.yml +9 -2
- data/config/locales/sv.yml +9 -2
- data/db/migrate/20190603211538_change_plans_related_proposals_to_resource_links.rb +48 -0
- data/lib/decidim/plans/component.rb +11 -1
- data/lib/decidim/plans/plan_serializer.rb +13 -2
- data/lib/decidim/plans/test/factories.rb +1 -6
- data/lib/decidim/plans/version.rb +2 -2
- metadata +18 -17
- data/app/models/decidim/plans/attached_proposal.rb +0 -12
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8b2569afb59eca810021b9ec0d459657801ad410b7708d646fc183b46504912d
|
4
|
+
data.tar.gz: fb3873511cb120e71dad365a44de68dec24f08316fa3108c9ca98f6e49200bd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '060963502893a71d947c387f730dd8e5d3ce9ac007e55a47d1d64c4597e6dca81cd4ff8625aa5cb10c9c559fc9166fe350cc4aad9adcfa96f88ad17757eda186'
|
7
|
+
data.tar.gz: 911905eed906b4b99b844716389a3a8e8011637d4330181d9d739e759d8dae2f464f2b0d5353203e4ce22cb04926e6eb8526f6ab9727367c6cb2e0498ede3b6e
|
@@ -34,6 +34,7 @@ module Decidim
|
|
34
34
|
transaction do
|
35
35
|
create_plan
|
36
36
|
create_plan_contents
|
37
|
+
link_proposals
|
37
38
|
update_attachments if process_attachments?
|
38
39
|
send_notification
|
39
40
|
end
|
@@ -57,7 +58,6 @@ module Decidim
|
|
57
58
|
)
|
58
59
|
plan.coauthorships.build(author: form.author)
|
59
60
|
plan.save!
|
60
|
-
plan.proposals << form.proposals
|
61
61
|
plan
|
62
62
|
end
|
63
63
|
|
@@ -74,6 +74,10 @@ module Decidim
|
|
74
74
|
end
|
75
75
|
end
|
76
76
|
|
77
|
+
def link_proposals
|
78
|
+
plan.link_resources(proposals, "included_proposals")
|
79
|
+
end
|
80
|
+
|
77
81
|
def attributes
|
78
82
|
{
|
79
83
|
title: form.title,
|
@@ -85,6 +89,12 @@ module Decidim
|
|
85
89
|
}
|
86
90
|
end
|
87
91
|
|
92
|
+
def proposals
|
93
|
+
@proposals ||= plan.sibling_scope(:proposals).where(
|
94
|
+
id: @form.proposal_ids
|
95
|
+
)
|
96
|
+
end
|
97
|
+
|
88
98
|
def send_notification
|
89
99
|
Decidim::EventsManager.publish(
|
90
100
|
event: "decidim.events.plans.plan_published",
|
@@ -51,7 +51,8 @@ module Decidim
|
|
51
51
|
project.save!
|
52
52
|
|
53
53
|
# Link included proposals to the project
|
54
|
-
|
54
|
+
proposals = original_plan.linked_resources(:proposals, "included_proposals")
|
55
|
+
project.link_resources(proposals, "included_proposals")
|
55
56
|
|
56
57
|
# Link the plan to the project
|
57
58
|
project.link_resources([original_plan], "included_plans")
|
@@ -41,6 +41,7 @@ module Decidim
|
|
41
41
|
transaction do
|
42
42
|
update_plan
|
43
43
|
update_plan_contents
|
44
|
+
link_proposals
|
44
45
|
update_attachments if process_attachments?
|
45
46
|
end
|
46
47
|
end
|
@@ -72,18 +73,27 @@ module Decidim
|
|
72
73
|
end
|
73
74
|
end
|
74
75
|
|
76
|
+
def link_proposals
|
77
|
+
plan.link_resources(proposals, "included_proposals")
|
78
|
+
end
|
79
|
+
|
75
80
|
def attributes
|
76
81
|
{
|
77
82
|
title: form.title,
|
78
83
|
category: form.category,
|
79
84
|
scope: form.scope,
|
80
|
-
proposals: form.proposals,
|
81
85
|
# The update token ensures a new version is always created even if
|
82
86
|
# the other attributes have not changed. This is needed to force a
|
83
87
|
# new version to show the changes to associated models.
|
84
88
|
update_token: Time.now.to_f
|
85
89
|
}
|
86
90
|
end
|
91
|
+
|
92
|
+
def proposals
|
93
|
+
@proposals ||= plan.sibling_scope(:proposals).where(
|
94
|
+
id: form.proposal_ids
|
95
|
+
)
|
96
|
+
end
|
87
97
|
end
|
88
98
|
end
|
89
99
|
end
|
@@ -35,6 +35,7 @@ module Decidim
|
|
35
35
|
transaction do
|
36
36
|
create_plan
|
37
37
|
create_plan_contents
|
38
|
+
link_proposals
|
38
39
|
update_attachments if process_attachments?
|
39
40
|
end
|
40
41
|
end
|
@@ -61,7 +62,6 @@ module Decidim
|
|
61
62
|
)
|
62
63
|
plan.coauthorships.build(author: @current_user, user_group: @form.user_group)
|
63
64
|
plan.save!
|
64
|
-
plan.proposals << form.proposals
|
65
65
|
plan
|
66
66
|
end
|
67
67
|
|
@@ -78,6 +78,10 @@ module Decidim
|
|
78
78
|
end
|
79
79
|
end
|
80
80
|
|
81
|
+
def link_proposals
|
82
|
+
plan.link_resources(proposals, "included_proposals")
|
83
|
+
end
|
84
|
+
|
81
85
|
def user_group
|
82
86
|
@user_group ||= Decidim::UserGroup.find_by(organization: organization, id: form.user_group_id)
|
83
87
|
end
|
@@ -85,6 +89,12 @@ module Decidim
|
|
85
89
|
def organization
|
86
90
|
@organization ||= @current_user.organization
|
87
91
|
end
|
92
|
+
|
93
|
+
def proposals
|
94
|
+
@proposals ||= plan.sibling_scope(:proposals).where(
|
95
|
+
id: @form.proposal_ids
|
96
|
+
)
|
97
|
+
end
|
88
98
|
end
|
89
99
|
end
|
90
100
|
end
|
@@ -34,6 +34,8 @@ module Decidim
|
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
+
attr_reader :plan
|
38
|
+
|
37
39
|
def publish_plan
|
38
40
|
Decidim.traceability.perform_action!(
|
39
41
|
"publish",
|
@@ -85,9 +87,10 @@ module Decidim
|
|
85
87
|
end
|
86
88
|
|
87
89
|
def proposal_authors
|
88
|
-
@proposal_authors ||=
|
89
|
-
|
90
|
-
|
90
|
+
@proposal_authors ||= begin
|
91
|
+
proposals = plan.linked_resources(:proposals, "included_proposals")
|
92
|
+
proposals.flat_map(&:authors).select { |a| a.is_a?(Decidim::User) }
|
93
|
+
end
|
91
94
|
end
|
92
95
|
end
|
93
96
|
end
|
@@ -42,6 +42,7 @@ module Decidim
|
|
42
42
|
transaction do
|
43
43
|
update_plan
|
44
44
|
update_plan_contents
|
45
|
+
link_proposals
|
45
46
|
update_attachments if process_attachments?
|
46
47
|
end
|
47
48
|
end
|
@@ -73,18 +74,27 @@ module Decidim
|
|
73
74
|
end
|
74
75
|
end
|
75
76
|
|
77
|
+
def link_proposals
|
78
|
+
plan.link_resources(proposals, "included_proposals")
|
79
|
+
end
|
80
|
+
|
76
81
|
def attributes
|
77
82
|
{
|
78
83
|
title: @form.title,
|
79
84
|
category: @form.category,
|
80
85
|
scope: @form.scope,
|
81
|
-
proposals: @form.proposals,
|
82
86
|
# The update token ensures a new version is always created even if
|
83
87
|
# the other attributes have not changed. This is needed to force a new
|
84
88
|
# version to show the changes to associated models.
|
85
89
|
update_token: Time.now.to_f
|
86
90
|
}
|
87
91
|
end
|
92
|
+
|
93
|
+
def proposals
|
94
|
+
@proposals ||= plan.sibling_scope(:proposals).where(
|
95
|
+
id: @form.proposal_ids
|
96
|
+
)
|
97
|
+
end
|
88
98
|
end
|
89
99
|
end
|
90
100
|
end
|
@@ -32,9 +32,6 @@ module Decidim
|
|
32
32
|
class_name: "Decidim::User",
|
33
33
|
foreign_key: :decidim_user_id
|
34
34
|
|
35
|
-
has_many :attached_proposals, foreign_key: :decidim_plan_id, dependent: :destroy
|
36
|
-
has_many :proposals, through: :attached_proposals
|
37
|
-
|
38
35
|
has_many :contents, foreign_key: :decidim_plan_id, dependent: :destroy
|
39
36
|
|
40
37
|
has_many :taggings,
|
@@ -1,8 +1,14 @@
|
|
1
|
-
<%
|
1
|
+
<%
|
2
|
+
proposals = @plan.linked_resources(:proposals, "included_proposals")
|
3
|
+
%>
|
4
|
+
|
5
|
+
<% if proposals.count.nonzero? %>
|
2
6
|
<div class="attached-proposals">
|
3
|
-
<h4 class="section-heading"
|
7
|
+
<h4 class="section-heading">
|
8
|
+
<%= t("decidim.resource_links.included_proposals.plan_proposal") %>
|
9
|
+
</h4>
|
4
10
|
<div class="collapsible-list row small-up-1 medium-up-2 card-grid">
|
5
|
-
<%
|
11
|
+
<% proposals.each do |proposal| %>
|
6
12
|
<%= card_for proposal, from: proposal %>
|
7
13
|
<% end %>
|
8
14
|
</div>
|
@@ -0,0 +1,32 @@
|
|
1
|
+
<div class="card card--action card--list">
|
2
|
+
<% resources.each do |plan| %>
|
3
|
+
<div class="card--list__item">
|
4
|
+
<div class="card--list__text">
|
5
|
+
<%= link_to resource_locator(plan).path do %>
|
6
|
+
<%= icon "proposals", class: "card--list__icon", remove_icon_class: true %>
|
7
|
+
<% end %>
|
8
|
+
<div>
|
9
|
+
<%= link_to resource_locator(plan).path, class: "card__link" do %>
|
10
|
+
<h5 class="card--list__heading"><%== decidim_html_escape(present(plan).title) %></h5>
|
11
|
+
<% end %>
|
12
|
+
<% present(plan) do |plan| %>
|
13
|
+
<div class="author">
|
14
|
+
<span class="author__avatar">
|
15
|
+
<%= image_tag plan.author.avatar_url %>
|
16
|
+
</span>
|
17
|
+
<span class="author__name">
|
18
|
+
<strong><%= plan.author.name %></strong>
|
19
|
+
<%= plan.author.nickname %>
|
20
|
+
</span>
|
21
|
+
</div>
|
22
|
+
<% end %>
|
23
|
+
</div>
|
24
|
+
</div>
|
25
|
+
<div class="card--list__data">
|
26
|
+
<span class="card--list__data__number">
|
27
|
+
<%= plan.authors.count %>
|
28
|
+
</span> <%= t(".plan_authors", count: plan.authors.count) %>
|
29
|
+
</div>
|
30
|
+
</div>
|
31
|
+
<% end %>
|
32
|
+
</div>
|
@@ -1 +1,11 @@
|
|
1
|
-
|
1
|
+
<div class="row column view-header">
|
2
|
+
<h2 class="heading2"><%= present(plan).title %></h2>
|
3
|
+
<%= cell("decidim/plans/coauthorships", plan, has_actions: false, size: 3, context: { current_user: current_user }) %>
|
4
|
+
</div>
|
5
|
+
<div class="row column">
|
6
|
+
<%= render partial: "contents" %>
|
7
|
+
<%= cell "decidim/plans/tags", plan, context: { extra_classes: ["tags--plan"] } %>
|
8
|
+
</div>
|
9
|
+
<br />
|
10
|
+
<%= render partial: "attached_proposals" %>
|
11
|
+
<%= attachments_for plan %>
|
@@ -1,12 +1,15 @@
|
|
1
1
|
<div class="row">
|
2
|
-
<div class="columns large-
|
2
|
+
<div class="columns large-8 large-push-2">
|
3
3
|
<div class="card">
|
4
4
|
<div class="p-l">
|
5
5
|
<%= render partial: "plan_preview", locals: { plan: @plan } %>
|
6
|
-
<
|
7
|
-
|
6
|
+
<br>
|
7
|
+
<div class="actions">
|
8
|
+
<%= button_to t(".publish"), publish_plan_path(@plan), method: :post, class: "button expanded button--nomargin" %>
|
8
9
|
|
9
|
-
|
10
|
+
<div class="text-center">
|
11
|
+
<%= link_to t(".modify"), edit_plan_path(@plan) %>
|
12
|
+
</div>
|
10
13
|
</div>
|
11
14
|
</div>
|
12
15
|
</div>
|
data/config/locales/en.yml
CHANGED
@@ -51,6 +51,9 @@ en:
|
|
51
51
|
comments_blocked: Comments blocked
|
52
52
|
creation_enabled: Creation enabled
|
53
53
|
plan_answering_enabled: Answering enabled
|
54
|
+
filters:
|
55
|
+
linked_classes:
|
56
|
+
plan: Plans
|
54
57
|
pages:
|
55
58
|
home:
|
56
59
|
statistics:
|
@@ -224,8 +227,6 @@ en:
|
|
224
227
|
name: Name
|
225
228
|
taggings_count: Number of uses
|
226
229
|
plans:
|
227
|
-
attached_proposals:
|
228
|
-
attached_proposals: Attached proposals
|
229
230
|
count:
|
230
231
|
plans_count:
|
231
232
|
one: "%{count} plan"
|
@@ -279,6 +280,8 @@ en:
|
|
279
280
|
index:
|
280
281
|
new_plan: New plan
|
281
282
|
see_all_withdrawn: See all withdrawn
|
283
|
+
linked_plans:
|
284
|
+
plan_authors: Number of authors
|
282
285
|
new:
|
283
286
|
create: Create
|
284
287
|
title: Create plan
|
@@ -384,6 +387,10 @@ en:
|
|
384
387
|
version_number_out_of_total: "%{current_version} out of %{total_count}"
|
385
388
|
version:
|
386
389
|
version_index: Version %{index}
|
390
|
+
resource_links:
|
391
|
+
included_proposals:
|
392
|
+
plan_proposal: Related proposals
|
393
|
+
proposal_plan: Related plans
|
387
394
|
scopes:
|
388
395
|
global: Global
|
389
396
|
events:
|
data/config/locales/fi.yml
CHANGED
@@ -50,6 +50,9 @@ fi:
|
|
50
50
|
comments_blocked: Kommentointi estetty
|
51
51
|
creation_enabled: Luonti sallittu
|
52
52
|
plan_answering_enabled: Vastaaminen sallittu
|
53
|
+
filters:
|
54
|
+
linked_classes:
|
55
|
+
plan: Suunnitelmat
|
53
56
|
pages:
|
54
57
|
home:
|
55
58
|
statistics:
|
@@ -219,8 +222,6 @@ fi:
|
|
219
222
|
name: Nimi
|
220
223
|
taggings_count: Käyttömäärä
|
221
224
|
plans:
|
222
|
-
attached_proposals:
|
223
|
-
attached_proposals: Liitetyt ehdotukset
|
224
225
|
count:
|
225
226
|
plans_count:
|
226
227
|
one: "%{count} suunnitelma"
|
@@ -272,6 +273,8 @@ fi:
|
|
272
273
|
index:
|
273
274
|
new_plan: Uusi suunnitelma
|
274
275
|
see_all_withdrawn: Näytä kaikki peruutetut
|
276
|
+
linked_plans:
|
277
|
+
plan_authors: Laatijoiden määrä
|
275
278
|
new:
|
276
279
|
create: Luo
|
277
280
|
title: Luo suunnitelma
|
@@ -375,6 +378,10 @@ fi:
|
|
375
378
|
version_number_out_of_total: "%{current_version} / %{total_count}"
|
376
379
|
version:
|
377
380
|
version_index: Versio %{index}
|
381
|
+
resource_links:
|
382
|
+
included_proposals:
|
383
|
+
plan_proposal: Liitetyt ehdotukset
|
384
|
+
proposal_plan: Liitetyt suunnitelmat
|
378
385
|
scopes:
|
379
386
|
global: Yleinen
|
380
387
|
events:
|
data/config/locales/sv.yml
CHANGED
@@ -50,6 +50,9 @@ sv:
|
|
50
50
|
comments_blocked: Kommentarer blockerade
|
51
51
|
creation_enabled: Skapande tillåtet
|
52
52
|
plan_answering_enabled: Svar tillåtna
|
53
|
+
filters:
|
54
|
+
linked_classes:
|
55
|
+
plan: Planer
|
53
56
|
pages:
|
54
57
|
home:
|
55
58
|
statistics:
|
@@ -219,8 +222,6 @@ sv:
|
|
219
222
|
name: Namn
|
220
223
|
taggings_count: Antal användningsområden
|
221
224
|
plans:
|
222
|
-
attached_proposals:
|
223
|
-
attached_proposals: Bifogade förslag
|
224
225
|
count:
|
225
226
|
plans_count:
|
226
227
|
one: "%{count} plan"
|
@@ -272,6 +273,8 @@ sv:
|
|
272
273
|
index:
|
273
274
|
new_plan: Ny plan
|
274
275
|
see_all_withdrawn: Visa alla annullerade
|
276
|
+
linked_plans:
|
277
|
+
plan_authors: Antal författare
|
275
278
|
new:
|
276
279
|
create: Skapa
|
277
280
|
title: Skapa plan
|
@@ -375,6 +378,10 @@ sv:
|
|
375
378
|
version_number_out_of_total: "%{current_version} / %{total_count}"
|
376
379
|
version:
|
377
380
|
version_index: Version %{index}
|
381
|
+
resource_links:
|
382
|
+
included_proposals:
|
383
|
+
plan_proposal: Bifogade förslag
|
384
|
+
proposal_plan: Relaterade planer
|
378
385
|
scopes:
|
379
386
|
global: Allmän
|
380
387
|
events:
|
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
class ChangePlansRelatedProposalsToResourceLinks < ActiveRecord::Migration[5.2]
|
4
|
+
def up
|
5
|
+
Decidim::Plans::Plan.all.each do |plan|
|
6
|
+
proposal_ids = ActiveRecord::Base.connection.execute(
|
7
|
+
"SELECT decidim_proposal_id FROM decidim_plans_attached_proposals " \
|
8
|
+
"WHERE decidim_plan_id = #{plan.id}"
|
9
|
+
).pluck("decidim_proposal_id")
|
10
|
+
|
11
|
+
say("Linking proposals for plan: #{plan.id}")
|
12
|
+
|
13
|
+
next unless proposal_ids.count.positive?
|
14
|
+
|
15
|
+
say("--Proposal IDs: #{proposal_ids.join(",")}")
|
16
|
+
|
17
|
+
plan.link_resources(
|
18
|
+
Decidim::Proposals::Proposal.where(id: proposal_ids),
|
19
|
+
"included_proposals"
|
20
|
+
)
|
21
|
+
end
|
22
|
+
|
23
|
+
# Drop the unnecessary attached proposals table
|
24
|
+
drop_table :decidim_plans_attached_proposals
|
25
|
+
end
|
26
|
+
|
27
|
+
def down
|
28
|
+
# Re-create the attached proposals table
|
29
|
+
create_table :decidim_plans_attached_proposals do |t|
|
30
|
+
t.references :decidim_plan, index: true
|
31
|
+
t.references :decidim_proposal, index: true
|
32
|
+
|
33
|
+
t.timestamps
|
34
|
+
end
|
35
|
+
|
36
|
+
Decidim::Plans::Plan.all.each do |plan|
|
37
|
+
say("Reverting attached proposals for plan: #{plan.id}")
|
38
|
+
plan.linked_resources(:proposals, "included_proposals").each do |proposal|
|
39
|
+
say("--Proposal ID: #{proposal.id}")
|
40
|
+
ActiveRecord::Base.connection.execute(
|
41
|
+
"INSERT INTO decidim_plans_attached_proposals " \
|
42
|
+
"(decidim_plan_id, decidim_proposal_id, created_at, updated_at)" \
|
43
|
+
"VALUES (#{plan.id}, #{proposal.id}, NOW(), NOW())"
|
44
|
+
)
|
45
|
+
end
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -41,6 +41,7 @@ Decidim.register_component(:plans) do |component|
|
|
41
41
|
|
42
42
|
component.register_resource(:plan) do |resource|
|
43
43
|
resource.model_class_name = "Decidim::Plans::Plan"
|
44
|
+
resource.template = "decidim/plans/plans/linked_plans"
|
44
45
|
resource.card = "decidim/plans/plan"
|
45
46
|
end
|
46
47
|
|
@@ -164,7 +165,16 @@ Decidim.register_component(:plans) do |component|
|
|
164
165
|
plan.add_coauthor(participatory_space.organization)
|
165
166
|
plan.save!
|
166
167
|
|
167
|
-
|
168
|
+
unless proposals.empty?
|
169
|
+
linked_proposals = begin
|
170
|
+
if proposals.length > 2
|
171
|
+
proposals.slice!(0, 2)
|
172
|
+
else
|
173
|
+
proposals
|
174
|
+
end
|
175
|
+
end
|
176
|
+
plan.link_resources(linked_proposals, "included_proposals")
|
177
|
+
end
|
168
178
|
|
169
179
|
plan
|
170
180
|
end
|
@@ -17,6 +17,7 @@ module Decidim
|
|
17
17
|
def serialize
|
18
18
|
values = {
|
19
19
|
id: plan.id,
|
20
|
+
authors: author_details,
|
20
21
|
category: {
|
21
22
|
id: plan.category.try(:id),
|
22
23
|
name: plan.category.try(:name)
|
@@ -60,16 +61,26 @@ module Decidim
|
|
60
61
|
|
61
62
|
attr_reader :plan
|
62
63
|
|
64
|
+
def author_details
|
65
|
+
plan.authors.map do |author|
|
66
|
+
"#{author.class}/#{author.id}"
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
63
70
|
def component
|
64
71
|
plan.component
|
65
72
|
end
|
66
73
|
|
74
|
+
def related_proposals
|
75
|
+
plan.linked_resources(:proposals, "included_proposals")
|
76
|
+
end
|
77
|
+
|
67
78
|
def related_proposal_ids
|
68
|
-
|
79
|
+
related_proposals.map(&:id)
|
69
80
|
end
|
70
81
|
|
71
82
|
def related_proposal_urls
|
72
|
-
|
83
|
+
related_proposals.map do |proposal|
|
73
84
|
Decidim::ResourceLocatorPresenter.new(proposal).url
|
74
85
|
end
|
75
86
|
end
|
@@ -66,11 +66,6 @@ FactoryBot.define do
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
-
factory :attached_proposal, class: "Decidim::Plans::AttachedProposal" do
|
70
|
-
plan
|
71
|
-
proposal
|
72
|
-
end
|
73
|
-
|
74
69
|
factory :plan, class: "Decidim::Plans::Plan" do
|
75
70
|
transient do
|
76
71
|
users { nil }
|
@@ -94,7 +89,7 @@ FactoryBot.define do
|
|
94
89
|
|
95
90
|
proposal_component = create(:proposal_component, participatory_space: plan.component.participatory_space)
|
96
91
|
proposals = evaluator.plan_proposals || [create(:proposal, component: proposal_component)]
|
97
|
-
plan.
|
92
|
+
plan.link_resources(proposals, "included_proposals")
|
98
93
|
end
|
99
94
|
plan.update!(tags: evaluator.tags) if evaluator.tags && evaluator.tags.count.positive?
|
100
95
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: decidim-plans
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.17.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Antti Hukkanen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-
|
11
|
+
date: 2019-06-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: decidim-core
|
@@ -16,98 +16,98 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.17.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.17.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: decidim-proposals
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 0.
|
33
|
+
version: 0.17.0
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 0.
|
40
|
+
version: 0.17.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: decidim-admin
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 0.
|
47
|
+
version: 0.17.0
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 0.
|
54
|
+
version: 0.17.0
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: decidim-assemblies
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 0.
|
61
|
+
version: 0.17.0
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 0.
|
68
|
+
version: 0.17.0
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: decidim-budgets
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: 0.
|
75
|
+
version: 0.17.0
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: 0.
|
82
|
+
version: 0.17.0
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: decidim-dev
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
86
86
|
requirements:
|
87
87
|
- - "~>"
|
88
88
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.
|
89
|
+
version: 0.17.0
|
90
90
|
type: :development
|
91
91
|
prerelease: false
|
92
92
|
version_requirements: !ruby/object:Gem::Requirement
|
93
93
|
requirements:
|
94
94
|
- - "~>"
|
95
95
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.
|
96
|
+
version: 0.17.0
|
97
97
|
- !ruby/object:Gem::Dependency
|
98
98
|
name: decidim-participatory_processes
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: 0.
|
103
|
+
version: 0.17.0
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: 0.
|
110
|
+
version: 0.17.0
|
111
111
|
description: Plans component allows people to author plans based on the proposals
|
112
112
|
that can be converted into budgeting projects.
|
113
113
|
email:
|
@@ -220,7 +220,6 @@ files:
|
|
220
220
|
- app/helpers/decidim/plans/user_group_helper.rb
|
221
221
|
- app/models/concerns/decidim/plans/traceable.rb
|
222
222
|
- app/models/decidim/plans/application_record.rb
|
223
|
-
- app/models/decidim/plans/attached_proposal.rb
|
224
223
|
- app/models/decidim/plans/content.rb
|
225
224
|
- app/models/decidim/plans/paper_trail/version.rb
|
226
225
|
- app/models/decidim/plans/paper_trail/version_association.rb
|
@@ -281,6 +280,7 @@ files:
|
|
281
280
|
- app/views/decidim/plans/plans/_filters.html.erb
|
282
281
|
- app/views/decidim/plans/plans/_filters_small_view.html.erb
|
283
282
|
- app/views/decidim/plans/plans/_form.html.erb
|
283
|
+
- app/views/decidim/plans/plans/_linked_plans.html.erb
|
284
284
|
- app/views/decidim/plans/plans/_new_plan_button.html.erb
|
285
285
|
- app/views/decidim/plans/plans/_plan.html.erb
|
286
286
|
- app/views/decidim/plans/plans/_plan_preview.html.erb
|
@@ -320,6 +320,7 @@ files:
|
|
320
320
|
- db/migrate/20190214124014_add_closed_at_to_decidim_plans.rb
|
321
321
|
- db/migrate/20190329161710_fix_plan_closing_workflow_states.rb
|
322
322
|
- db/migrate/20190331141058_create_decidim_plans_tags_and_plan_taggings.rb
|
323
|
+
- db/migrate/20190603211538_change_plans_related_proposals_to_resource_links.rb
|
323
324
|
- lib/decidim/content_parsers/plan_parser.rb
|
324
325
|
- lib/decidim/content_renderers/plan_renderer.rb
|
325
326
|
- lib/decidim/plans.rb
|
@@ -1,12 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module Decidim
|
4
|
-
module Plans
|
5
|
-
# This class holds the association between a Plan and a
|
6
|
-
# Decidim::Proposals::Proposal.
|
7
|
-
class AttachedProposal < ApplicationRecord
|
8
|
-
belongs_to :plan, class_name: "Decidim::Plans::Plan", foreign_key: "decidim_plan_id"
|
9
|
-
belongs_to :proposal, class_name: "Decidim::Proposals::Proposal", foreign_key: "decidim_proposal_id"
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|