decidim-budgets 0.19.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (96) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/decidim/budgets/icon.svg +1 -11
  3. data/app/assets/javascripts/decidim/budgets/projects.js.es6 +26 -4
  4. data/app/assets/stylesheets/decidim/budgets/budget/_budget-list.scss +147 -24
  5. data/app/cells/decidim/budgets/project_list_item/project_data.erb +5 -0
  6. data/app/cells/decidim/budgets/project_list_item/project_data_number.erb +3 -0
  7. data/app/cells/decidim/budgets/project_list_item/project_data_vote_button.erb +15 -0
  8. data/app/cells/decidim/budgets/project_list_item/project_data_votes.erb +7 -0
  9. data/app/cells/decidim/budgets/project_list_item/project_image.erb +5 -0
  10. data/app/cells/decidim/budgets/project_list_item/project_text.erb +17 -0
  11. data/app/cells/decidim/budgets/project_list_item/show.erb +5 -0
  12. data/app/cells/decidim/budgets/project_list_item_cell.rb +86 -0
  13. data/app/cells/decidim/budgets/project_m/data.erb +2 -2
  14. data/app/cells/decidim/budgets/project_m/footer.erb +1 -1
  15. data/app/commands/decidim/budgets/admin/create_project.rb +19 -9
  16. data/app/commands/decidim/budgets/admin/update_project.rb +12 -1
  17. data/app/commands/decidim/budgets/checkout.rb +2 -1
  18. data/app/controllers/concerns/decidim/budgets/needs_current_order.rb +5 -1
  19. data/app/controllers/concerns/decidim/budgets/orderable.rb +61 -0
  20. data/app/controllers/decidim/budgets/admin/projects_controller.rb +8 -5
  21. data/app/controllers/decidim/budgets/line_items_controller.rb +1 -1
  22. data/app/controllers/decidim/budgets/projects_controller.rb +23 -3
  23. data/app/forms/decidim/budgets/admin/component_form.rb +44 -0
  24. data/app/forms/decidim/budgets/admin/project_form.rb +14 -2
  25. data/app/helpers/decidim/budgets/application_helper.rb +1 -0
  26. data/app/helpers/decidim/budgets/projects_helper.rb +17 -0
  27. data/app/jobs/decidim/budgets/send_order_summary_job.rb +15 -0
  28. data/app/mailers/decidim/budgets/order_summary_mailer.rb +34 -0
  29. data/app/models/decidim/budgets/order.rb +28 -1
  30. data/app/models/decidim/budgets/project.rb +13 -0
  31. data/app/services/decidim/budgets/project_search.rb +8 -0
  32. data/app/types/decidim/budgets/budgets_type.rb +32 -0
  33. data/app/types/decidim/budgets/project_type.rb +25 -0
  34. data/app/views/decidim/budgets/admin/projects/_form.html.erb +3 -6
  35. data/app/views/decidim/budgets/admin/projects/proposals_picker.html.erb +1 -0
  36. data/app/views/decidim/budgets/order_summary_mailer/order_summary.html.erb +21 -0
  37. data/app/views/decidim/budgets/projects/_budget_confirm.html.erb +1 -1
  38. data/app/views/decidim/budgets/projects/_budget_summary.html.erb +8 -2
  39. data/app/views/decidim/budgets/projects/_filters.html.erb +10 -6
  40. data/app/views/decidim/budgets/projects/_linked_projects.html.erb +1 -1
  41. data/app/views/decidim/budgets/projects/_order_progress.html.erb +8 -16
  42. data/app/views/decidim/budgets/projects/_project.html.erb +1 -57
  43. data/app/views/decidim/budgets/projects/_project_budget_button.html.erb +3 -3
  44. data/app/views/decidim/budgets/projects/_projects.html.erb +8 -1
  45. data/app/views/decidim/budgets/projects/index.html.erb +3 -3
  46. data/app/views/decidim/budgets/projects/index.js.erb +8 -0
  47. data/app/views/decidim/budgets/projects/show.html.erb +1 -1
  48. data/config/locales/ar.yml +1 -6
  49. data/config/locales/bg-BG.yml +7 -0
  50. data/config/locales/ca.yml +27 -5
  51. data/config/locales/cs.yml +44 -22
  52. data/config/locales/da-DK.yml +1 -0
  53. data/config/locales/de.yml +27 -5
  54. data/config/locales/el-GR.yml +1 -0
  55. data/config/locales/el.yml +175 -0
  56. data/config/locales/en.yml +27 -5
  57. data/config/locales/es-MX.yml +27 -5
  58. data/config/locales/es-PY.yml +27 -5
  59. data/config/locales/es.yml +27 -5
  60. data/config/locales/et-EE.yml +1 -0
  61. data/config/locales/eu.yml +1 -6
  62. data/config/locales/fi-plain.yml +27 -5
  63. data/config/locales/fi.yml +40 -18
  64. data/config/locales/fr-CA.yml +175 -0
  65. data/config/locales/fr.yml +27 -5
  66. data/config/locales/ga-IE.yml +1 -0
  67. data/config/locales/gl.yml +1 -6
  68. data/config/locales/hr-HR.yml +1 -0
  69. data/config/locales/hu.yml +17 -6
  70. data/config/locales/id-ID.yml +1 -6
  71. data/config/locales/is-IS.yml +114 -0
  72. data/config/locales/it.yml +28 -6
  73. data/config/locales/ja-JP.yml +171 -0
  74. data/config/locales/lt-LT.yml +1 -0
  75. data/config/locales/lv-LV.yml +172 -0
  76. data/config/locales/mt-MT.yml +1 -0
  77. data/config/locales/nl.yml +32 -10
  78. data/config/locales/no.yml +160 -0
  79. data/config/locales/pl.yml +74 -52
  80. data/config/locales/pt-BR.yml +2 -7
  81. data/config/locales/pt.yml +64 -42
  82. data/config/locales/ro-RO.yml +179 -0
  83. data/config/locales/ru.yml +1 -6
  84. data/config/locales/sk-SK.yml +180 -0
  85. data/config/locales/sk.yml +175 -0
  86. data/config/locales/sl.yml +5 -0
  87. data/config/locales/sr-CS.yml +29 -0
  88. data/config/locales/sv.yml +27 -5
  89. data/config/locales/tr-TR.yml +1 -6
  90. data/config/locales/uk.yml +1 -6
  91. data/lib/decidim/budgets/admin_engine.rb +2 -0
  92. data/lib/decidim/budgets/component.rb +12 -0
  93. data/lib/decidim/budgets/seeds/city.jpeg +0 -0
  94. data/lib/decidim/budgets/test/factories.rb +33 -0
  95. data/lib/decidim/budgets/version.rb +1 -1
  96. metadata +55 -15
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f6d8d13e020844efb51e9fbf69025c2f50e8e4ce55e6126ec10a38dc4ea25cc6
4
- data.tar.gz: fb963e40341a1881b465fba889de2d33fc292854433e0712ee4753ba5f11e969
3
+ metadata.gz: a52564133c108bcd32c5b1f4729eb4e8430708fbc59dab774f90f07c517f5a01
4
+ data.tar.gz: e3cc8184fdba7e909b34b89e1ad94955a99134521aed3e4222096b8d10f8f934
5
5
  SHA512:
6
- metadata.gz: ba9214e3e9470af3e1844b8f5df22a1de1a3c23641d2c3eef49ccafaf3f8f3f3ce91197892634afce3555e02cfbd1fb0695ec2f853adc5c9adb2f26f084f1c34
7
- data.tar.gz: dd8b4e38291f91988dd706640717851b89a1ccd2c43bb57eab93abbae327fd5af6c0ceb277de0227f5e3e56e9f84c179cd7226c11743fbd2177035e036f97950
6
+ metadata.gz: f3711ec5978d688a91da72965fa96141cd3ae37a15a709e9529bd7d7a15416313339ebbdfbbf3524fa1a4ee4f734b4a8ac82460ea5bc96732bd92ffea3cfe63c
7
+ data.tar.gz: ee3b9d5b2ca5ab49f195c3ebc76dc7579ce85d2dfed11e591a5ad1ca56fe4e16e9fa77dd19479e1c0af016aed5b5dbcbf4a8789b6be64bc9ddef975573c10e73
@@ -1,11 +1 @@
1
- <svg xmlns="http://www.w3.org/2000/svg" x="0px" y="0px" viewBox="0 0 36 36" style="enable-background:new 0 0 36 36;" xml:space="preserve">
2
- <g>
3
- <path d="M18,36C8.1,36,0,27.9,0,18S8.1,0,18,0s18,8.1,18,18S27.9,36,18,36z M18,2C9.2,2,2,9.2,2,18s7.2,16,16,16s16-7.2,16-16 S26.8,2,18,2z"/>
4
- </g>
5
- <g>
6
- <g>
7
- <path d="M17.1,28.3c-5.3,0-9.9-4.4-9.9-9.8c0-5.5,4.9-9.5,9.3-9.5H18v9h9v0.9C27,23.2,22.7,28.3,17.1,28.3z M16,10.7 c-4,0.6-6.5,3.7-6.5,7.6c0,4.3,3.6,8,7.7,8c3.9,0,7-3.3,7.6-6.3H16V10.7z"/>
8
- </g>
9
- <path d="M30,16H20V6h0.6c4.5,0,9.4,4.4,9.4,8.9V16z M22,14h5.5C27,11,24,8.6,22,8V14z"/>
10
- </g>
11
- </svg>
1
+ <svg xmlns="http://www.w3.org/2000/svg" x="0" y="0" enable-background="new 0 0 36 36" viewBox="0 0 36 36" xml:space="preserve"><g><path d="M18,36C8.1,36,0,27.9,0,18S8.1,0,18,0s18,8.1,18,18S27.9,36,18,36z M18,2C9.2,2,2,9.2,2,18s7.2,16,16,16s16-7.2,16-16 S26.8,2,18,2z"/></g><g><g><path d="M17.1,28.3c-5.3,0-9.9-4.4-9.9-9.8c0-5.5,4.9-9.5,9.3-9.5H18v9h9v0.9C27,23.2,22.7,28.3,17.1,28.3z M16,10.7 c-4,0.6-6.5,3.7-6.5,7.6c0,4.3,3.6,8,7.7,8c3.9,0,7-3.3,7.6-6.3H16V10.7z"/></g><path d="M30,16H20V6h0.6c4.5,0,9.4,4.4,9.4,8.9V16z M22,14h5.5C27,11,24,8.6,22,8V14z"/></g></svg>
@@ -5,7 +5,7 @@ $(() => {
5
5
  const $projects = $("#projects, #project");
6
6
  const $budgetSummaryTotal = $(".budget-summary__total");
7
7
  const $budgetExceedModal = $("#budget-excess");
8
-
8
+ const $budgetSummary = $(".budget-summary__progressbox");
9
9
  const totalBudget = parseInt($budgetSummaryTotal.attr("data-total-budget"), 10);
10
10
 
11
11
  const cancelEvent = (event) => {
@@ -13,17 +13,39 @@ $(() => {
13
13
  event.preventDefault();
14
14
  };
15
15
 
16
- $projects.on("click", ".budget--list__action", (event) => {
17
- const currentBudget = parseInt($(".budget-summary__progressbox").attr("data-current-budget"), 10);
16
+ $projects.on("click", ".budget-list__action", (event) => {
17
+ const currentBudget = parseInt($budgetSummary.attr("data-current-budget"), 10);
18
18
  const $currentTarget = $(event.currentTarget);
19
19
  const projectBudget = parseInt($currentTarget.attr("data-budget"), 10);
20
20
 
21
21
  if ($currentTarget.attr("disabled")) {
22
22
  cancelEvent(event);
23
23
 
24
- } else if ($currentTarget.attr("data-add") && ((currentBudget + projectBudget) > totalBudget)) {
24
+ } else if (($currentTarget.attr("data-add") === "true") && ((currentBudget + projectBudget) > totalBudget)) {
25
25
  $budgetExceedModal.foundation("toggle");
26
26
  cancelEvent(event);
27
27
  }
28
28
  });
29
+
30
+ if ($("#order-progress [data-toggle=budget-confirm]").length > 0) {
31
+ const safeUrl = $(".budget-summary").attr("data-safe-url").split("?")[0];
32
+ $(document).on("click", "a", (event) => {
33
+ window.exitUrl = event.currentTarget.href;
34
+ });
35
+ $(document).on("submit", "form", (event) => {
36
+ window.exitUrl = event.currentTarget.action;
37
+ });
38
+
39
+ window.onbeforeunload = () => {
40
+ const currentBudget = parseInt($budgetSummary.attr("data-current-budget"), 10);
41
+ const exitUrl = window.exitUrl;
42
+ window.exitUrl = null;
43
+
44
+ if (currentBudget === 0 || (exitUrl && exitUrl.startsWith(safeUrl))) {
45
+ return null;
46
+ }
47
+
48
+ return "";
49
+ }
50
+ }
29
51
  });
@@ -1,36 +1,159 @@
1
- .budget-list__title{
2
- @include breakpoint(smallmedium down){
3
- font-size: $global-font-size;
4
- }
5
- }
1
+ .budget-list{
2
+ margin-bottom: 2rem;
6
3
 
7
- .budget-list__data{
8
- flex-basis: 9rem;
4
+ &__item{
5
+ padding: 0;
6
+ background: $card-bg;
7
+ border: $border;
8
+ border-bottom: 0;
9
+ overflow: hidden;
10
+ display: flex;
9
11
 
10
- @include breakpoint(medium){
11
- flex-direction: row;
12
- flex-basis: 16rem;
12
+ &:first-child{
13
+ border-top-left-radius: $card-border-radius;
14
+ border-top-right-radius: $card-border-radius;
15
+ }
16
+
17
+ &:last-child{
18
+ border-bottom-left-radius: $card-border-radius;
19
+ border-bottom-right-radius: $card-border-radius;
20
+ border-bottom: $border;
21
+ }
13
22
  }
14
- }
15
23
 
16
- .budget-list__data--added{
17
- background-color: tint($success, 80%);
18
- }
24
+ &__image{
25
+ overflow: hidden;
26
+ width: 3.5em;
27
+ height: 3.5rem;
28
+ flex-shrink: 0;
29
+ margin-top: $card-padding-small * .7;
30
+ margin-bottom: $card-padding-small * .7;
31
+ margin-left: $card-padding-small / 2;
32
+
33
+ @include breakpoint(medium){
34
+ width: 6rem;
35
+ height: 4rem;
36
+ flex-shrink: 0;
37
+ margin: $card-padding;
38
+ margin-right: 0;
39
+ }
19
40
 
20
- .budget-list__number{
21
- @include breakpoint(medium down){
22
- font-size: 1rem;
41
+ img{
42
+ width: 100%;
43
+ height: 100%;
44
+ object-fit: cover;
45
+ object-position: center;
46
+ }
23
47
  }
24
48
 
25
- @include breakpoint(medium){
49
+ &__text{
50
+ padding: $card-padding-small / 2;
26
51
  flex-grow: 1;
52
+
53
+ @include breakpoint(medium){
54
+ padding: $card-padding;
55
+ display: flex;
56
+ align-items: center;
57
+ }
58
+ }
59
+
60
+ &__data{
61
+ flex-shrink: 0;
62
+ align-self: stretch;
63
+ display: flex;
64
+ flex-direction: column;
65
+ align-items: center;
66
+ justify-content: center;
67
+ text-align: center;
68
+ font-size: 85%;
69
+ line-height: 1;
70
+ color: $muted;
71
+ padding: $card-padding-small / 2;
72
+ background: $card-secondary-bg;
73
+
74
+ @include breakpoint(medium){
75
+ min-width: 7rem;
76
+ flex-direction: row;
77
+ justify-content: flex-end;
78
+ flex-basis: 12rem;
79
+ padding: 1rem $card-padding;
80
+ }
81
+
82
+ &:last-child{
83
+ margin-bottom: 0;
84
+ }
85
+ }
86
+
87
+ &__data__icon{
88
+ .icon{
89
+ width: 20px;
90
+ height: 20px;
91
+ fill: $muted;
92
+ }
93
+
94
+ &:hover{
95
+ .icon{
96
+ fill: $anchor-color;
97
+ }
98
+ }
99
+ }
100
+
101
+ &__data__number{
102
+ @extend .card-data__item__number;
103
+
27
104
  font-size: 1.5rem;
28
- margin-right: 1rem;
29
- margin-bottom: 0;
30
- text-align: right;
31
105
  }
32
- }
33
106
 
34
- .budget--list__action{
35
- margin-bottom: 0;
107
+ &__data__votes{
108
+ @extend .card-data__item__number;
109
+
110
+ @include breakpoint(medium){
111
+ flex-grow: 1;
112
+ font-size: 1.2rem;
113
+ margin-left: 1rem;
114
+ margin-right: 1rem;
115
+ margin-bottom: 0;
116
+ text-align: cemter;
117
+ }
118
+ }
119
+
120
+ &__data--added{
121
+ background-color: tint($success, 80%);
122
+ }
123
+
124
+ &__title{
125
+ font-size: $global-font-size;
126
+ }
127
+
128
+ &__number{
129
+ @include breakpoint(medium down){
130
+ font-size: 1rem;
131
+ }
132
+
133
+ @include breakpoint(medium){
134
+ flex-grow: 1;
135
+ font-size: 1.2rem;
136
+ margin-left: 1rem;
137
+ margin-right: 1rem;
138
+ margin-bottom: 0;
139
+ text-align: right;
140
+ }
141
+ }
142
+
143
+ &__action{
144
+ margin-bottom: 0;
145
+ border-radius: 50%;
146
+ align-self: center;
147
+ flex-shrink: 0;
148
+ width: 2em;
149
+ height: 2em;
150
+ padding: 0;
151
+ display: flex;
152
+ justify-content: center;
153
+ align-items: center;
154
+
155
+ &--disabled{
156
+ pointer-events: none;
157
+ }
158
+ }
36
159
  }
@@ -0,0 +1,5 @@
1
+ <div class="budget-list__data <%= data_class %>">
2
+ <%= project_data_number %>
3
+ <%= project_data_vote_button %>
4
+ <%= project_data_votes %>
5
+ </div>
@@ -0,0 +1,3 @@
1
+ <span class="card--list__data__number budget-list__number show-for-medium">
2
+ <%= budget_to_currency(model.budget) %>
3
+ </span>
@@ -0,0 +1,15 @@
1
+ <%= action_authorized_button_to "vote",
2
+ order_line_item_path(project_id: model),
3
+ method: vote_button_method,
4
+ remote: true,
5
+ class: "button tiny budget-list__action #{vote_button_class}",
6
+ data: {
7
+ add: !resource_added?,
8
+ disable: true,
9
+ budget: model.budget,
10
+ "redirect-url": resource_path
11
+ },
12
+ disabled: vote_button_disabled?,
13
+ title: vote_button_label do %>
14
+ <%= icon(resource_added? ? "x" : "check", class: "icon--small", aria_label: vote_button_label, role: "img") %>
15
+ <% end %>
@@ -0,0 +1,7 @@
1
+ <% if current_settings.show_votes? %>
2
+ <div class="card__support" style="width: 7em">
3
+ <span>
4
+ <%= t("decidim.budgets.projects.project.count", count: model.confirmed_orders_count) %>
5
+ </span>
6
+ </div>
7
+ <% end %>
@@ -0,0 +1,5 @@
1
+ <% if model.photos.first %>
2
+ <div class="budget-list__image">
3
+ <%= image_tag model.photos.first.thumbnail_url, alt: resource_title %>
4
+ </div>
5
+ <% end %>
@@ -0,0 +1,17 @@
1
+ <div class="budget-list__text">
2
+ <div>
3
+ <%= link_to resource_path, class: "card__link" do %>
4
+ <h5 class="card__title budget-list__title">
5
+ <%= resource_title %>
6
+ </h5>
7
+ <% end %>
8
+
9
+ <div class="show-for-medium">
10
+ <%= cell "decidim/tags", model, context: { extra_classes: ["tags--project"] } %>
11
+ </div>
12
+
13
+ <span class="budget-list__data__number budget-list__number hide-for-medium">
14
+ <%= budget_to_currency(model.budget) %>
15
+ </span>
16
+ </div>
17
+ </div>
@@ -0,0 +1,5 @@
1
+ <div id="project-<%= model.id %>-item" class="budget-list__item">
2
+ <%= project_image %>
3
+ <%= project_text %>
4
+ <%= project_data %>
5
+ </div>
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Budgets
5
+ # This cell renders a horizontal project card
6
+ # for an given instance of a Project in a budget list
7
+ class ProjectListItemCell < Decidim::ViewModel
8
+ include ActiveSupport::NumberHelper
9
+ include Decidim::LayoutHelper
10
+ include Decidim::ActionAuthorizationHelper
11
+ include Decidim::Budgets::ProjectsHelper
12
+ include Decidim::Budgets::Engine.routes.url_helpers
13
+
14
+ delegate :current_user, :current_settings, :current_order, :current_component, :current_participatory_space, to: :parent_controller
15
+
16
+ def project_image
17
+ render
18
+ end
19
+
20
+ def project_text
21
+ render
22
+ end
23
+
24
+ def project_data
25
+ render
26
+ end
27
+
28
+ def project_data_number
29
+ render
30
+ end
31
+
32
+ def project_data_votes
33
+ render
34
+ end
35
+
36
+ def project_data_vote_button
37
+ render
38
+ end
39
+
40
+ private
41
+
42
+ def resource_path
43
+ resource_locator(model).path
44
+ end
45
+
46
+ def resource_title
47
+ translated_attribute model.title
48
+ end
49
+
50
+ def resource_added?
51
+ current_order && current_order.projects.include?(model)
52
+ end
53
+
54
+ def data_class
55
+ return "budget-list__data--added" if resource_added?
56
+ end
57
+
58
+ def vote_button_disabled?
59
+ !current_settings.votes_enabled? || current_order_checked_out? || !current_participatory_space.can_participate?(current_user)
60
+ end
61
+
62
+ def vote_button_class
63
+ return "success" if resource_added?
64
+
65
+ "hollow"
66
+ end
67
+
68
+ def vote_button_method
69
+ return :delete if resource_added?
70
+
71
+ :post
72
+ end
73
+
74
+ def vote_button_label
75
+ if resource_added?
76
+ return t(
77
+ "decidim.budgets.projects.project.remove",
78
+ resource_name: resource_title
79
+ )
80
+ end
81
+
82
+ t("decidim.budgets.projects.project.add", resource_name: resource_title)
83
+ end
84
+ end
85
+ end
86
+ end
@@ -1,10 +1,10 @@
1
1
  <div class="card__icondata">
2
2
  <ul class="card-data">
3
3
  <li class="card-data__item">
4
- <%= icon "euro-outline", class: "icon--big" %>
4
+ <%= icon "euro-outline", class: "icon--big", role: "img", "aria-hidden": true %>
5
5
  </li>
6
6
  <li class="card-data__item">
7
- <div class="text-left text-uppercase">
7
+ <div class="text-left">
8
8
  <strong class="heading4"><%= budget_to_currency model.budget %></strong>
9
9
  </div>
10
10
  </li>
@@ -1,5 +1,5 @@
1
1
  <div class="card__footer">
2
2
  <div class="card__support">
3
- <%= link_to t("view", scope: "decidim.budgets.projects.project"), resource_path, class: "card__button button secondary button--sc small light" %>
3
+ <%= link_to t("view", scope: "decidim.budgets.projects.project"), resource_path, class: "card__button button button--sc small" %>
4
4
  </div>
5
5
  </div>
@@ -6,6 +6,9 @@ module Decidim
6
6
  # This command is executed when the user creates a Project from the admin
7
7
  # panel.
8
8
  class CreateProject < Rectify::Command
9
+ include ::Decidim::AttachmentMethods
10
+ include ::Decidim::GalleryMethods
11
+
9
12
  def initialize(form)
10
13
  @form = form
11
14
  end
@@ -16,9 +19,15 @@ module Decidim
16
19
  def call
17
20
  return broadcast(:invalid) if @form.invalid?
18
21
 
22
+ if process_gallery?
23
+ build_gallery
24
+ return broadcast(:invalid) if gallery_invalid?
25
+ end
26
+
19
27
  transaction do
20
28
  create_project
21
29
  link_proposals
30
+ create_gallery if process_gallery?
22
31
  end
23
32
 
24
33
  broadcast(:ok)
@@ -26,23 +35,24 @@ module Decidim
26
35
 
27
36
  private
28
37
 
29
- attr_reader :project
38
+ attr_reader :form, :project, :gallery
30
39
 
31
40
  def create_project
32
41
  @project = Decidim.traceability.create!(
33
42
  Project,
34
- @form.current_user,
35
- scope: @form.scope,
36
- category: @form.category,
37
- component: @form.current_component,
38
- title: @form.title,
39
- description: @form.description,
40
- budget: @form.budget
43
+ form.current_user,
44
+ scope: form.scope,
45
+ category: form.category,
46
+ component: form.current_component,
47
+ title: form.title,
48
+ description: form.description,
49
+ budget: form.budget
41
50
  )
51
+ @attached_to = @project
42
52
  end
43
53
 
44
54
  def proposals
45
- @proposals ||= project.sibling_scope(:proposals).where(id: @form.proposal_ids)
55
+ @proposals ||= project.sibling_scope(:proposals).where(id: form.proposal_ids)
46
56
  end
47
57
 
48
58
  def link_proposals