decidim-initiatives 0.23.2 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (116) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +1 -1
  3. data/app/assets/stylesheet/decidim/initiatives/initiatives.scss +6 -0
  4. data/app/assets/stylesheet/decidim/initiatives/print-initiative.css.scss +22 -0
  5. data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives/show.erb +4 -8
  6. data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_cell.rb +5 -1
  7. data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_settings_form/show.erb +2 -1
  8. data/app/cells/decidim/initiatives/content_blocks/highlighted_initiatives_settings_form_cell.rb +12 -1
  9. data/app/cells/decidim/initiatives/initiative_m/tags.erb +1 -1
  10. data/app/commands/decidim/initiatives/admin/update_initiative.rb +3 -3
  11. data/app/commands/decidim/initiatives/admin/update_initiative_answer.rb +3 -3
  12. data/app/commands/decidim/initiatives/approve_membership_request.rb +40 -0
  13. data/app/commands/decidim/initiatives/create_initiative.rb +5 -4
  14. data/app/commands/decidim/initiatives/revoke_membership_request.rb +40 -0
  15. data/app/commands/decidim/initiatives/send_initiative_to_technical_validation.rb +57 -0
  16. data/app/commands/decidim/initiatives/spawn_committee_request.rb +18 -0
  17. data/app/commands/decidim/initiatives/update_initiative.rb +74 -0
  18. data/app/controllers/decidim/initiatives/admin/committee_requests_controller.rb +15 -4
  19. data/app/controllers/decidim/initiatives/admin/initiatives_controller.rb +1 -1
  20. data/app/controllers/decidim/initiatives/admin/moderations/reports_controller.rb +18 -0
  21. data/app/controllers/decidim/initiatives/committee_requests_controller.rb +32 -0
  22. data/app/controllers/decidim/initiatives/initiative_signatures_controller.rb +1 -3
  23. data/app/controllers/decidim/initiatives/initiatives_controller.rb +58 -1
  24. data/app/events/decidim/initiatives/approve_membership_request_event.rb +61 -0
  25. data/app/events/decidim/initiatives/initiative_sent_to_technical_validation_event.rb +19 -0
  26. data/app/events/decidim/initiatives/revoke_membership_request_event.rb +61 -0
  27. data/app/events/decidim/initiatives/spawn_committee_request_event.rb +61 -0
  28. data/app/forms/decidim/initiatives/admin/initiative_form.rb +8 -4
  29. data/app/forms/decidim/initiatives/admin/initiative_type_form.rb +3 -0
  30. data/app/forms/decidim/initiatives/initiative_form.rb +25 -2
  31. data/app/forms/decidim/initiatives/vote_form.rb +3 -1
  32. data/app/helpers/decidim/initiatives/admin/initiative_admin_menu_helper.rb +15 -0
  33. data/app/helpers/decidim/initiatives/create_initiative_helper.rb +3 -2
  34. data/app/models/concerns/decidim/initiatives/has_area.rb +1 -1
  35. data/app/models/decidim/initiative.rb +0 -1
  36. data/app/permissions/decidim/initiatives/admin/permissions.rb +5 -4
  37. data/app/permissions/decidim/initiatives/permissions.rb +47 -20
  38. data/app/queries/decidim/initiatives/initiatives_promoted.rb +1 -1
  39. data/app/queries/decidim/initiatives/organization_prioritized_initiatives.rb +13 -2
  40. data/app/serializers/decidim/initiatives/initiative_serializer.rb +3 -0
  41. data/app/services/decidim/initiatives/dummy_timestamp.rb +1 -1
  42. data/app/services/decidim/initiatives/initiative_search.rb +15 -13
  43. data/app/services/decidim/initiatives/pdf_signature_example.rb +27 -27
  44. data/app/views/decidim/initiatives/admin/initiatives/edit.html.erb +1 -1
  45. data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +6 -0
  46. data/app/views/decidim/initiatives/admin/initiatives_type_scopes/edit.html.erb +24 -17
  47. data/app/views/decidim/initiatives/admin/initiatives_type_scopes/new.html.erb +17 -11
  48. data/app/views/decidim/initiatives/create_initiative/_finish_help.html.erb +2 -7
  49. data/app/views/decidim/initiatives/create_initiative/fill_data.html.erb +4 -17
  50. data/app/views/decidim/initiatives/create_initiative/finish.html.erb +11 -11
  51. data/app/views/decidim/initiatives/initiative_signatures/error_on_vote.js.erb +5 -0
  52. data/app/views/decidim/initiatives/initiatives/_committee_members.html.erb +73 -0
  53. data/app/views/decidim/initiatives/initiatives/_filters_small_view.html.erb +1 -1
  54. data/app/views/decidim/initiatives/initiatives/_form.html.erb +112 -0
  55. data/app/views/decidim/initiatives/initiatives/_result.html.erb +1 -1
  56. data/app/views/decidim/initiatives/initiatives/_send_to_technical_validation.html.erb +8 -0
  57. data/app/views/decidim/initiatives/initiatives/edit.html.erb +78 -0
  58. data/app/views/decidim/initiatives/initiatives/print.html.erb +156 -0
  59. data/app/views/decidim/initiatives/initiatives/show.html.erb +19 -7
  60. data/app/views/layouts/decidim/admin/initiative.html.erb +0 -1
  61. data/app/views/layouts/decidim/admin/initiatives.html.erb +2 -15
  62. data/config/locales/ar.yml +2 -29
  63. data/config/locales/ca.yml +90 -30
  64. data/config/locales/cs.yml +98 -38
  65. data/config/locales/de.yml +91 -31
  66. data/config/locales/el.yml +2 -35
  67. data/config/locales/en.yml +94 -34
  68. data/config/locales/es-MX.yml +94 -34
  69. data/config/locales/es-PY.yml +94 -34
  70. data/config/locales/es.yml +93 -33
  71. data/config/locales/eu.yml +2 -29
  72. data/config/locales/fi-plain.yml +94 -34
  73. data/config/locales/fi.yml +94 -34
  74. data/config/locales/fr-CA.yml +96 -36
  75. data/config/locales/fr.yml +96 -36
  76. data/config/locales/gl.yml +2 -33
  77. data/config/locales/hu.yml +3 -32
  78. data/config/locales/id-ID.yml +2 -29
  79. data/config/locales/is-IS.yml +2 -14
  80. data/config/locales/it.yml +2 -35
  81. data/config/locales/ja.yml +2 -35
  82. data/config/locales/lv.yml +2 -33
  83. data/config/locales/nl.yml +31 -34
  84. data/config/locales/no.yml +2 -32
  85. data/config/locales/pl.yml +101 -33
  86. data/config/locales/pt-BR.yml +2 -29
  87. data/config/locales/pt.yml +3 -36
  88. data/config/locales/ro-RO.yml +2 -35
  89. data/config/locales/ru.yml +2 -22
  90. data/config/locales/sk.yml +2 -31
  91. data/config/locales/sr-CS.yml +0 -7
  92. data/config/locales/sv.yml +2 -34
  93. data/config/locales/tr-TR.yml +68 -34
  94. data/config/locales/uk.yml +2 -22
  95. data/config/locales/zh-CN.yml +2 -35
  96. data/db/migrate/20171017095143_update_initiative_scoped_type.rb +0 -1
  97. data/db/migrate/20191107134847_add_scopes_to_initiatives_votes.rb +1 -1
  98. data/db/migrate/20191118105634_allow_multiple_offline_votes.rb +1 -1
  99. data/db/migrate/20210310120720_add_followable_counter_cache_to_initiatives.rb +16 -0
  100. data/lib/decidim/api/initiative_api_type.rb +26 -0
  101. data/lib/decidim/api/initiative_committee_member_type.rb +18 -0
  102. data/lib/decidim/api/initiative_type.rb +49 -0
  103. data/lib/decidim/api/initiative_type_interface.rb +8 -3
  104. data/lib/decidim/initiatives.rb +1 -0
  105. data/lib/decidim/initiatives/admin_engine.rb +23 -1
  106. data/lib/decidim/initiatives/api.rb +3 -0
  107. data/lib/decidim/initiatives/engine.rb +14 -9
  108. data/lib/decidim/initiatives/initiatives_filter_form_builder.rb +19 -12
  109. data/lib/decidim/initiatives/participatory_space.rb +6 -6
  110. data/lib/decidim/initiatives/query_extensions.rb +42 -19
  111. data/lib/decidim/initiatives/test/factories.rb +36 -0
  112. data/lib/decidim/initiatives/version.rb +1 -1
  113. metadata +34 -17
  114. data/app/types/decidim/initiatives/initiative_api_type.rb +0 -26
  115. data/app/types/decidim/initiatives/initiative_committee_member_type.rb +0 -18
  116. data/app/types/decidim/initiatives/initiative_type.rb +0 -42
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3e781acff60b29ae1a2008b0684335bd0208a09eb0bef5c9129f65e3f3d534f0
4
- data.tar.gz: 2dab76e1b6b9e9b004246f1c22cdba69babc3885f3ad8836a05813ef600df3e6
3
+ metadata.gz: 557c6b43a7cda759d2aefa2b9893893e336ccef62cc3533f19df7902ade4694b
4
+ data.tar.gz: fa9a227e8937d5f8b42ee55505ef04b471f85630b3a265ddd655feab095c7d48
5
5
  SHA512:
6
- metadata.gz: 5938e314ad1f71ea0a8f00baf6cfa9402eecb4cb5bde7a3a3d92d1d0a3c4bc7bf3b1e8c3d19e666683a861f262c33d5b6240144ccb258d130cc6521efe9b92e9
7
- data.tar.gz: db5387c0893ccf865301f1a2f815d3925537be13608d6beb6ef7e2d99b14666da371f06bacbf088026585e207374ad47331122a7dc71c2cfc8226d13e4e51dcc
6
+ metadata.gz: b835b100231867c4ee8a0dbbe93fbecf67f98bc032dca5319d02ae5aacc32b5aef64a7cbe044263825d9fcb09909a8ba11e51e740a8ebfb608de0f88872b2e03
7
+ data.tar.gz: 2987d8c74edf38e2e5be4e103fe667ae3d153d591f13e88ab011d6e9e8f0a42e5642aeacf629181083df616e9251bf91ba241b56ec9c948532a5b40e63f618d3
data/README.md CHANGED
@@ -53,7 +53,7 @@ Just use the following line:
53
53
  Decidim::Initiatives.do_not_require_authorization = true
54
54
  ```
55
55
 
56
- All the settings and their default values which can be overriden can be found in the file [`lib/decidim/initiatives.rb`](https://github.com/decidim/decidim/blob/master/decidim-initiatives/lib/decidim/initiatives.rb).
56
+ All the settings and their default values which can be overriden can be found in the file [`lib/decidim/initiatives.rb`](https://github.com/decidim/decidim/blob/develop/decidim-initiatives/lib/decidim/initiatives.rb).
57
57
 
58
58
  For example, you can also change the minimum number of required committee members to 1 (default is 2) by adding this line:
59
59
  ```
@@ -57,3 +57,9 @@
57
57
  margin-bottom: 1.5rem;
58
58
  }
59
59
  }
60
+
61
+ fieldset{
62
+ border: 1px solid #e8e8e8;
63
+ padding: .5em;
64
+ margin-bottom: 1em;
65
+ }
@@ -1,4 +1,10 @@
1
1
  @media all{
2
+ .printable{
3
+ width: 80%;
4
+ margin-left: auto;
5
+ margin-right: auto;
6
+ }
7
+
2
8
  .initiative-letterhead{
3
9
  font-size: 14pt;
4
10
  font-weight: bold;
@@ -104,6 +110,14 @@
104
110
  }
105
111
 
106
112
  @media print{
113
+ .process-header{
114
+ display: none;
115
+ }
116
+
117
+ .main-nav{
118
+ display: none;
119
+ }
120
+
107
121
  .title-bar{
108
122
  display: none;
109
123
  }
@@ -119,4 +133,12 @@
119
133
  .page-break{
120
134
  page-break-before: auto;
121
135
  }
136
+
137
+ .main-footer{
138
+ display: none;
139
+ }
140
+
141
+ .mini-footer{
142
+ display: none;
143
+ }
122
144
  }
@@ -5,16 +5,12 @@
5
5
  <div class="row small-up-1 smallmedium-up-2 mediumlarge-up-3 large-up-4 card-grid">
6
6
  <% highlighted_initiatives.each do |initiative| %>
7
7
  <div class="column">
8
- <div class="card card--initiative card--mini">
9
- <%= link_to decidim_initiatives.initiative_path(initiative), class: "card__link" do %>
10
- <span class="show-for-sr"><%= translated_attribute initiative.title %></span>
11
- <% end %>
8
+ <%= link_to decidim_initiatives.initiative_path(initiative), class: "card card--initiative card--mini" do %>
9
+ <span class="show-for-sr"><%= translated_attribute initiative.title %></span>
12
10
  <div class="card__content">
13
- <%= link_to decidim_initiatives.initiative_path(initiative), class: "card__link" do %>
14
- <span class="card__title"><%= decidim_html_escape(translated_attribute(initiative.title)) %></span>
15
- <% end %>
11
+ <span class="card__title card__link"><%= decidim_html_escape(translated_attribute(initiative.title)) %></span>
16
12
  </div>
17
- </div>
13
+ <% end %>
18
14
  </div>
19
15
  <% end %>
20
16
  </div>
@@ -16,9 +16,13 @@ module Decidim
16
16
  model.settings.max_results
17
17
  end
18
18
 
19
+ def order
20
+ model.settings.order
21
+ end
22
+
19
23
  def highlighted_initiatives
20
24
  @highlighted_initiatives ||= OrganizationPrioritizedInitiatives
21
- .new(current_organization)
25
+ .new(current_organization, order)
22
26
  .query
23
27
  .limit(max_results)
24
28
  end
@@ -1,3 +1,4 @@
1
1
  <% form.fields_for :settings, form.object.settings do |settings_fields| %>
2
- <%= settings_fields.select :max_results, [4, 8, 12], prompt: "", label: label %>
2
+ <%= settings_fields.select :max_results, [4, 8, 12], prompt: "", label: max_results_label %>
3
+ <%= settings_fields.select :order, order_select, prompt: "", label: order_label %>
3
4
  <% end %>
@@ -10,9 +10,20 @@ module Decidim
10
10
  options[:content_block]
11
11
  end
12
12
 
13
- def label
13
+ def max_results_label
14
14
  I18n.t("decidim.initiatives.admin.content_blocks.highlighted_initiatives.max_results")
15
15
  end
16
+
17
+ def order_label
18
+ I18n.t("decidim.initiatives.admin.content_blocks.highlighted_initiatives.order.label")
19
+ end
20
+
21
+ def order_select
22
+ [
23
+ [I18n.t("decidim.initiatives.admin.content_blocks.highlighted_initiatives.order.default"), "default"],
24
+ [I18n.t("decidim.initiatives.admin.content_blocks.highlighted_initiatives.order.most_recent"), "most_recent"]
25
+ ]
26
+ end
16
27
  end
17
28
  end
18
29
  end
@@ -1,5 +1,5 @@
1
1
  <% if model.hashtag.present? %>
2
- <%= link_to_if(
2
+ <%= link_to(
3
3
  "##{hashtag}",
4
4
  "https://twitter.com/hashtag/#{hashtag}",
5
5
  class: "card__text--category",
@@ -80,9 +80,9 @@ module Decidim
80
80
  attrs[:state] = form.state if form.state
81
81
  attrs[:decidim_area_id] = form.area_id
82
82
 
83
- if initiative.published?
84
- @notify_extended = true if form.signature_end_date != initiative.signature_end_date &&
85
- form.signature_end_date > initiative.signature_end_date
83
+ if initiative.published? && form.signature_end_date != initiative.signature_end_date &&
84
+ form.signature_end_date > initiative.signature_end_date
85
+ @notify_extended = true
86
86
  end
87
87
  end
88
88
 
@@ -53,9 +53,9 @@ module Decidim
53
53
  attrs[:signature_start_date] = form.signature_start_date
54
54
  attrs[:signature_end_date] = form.signature_end_date
55
55
 
56
- if initiative.published?
57
- @notify_extended = true if form.signature_end_date != initiative.signature_end_date &&
58
- form.signature_end_date > initiative.signature_end_date
56
+ if initiative.published? && form.signature_end_date != initiative.signature_end_date &&
57
+ form.signature_end_date > initiative.signature_end_date
58
+ @notify_extended = true
59
59
  end
60
60
  end
61
61
 
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Initiatives
5
+ # A command with all the business logic that creates a new initiative.
6
+ class ApproveMembershipRequest < Rectify::Command
7
+ # Public: Initializes the command.
8
+ #
9
+ # membership_request - A pending committee member
10
+ def initialize(membership_request)
11
+ @membership_request = membership_request
12
+ end
13
+
14
+ # Executes the command. Broadcasts these events:
15
+ #
16
+ # - :ok when everything is valid.
17
+ #
18
+ # Returns nothing.
19
+ def call
20
+ @membership_request.accepted!
21
+ notify_applicant
22
+
23
+ broadcast(:ok, @membership_request)
24
+ end
25
+
26
+ private
27
+
28
+ def notify_applicant
29
+ Decidim::EventsManager.publish(
30
+ event: "decidim.events.initiatives.approve_membership_request",
31
+ event_class: Decidim::Initiatives::ApproveMembershipRequestEvent,
32
+ resource: @membership_request.initiative,
33
+ affected_users: [@membership_request.user],
34
+ force_send: true,
35
+ extra: { author: @membership_request.initiative.author }
36
+ )
37
+ end
38
+ end
39
+ end
40
+ end
@@ -5,7 +5,7 @@ module Decidim
5
5
  # A command with all the business logic that creates a new initiative.
6
6
  class CreateInitiative < Rectify::Command
7
7
  include CurrentLocale
8
- include AttachmentMethods
8
+ include ::Decidim::MultipleAttachmentsMethods
9
9
 
10
10
  # Public: Initializes the command.
11
11
  #
@@ -26,8 +26,8 @@ module Decidim
26
26
  return broadcast(:invalid) if form.invalid?
27
27
 
28
28
  if process_attachments?
29
- build_attachment
30
- return broadcast(:invalid) if attachment_invalid?
29
+ build_attachments
30
+ return broadcast(:invalid) if attachments_invalid?
31
31
  end
32
32
 
33
33
  initiative = create_initiative
@@ -51,7 +51,8 @@ module Decidim
51
51
  initiative.transaction do
52
52
  initiative.save!
53
53
  @attached_to = initiative
54
- create_attachment if process_attachments?
54
+ create_attachments if process_attachments?
55
+
55
56
  create_components_for(initiative)
56
57
  send_notification(initiative)
57
58
  add_author_as_follower(initiative)
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Initiatives
5
+ # A command with all the business logic that creates a new initiative.
6
+ class RevokeMembershipRequest < Rectify::Command
7
+ # Public: Initializes the command.
8
+ #
9
+ # membership_request - A pending committee member
10
+ def initialize(membership_request)
11
+ @membership_request = membership_request
12
+ end
13
+
14
+ # Executes the command. Broadcasts these events:
15
+ #
16
+ # - :ok when everything is valid.
17
+ #
18
+ # Returns nothing.
19
+ def call
20
+ @membership_request.rejected!
21
+ notify_applicant
22
+
23
+ broadcast(:ok, @membership_request)
24
+ end
25
+
26
+ private
27
+
28
+ def notify_applicant
29
+ Decidim::EventsManager.publish(
30
+ event: "decidim.events.initiatives.revoke_membership_request",
31
+ event_class: Decidim::Initiatives::RevokeMembershipRequestEvent,
32
+ resource: @membership_request.initiative,
33
+ affected_users: [@membership_request.user],
34
+ force_send: true,
35
+ extra: { author: @membership_request.initiative.author }
36
+ )
37
+ end
38
+ end
39
+ end
40
+ end
@@ -0,0 +1,57 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Initiatives
5
+ # A command with all the business logic that sends an
6
+ # existing initiative to technical validation.
7
+ class SendInitiativeToTechnicalValidation < Rectify::Command
8
+ # Public: Initializes the command.
9
+ #
10
+ # initiative - Decidim::Initiative
11
+ # current_user - the user performing the action
12
+ def initialize(initiative, current_user)
13
+ @initiative = initiative
14
+ @current_user = current_user
15
+ end
16
+
17
+ # Executes the command. Broadcasts these events:
18
+ #
19
+ # - :ok when everything is valid.
20
+ # - :invalid if the form wasn't valid and we couldn't proceed.
21
+ #
22
+ # Returns nothing.
23
+ def call
24
+ @initiative = Decidim.traceability.perform_action!(
25
+ :send_to_technical_validation,
26
+ initiative,
27
+ current_user
28
+ ) do
29
+ initiative.validating!
30
+ initiative
31
+ end
32
+
33
+ notify_admins
34
+
35
+ broadcast(:ok, initiative)
36
+ end
37
+
38
+ private
39
+
40
+ attr_reader :initiative, :current_user
41
+
42
+ def notify_admins
43
+ affected_users = Decidim::User.org_admins_except_me(current_user).all
44
+
45
+ data = {
46
+ event: "decidim.events.initiatives.initiative_sent_to_technical_validation",
47
+ event_class: Decidim::Initiatives::InitiativeSentToTechnicalValidationEvent,
48
+ resource: initiative,
49
+ affected_users: affected_users,
50
+ force_send: true
51
+ }
52
+
53
+ Decidim::EventsManager.publish(data)
54
+ end
55
+ end
56
+ end
57
+ end
@@ -26,6 +26,7 @@ module Decidim
26
26
  request = create_request
27
27
 
28
28
  if request.persisted?
29
+ notify_author
29
30
  broadcast(:ok, request)
30
31
  else
31
32
  broadcast(:invalid, request)
@@ -47,6 +48,23 @@ module Decidim
47
48
  request.save
48
49
  request
49
50
  end
51
+
52
+ def notify_author
53
+ return if initiative.author == current_user
54
+
55
+ Decidim::EventsManager.publish(
56
+ event: "decidim.events.initiatives.spawn_committee_request",
57
+ event_class: Decidim::Initiatives::SpawnCommitteeRequestEvent,
58
+ resource: initiative,
59
+ affected_users: [initiative.author],
60
+ force_send: true,
61
+ extra: { applicant: current_user }
62
+ )
63
+ end
64
+
65
+ def initiative
66
+ @initiative ||= Decidim::Initiative.find(form.initiative_id)
67
+ end
50
68
  end
51
69
  end
52
70
  end
@@ -0,0 +1,74 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Initiatives
5
+ # A command with all the business logic that updates an
6
+ # existing initiative.
7
+ class UpdateInitiative < Rectify::Command
8
+ include ::Decidim::MultipleAttachmentsMethods
9
+ include CurrentLocale
10
+
11
+ # Public: Initializes the command.
12
+ #
13
+ # initiative - Decidim::Initiative
14
+ # form - A form object with the params.
15
+ def initialize(initiative, form, current_user)
16
+ @form = form
17
+ @initiative = initiative
18
+ @current_user = current_user
19
+ @attached_to = initiative
20
+ end
21
+
22
+ # Executes the command. Broadcasts these events:
23
+ #
24
+ # - :ok when everything is valid.
25
+ # - :invalid if the form wasn't valid and we couldn't proceed.
26
+ #
27
+ # Returns nothing.
28
+ def call
29
+ return broadcast(:invalid) if form.invalid?
30
+
31
+ if process_attachments?
32
+ @initiative.attachments.where(id: form.documents).destroy_all
33
+
34
+ build_attachments
35
+ return broadcast(:invalid) if attachments_invalid?
36
+ end
37
+ @initiative = Decidim.traceability.update!(
38
+ initiative,
39
+ current_user,
40
+ attributes
41
+ )
42
+
43
+ create_attachments if process_attachments?
44
+ broadcast(:ok, initiative)
45
+ rescue ActiveRecord::RecordInvalid
46
+ broadcast(:invalid, initiative)
47
+ end
48
+
49
+ private
50
+
51
+ attr_reader :form, :initiative, :current_user
52
+
53
+ def attributes
54
+ attrs = {
55
+ title: { current_locale => form.title },
56
+ description: { current_locale => form.description },
57
+ hashtag: form.hashtag
58
+ }
59
+
60
+ if form.signature_type_updatable?
61
+ attrs[:signature_type] = form.signature_type
62
+ attrs[:scoped_type_id] = form.scoped_type_id if form.scoped_type_id
63
+ end
64
+
65
+ if initiative.created?
66
+ attrs[:signature_end_date] = form.signature_end_date if initiative.custom_signature_end_date_enabled?
67
+ attrs[:decidim_area_id] = form.area_id if initiative.area_enabled?
68
+ end
69
+
70
+ attrs
71
+ end
72
+ end
73
+ end
74
+ end