decidim-plans 0.16.3 → 0.16.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 89daec1bca29a601922a38e6eaac70f669272784d23cefa2ad74e0d4f7fad1ad
4
- data.tar.gz: 363a50ba655819e2ddc02a30972083d21650aa4bdc686a0396dbcb6aabddcbc5
3
+ metadata.gz: 741276c73f6d1054bf091d66981cb44f86587445f09f7a85ba2ff7cac995a1f1
4
+ data.tar.gz: c4fca20be4d12d149653fe12fd4cee859ada4833bac442b39a3968b7f64419f6
5
5
  SHA512:
6
- metadata.gz: 408c5f2d9daf2adb71255c90ae28d0e5d739a6177db4c93c607fcf5968c508126ea32c9f417ab765cbc169483881615a3252110eecdcad05f8d0a2874c1313a9
7
- data.tar.gz: 3f1863c3c6ad6b929b57803beb447f06ca3e32044c0ca391b6f8d74e6489f8a7043466962f18ac03f5d29671a2749f1c8554dee7990314a90e7e67b8b9de332b
6
+ metadata.gz: 6c9816cbe7feb9125c40f88c39430ab9a6d23cce821180e5088dc5aa382ddca815cc3f9c8f030a243c695e92c7a27a74a8f9ad9a5beb2a52d230992b3e053c7f
7
+ data.tar.gz: 67cf49151de0ee6d2415933531877fadae8ad50dbd16444ba8c4d7eddeae177f8084fadc9f6837524b3f42d1b4cac7ac995b14a9ee2d5eeb6a427d295d4bf8f0
data/README.md CHANGED
@@ -39,7 +39,7 @@ Development of this gem has been sponsored by the
39
39
  Add this line to your application's Gemfile:
40
40
 
41
41
  ```ruby
42
- gem 'decidim-plans'
42
+ gem "decidim-plans"
43
43
  ```
44
44
 
45
45
  And then execute:
@@ -154,12 +154,19 @@ If you want to generate the code coverage report for the tests, you can use
154
154
  the `SIMPLECOV=1` environment variable in the rspec command as follows:
155
155
 
156
156
  ```bash
157
- SIMPLECOV=1 bundle exec rspec
157
+ $ SIMPLECOV=1 bundle exec rspec
158
158
  ```
159
159
 
160
160
  This will generate a folder named `coverage` in the project root which contains
161
161
  the code coverage report.
162
162
 
163
+ ### Localization
164
+
165
+ If you would like to see this module in your own language, you can help with its
166
+ translation at Crowdin:
167
+
168
+ https://crowdin.com/project/decidim-plans
169
+
163
170
  ## License
164
171
 
165
172
  See [LICENSE-AGPLv3.txt](LICENSE-AGPLv3.txt).
@@ -26,6 +26,7 @@ module Decidim
26
26
  publish_plan
27
27
  send_notification
28
28
  send_notification_to_participatory_space
29
+ send_notification_to_proposal_authors
29
30
  end
30
31
 
31
32
  broadcast(:ok, @plan)
@@ -67,9 +68,27 @@ module Decidim
67
68
  )
68
69
  end
69
70
 
71
+ def send_notification_to_proposal_authors
72
+ Decidim::EventsManager.publish(
73
+ event: "decidim.events.plans.plan_published",
74
+ event_class: Decidim::Plans::PublishPlanEvent,
75
+ resource: @plan,
76
+ followers: proposal_authors,
77
+ extra: {
78
+ proposal_author: true
79
+ }
80
+ )
81
+ end
82
+
70
83
  def coauthors_followers
71
84
  @coauthors_followers ||= @plan.authors.flat_map(&:followers)
72
85
  end
86
+
87
+ def proposal_authors
88
+ @proposal_authors ||= @plan.proposals.flat_map(
89
+ &:authors
90
+ ).select { |a| a.is_a?(Decidim::User) }
91
+ end
73
92
  end
74
93
  end
75
94
  end
@@ -12,14 +12,19 @@ module Decidim
12
12
  private
13
13
 
14
14
  def i18n_scope
15
- return super unless participatory_space_event?
15
+ return "decidim.events.plans.plan_published_for_space" if participatory_space_event?
16
+ return "decidim.events.plans.plan_published_for_proposals" if proposal_author_event?
16
17
 
17
- "decidim.events.plans.plan_published_for_space"
18
+ super
18
19
  end
19
20
 
20
21
  def participatory_space_event?
21
22
  extra.dig(:participatory_space)
22
23
  end
24
+
25
+ def proposal_author_event?
26
+ extra.dig(:proposal_author)
27
+ end
23
28
  end
24
29
  end
25
30
  end
@@ -26,7 +26,9 @@ module Decidim
26
26
  }
27
27
 
28
28
  def to_param
29
- id || "section-id"
29
+ return id if id.present?
30
+
31
+ "section-id"
30
32
  end
31
33
  end
32
34
  end
@@ -13,7 +13,9 @@ module Decidim
13
13
  validates :title, presence: true, if: ->(form) { form.file.present? || form.id.present? }
14
14
 
15
15
  def to_param
16
- id || "attachment-id"
16
+ return id if id.present?
17
+
18
+ "attachment-id"
17
19
  end
18
20
  end
19
21
  end
@@ -70,6 +70,17 @@ module Decidim
70
70
  ]
71
71
  end
72
72
 
73
+ # We need a custom filter form helper because of the following bug in the
74
+ # core: https://github.com/decidim/decidim/issues/4584
75
+ def plan_filter_form_for(filter, url = url_for)
76
+ namespace = SecureRandom.hex(10)
77
+ content_tag :div, class: "filters" do
78
+ form_for filter, namespace: "filters_#{namespace}", builder: FilterFormBuilder, url: url, as: :filter, method: :get, remote: true, html: { id: nil } do |form|
79
+ yield form
80
+ end
81
+ end
82
+ end
83
+
73
84
  def tabs_id_for_content(idx)
74
85
  "content_#{idx}"
75
86
  end
@@ -35,7 +35,7 @@ module Decidim
35
35
  .try(:resource_scope, current_component)
36
36
  &.order(title: :asc)
37
37
  &.where("title ilike ?", "%#{params[:term]}%")
38
- &.where&.not(state: "rejected")
38
+ &.where("state IS NULL OR state != ?", "rejected")
39
39
  &.where&.not(published_at: nil)
40
40
  render json: query.all.collect { |p| [present(p).title, p.id] }
41
41
  end
@@ -1,4 +1,4 @@
1
- <%= filter_form_for filter do |form| %>
1
+ <%= plan_filter_form_for filter do |form| %>
2
2
  <div class="filters__section">
3
3
  <div class="filters__search">
4
4
  <div class="input-group">
@@ -20,11 +20,11 @@
20
20
  <%= form.collection_radio_buttons :related_to, linked_classes_filter_values_for(Decidim::Plans::Plan), :first, :last, legend_title: t(".related_to") %>
21
21
  <% end %>
22
22
 
23
- <% if current_participatory_space.has_subscopes? %>
23
+ <% if component_settings.scopes_enabled? && current_participatory_space.has_subscopes? %>
24
24
  <%= scopes_picker_filter form, :scope_id %>
25
25
  <% end %>
26
26
 
27
- <% if current_component.categories.any? %>
27
+ <% if component_settings.categories_enabled? && current_component.categories.any? %>
28
28
  <%= form.categories_select :category_id, current_component.categories, legend_title: t(".category"), disable_parents: false, label: false, prompt: t(".category_prompt") %>
29
29
  <% end %>
30
30
 
@@ -270,7 +270,7 @@ en:
270
270
  see_other_versions: see other versions
271
271
  version: Version %{number}
272
272
  version_history: see version history
273
- withdraw: withdraw the draft
273
+ withdraw: withdraw the plan
274
274
  withdraw_btn: Withdraw
275
275
  withdraw_btn_hint: You can withdraw this item if you change your mind, as long as you have not received any support. The item is not deleted, it will appear in the list of withdrawn items.
276
276
  withdraw_confirmation: Are you sure to withdraw this item?
@@ -355,22 +355,32 @@ en:
355
355
  email_subject: You have been rejected as a contributor of %{resource_title}.
356
356
  notification_title: You have been <strong>rejected to access as a contributor</strong> of <a href="%{resource_path}">%{resource_title}</a>.
357
357
  plan_accepted:
358
- email_intro: 'The plan "%{resource_title}" has been accepted. You can read the answer in this page:'
358
+ email_intro: '"%{resource_title}" has been accepted. You can read the answer in this page:'
359
359
  email_outro: You have received this notification because you are following "%{resource_title}". You can unfollow it from the previous link.
360
- email_subject: A plan you're following has been accepted
360
+ email_subject: A resource you're following has been accepted
361
361
  notification_title: <a href="%{resource_path}">%{resource_title}</a> has been accepted.
362
362
  plan_evaluating:
363
363
  email_intro: '"%{resource_title}" is currently being evaluated. You can check for an answer in this page:'
364
364
  email_outro: You have received this notification because you are following "%{resource_title}". You can unfollow it from the previous link.
365
- email_subject: A plan you're following is being evaluated
365
+ email_subject: A resource you're following is being evaluated
366
366
  notification_title: <a href="%{resource_path}">%{resource_title}</a> is being evaluated.
367
+ plan_published:
368
+ email_intro: '"%{resource_title}" has been published. You can see it here:'
369
+ email_outro: You have received this notification because you are following the author of "%{resource_title}". You can unfollow it from the previous link.
370
+ email_subject: A user you're following has published a resource
371
+ notification_title: <a href="%{resource_path}">%{resource_title}</a> has been published.
372
+ plan_published_for_proposals:
373
+ email_intro: 'A proposal you have authored has been linked to "%{resource_title}". You can see it here:'
374
+ email_outro: You have received this notification because you are following "%{resource_title}" through the authored proposals. You can unfollow it from the previous link.
375
+ email_subject: A proposal you have authored has been linked to new content
376
+ notification_title: A proposal you have authored has been linked to <a href="%{resource_path}">%{resource_title}</a>.
367
377
  plan_published_for_space:
368
378
  email_intro: '"%{resource_title}" has been published. You can see it here:'
369
379
  email_outro: You have received this notification because you are following "%{resource_title}". You can unfollow it from the previous link.
370
- email_subject: A plan you're following has been published
380
+ email_subject: A resource you're following has been published
371
381
  notification_title: <a href="%{resource_path}">%{resource_title}</a> has been published.
372
382
  plan_rejected:
373
383
  email_intro: '"%{resource_title}" has been rejected. You can read the answer in this page:'
374
384
  email_outro: You have received this notification because you are following "%{resource_title}". You can unfollow it from the previous link.
375
- email_subject: A plan you're following has been rejected
385
+ email_subject: A resource you're following has been rejected
376
386
  notification_title: <a href="%{resource_path}">%{resource_title}</a> has been rejected.
@@ -151,7 +151,7 @@ fi:
151
151
  current_selection: Hae ehdotuksia nimellä
152
152
  select: Valitse
153
153
  create:
154
- invalid: Virhe luotaessa suunnitelmaa.
154
+ invalid: Virhe luotaessa sisältöä.
155
155
  success: Luonti onnistui.
156
156
  last_activity:
157
157
  new_plan_at_html: "<span>Uusi suunnitelma osoitteessa %{link}</span>"
@@ -330,12 +330,12 @@ fi:
330
330
  plan_access_rejected:
331
331
  email_intro: 'Käyttäjän %{requester_name} muokkausoikeudet sisältöön <a href="%{resource_path}">%{resource_title} </a> on estetty.'
332
332
  email_outro: Tämä ilmoitus on lähetetty sinulle, koska olet osallistunut sisällön <a href="%{resource_path}">%{resource_title}</a> muokkaukseen.
333
- email_subject: "%{requester_name} hakemus osallistua suunnitelmaan %{resource_title} on hylätty."
333
+ email_subject: "%{requester_name} hakemus osallistua kohteen %{resource_title} muokkaukseen on hylätty."
334
334
  notification_title: <a href="%{requester_path}">%{requester_name} %{requester_nickname}</a> <strong>pyyntö muokata sisältöä on hylätty</strong> kohteelle <a href="%{resource_path}">%{resource_title}</a>.
335
335
  plan_access_requested:
336
336
  email_intro: '%{requester_name} pyysi pääsyä osallistujaksi. Voit <strong>hyväksyä tai hylätä pyynnön</strong> sivulla <a href="%{resource_path}">%{resource_title}</a>.'
337
- email_outro: Tämä ilmoitus on lähetetty sinulle, koska olet osallistuja suunnitelmassa <a href="%{resource_path}">%{resource_title}</a>.
338
- email_subject: "%{requester_name} pyysi osallistumisoikeutta suunnitelmaan %{resource_title}."
337
+ email_outro: Tämä ilmoitus on lähetetty sinulle, koska olet osallistuja kohteessa <a href="%{resource_path}">%{resource_title}</a>.
338
+ email_subject: "%{requester_name} pyysi osallistumisoikeutta kohteeseen %{resource_title}."
339
339
  notification_title: <a href="%{requester_path}">%{requester_name} %{requester_nickname}</a> pyysi saada muokata sisältöä <a href="%{resource_path}">%{resource_title}</a>. <strong>Hyväksy tai hylkää pyyntö</strong>.
340
340
  plan_access_requester_accepted:
341
341
  email_intro: Sinut on hyväksytty osallistujaksi sisältöön <a href="%{resource_path}">%{resource_title}</a>.
@@ -357,6 +357,16 @@ fi:
357
357
  email_outro: Tämä ilmoitus on lähetetty sinulle, koska seuraat kohdetta "%{resource_title}". Voit lopettaa seuraamisen edellä esitetyn linkin kautta.
358
358
  email_subject: Seuraamasi kohde on arvioitavana
359
359
  notification_title: <a href="%{resource_path}">%{resource_title}</a> on arvioitavana.
360
+ plan_published:
361
+ email_intro: '"%{resource_title}" on julkaistu. Näet sen täältä:'
362
+ email_outro: Tämä ilmoitus on lähetetty sinulle, koska seuraat kohteen "%{resource_title}" laatijaa. Voit lopettaa sen seuraamisen edellä esitetyn linkin kautta.
363
+ email_subject: Seuraamasi käyttäjä on julkaissut uutta sisältöä
364
+ notification_title: <a href="%{resource_path}">%{resource_title}</a> on julkaistu.
365
+ plan_published_for_proposals:
366
+ email_intro: 'Laatimasi ehdotus on linkitetty kohteeseen "%{resource_title}". Näet sen täältä:'
367
+ email_outro: Tämä ilmoitus on lähetetty sinulle, koska seuraat kohdetta "%{resource_title}" laatimisesi ehdotusten kautta. Voit lopettaa seuraamisen edellä esitetyn linkin kautta.
368
+ email_subject: Laatimasi ehdotus on linkitetty uuteen sisältöön
369
+ notification_title: Laatimasi ehdotus on linkitetty kohteeseen <a href="%{resource_path}">%{resource_title}</a>.
360
370
  plan_published_for_space:
361
371
  email_intro: '"%{resource_title}" on julkaistu. Näet sen täältä:'
362
372
  email_outro: Tämä ilmoitus on lähetetty sinulle, koska seuraat kohdetta "%{resource_title}". Voit lopettaa sen seuraamisen edellä esitetyn linkin kautta.
@@ -263,7 +263,7 @@ sv:
263
263
  see_other_versions: see other versions
264
264
  version: Version %{number}
265
265
  version_history: see version history
266
- withdraw: withdraw the draft
266
+ withdraw: withdraw the plan
267
267
  withdraw_btn: Withdraw
268
268
  withdraw_btn_hint: You can withdraw this item if you change your mind, as long as you have not received any support. The item is not deleted, it will appear in the list of withdrawn items.
269
269
  withdraw_confirmation: Are you sure to withdraw this item?
@@ -348,22 +348,32 @@ sv:
348
348
  email_subject: You have been rejected as a contributor of %{resource_title}.
349
349
  notification_title: You have been <strong>rejected to access as a contributor</strong> of <a href="%{resource_path}">%{resource_title}</a>.
350
350
  plan_accepted:
351
- email_intro: 'The plan "%{resource_title}" has been accepted. You can read the answer in this page:'
351
+ email_intro: '"%{resource_title}" has been accepted. You can read the answer in this page:'
352
352
  email_outro: You have received this notification because you are following "%{resource_title}". You can unfollow it from the previous link.
353
- email_subject: A plan you're following has been accepted
353
+ email_subject: A resource you're following has been accepted
354
354
  notification_title: <a href="%{resource_path}">%{resource_title}</a> has been accepted.
355
355
  plan_evaluating:
356
356
  email_intro: '"%{resource_title}" is currently being evaluated. You can check for an answer in this page:'
357
357
  email_outro: You have received this notification because you are following "%{resource_title}". You can unfollow it from the previous link.
358
- email_subject: A plan you're following is being evaluated
358
+ email_subject: A resource you're following is being evaluated
359
359
  notification_title: <a href="%{resource_path}">%{resource_title}</a> is being evaluated.
360
+ plan_published:
361
+ email_intro: '"%{resource_title}" has been published. You can see it here:'
362
+ email_outro: You have received this notification because you are following the author of "%{resource_title}". You can unfollow it from the previous link.
363
+ email_subject: A user you're following has published a resource
364
+ notification_title: <a href="%{resource_path}">%{resource_title}</a> has been published.
365
+ plan_published_for_proposals:
366
+ email_intro: 'A proposal you have authored has been linked to "%{resource_title}". You can see it here:'
367
+ email_outro: You have received this notification because you are following "%{resource_title}" through the authored proposals. You can unfollow it from the previous link.
368
+ email_subject: A proposal you have authored has been linked to new content
369
+ notification_title: A proposal you have authored has been linked to <a href="%{resource_path}">%{resource_title}</a>.
360
370
  plan_published_for_space:
361
371
  email_intro: '"%{resource_title}" has been published. You can see it here:'
362
372
  email_outro: You have received this notification because you are following "%{resource_title}". You can unfollow it from the previous link.
363
- email_subject: A plan you're following has been published
373
+ email_subject: A resource you're following has been published
364
374
  notification_title: <a href="%{resource_path}">%{resource_title}</a> has been published.
365
375
  plan_rejected:
366
376
  email_intro: '"%{resource_title}" has been rejected. You can read the answer in this page:'
367
377
  email_outro: You have received this notification because you are following "%{resource_title}". You can unfollow it from the previous link.
368
- email_subject: A plan you're following has been rejected
378
+ email_subject: A resource you're following has been rejected
369
379
  notification_title: <a href="%{resource_path}">%{resource_title}</a> has been rejected.
@@ -2,7 +2,7 @@
2
2
 
3
3
  module Decidim
4
4
  module Plans
5
- VERSION = "0.16.3"
5
+ VERSION = "0.16.4"
6
6
  DECIDIM_VERSION = "~> 0.16.0"
7
7
  end
8
8
  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.16.3
4
+ version: 0.16.4
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-02-21 00:00:00.000000000 Z
11
+ date: 2019-02-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: decidim-core