decidim-initiatives 0.15.2 → 0.16.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (49) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/stylesheet/decidim/initiatives/initiatives.scss +0 -20
  3. data/app/commands/decidim/initiatives/admin/update_initiative.rb +1 -1
  4. data/app/commands/decidim/initiatives/create_initiative.rb +1 -1
  5. data/app/commands/decidim/initiatives/vote_initiative.rb +3 -2
  6. data/app/controllers/decidim/initiatives/initiatives_controller.rb +2 -1
  7. data/app/events/decidim/initiatives/milestone_completed_event.rb +4 -0
  8. data/app/models/decidim/initiative.rb +9 -0
  9. data/app/models/decidim/initiatives_type_scope.rb +4 -0
  10. data/app/services/decidim/initiatives/initiative_search.rb +4 -7
  11. data/app/views/decidim/initiatives/admin/initiatives/index.html.erb +2 -0
  12. data/app/views/decidim/initiatives/admin/initiatives_types/_initiative_type_scopes.html.erb +1 -1
  13. data/app/views/decidim/initiatives/create_initiative/fill_data.html.erb +1 -1
  14. data/app/views/decidim/initiatives/create_initiative/finish.html.erb +1 -1
  15. data/app/views/decidim/initiatives/create_initiative/previous_form.html.erb +1 -1
  16. data/app/views/decidim/initiatives/create_initiative/promotal_committee.html.erb +1 -1
  17. data/app/views/decidim/initiatives/create_initiative/select_initiative_type.html.erb +1 -1
  18. data/app/views/decidim/initiatives/create_initiative/show_similar_initiatives.html.erb +1 -1
  19. data/app/views/decidim/initiatives/initiatives/index.html.erb +3 -2
  20. data/app/views/decidim/initiatives/initiatives/show.html.erb +4 -1
  21. data/app/views/layouts/decidim/_initiative_creation_header.html.erb +13 -11
  22. data/app/views/layouts/decidim/_initiative_header.html.erb +25 -44
  23. data/app/views/layouts/decidim/_initiative_header_steps.html.erb +1 -7
  24. data/app/views/layouts/decidim/initiative.html.erb +12 -12
  25. data/app/views/layouts/decidim/initiative_creation.html.erb +1 -1
  26. data/config/locales/ca.yml +20 -5
  27. data/config/locales/de.yml +20 -5
  28. data/config/locales/en.yml +20 -5
  29. data/config/locales/es-PY.yml +20 -5
  30. data/config/locales/es.yml +20 -5
  31. data/config/locales/eu.yml +20 -5
  32. data/config/locales/fi-pl.yml +20 -5
  33. data/config/locales/fi.yml +20 -5
  34. data/config/locales/fr.yml +20 -5
  35. data/config/locales/gl.yml +20 -5
  36. data/config/locales/hu.yml +20 -5
  37. data/config/locales/id-ID.yml +20 -5
  38. data/config/locales/it.yml +20 -5
  39. data/config/locales/nl.yml +20 -5
  40. data/config/locales/pl.yml +20 -5
  41. data/config/locales/pt-BR.yml +20 -5
  42. data/config/locales/pt.yml +20 -5
  43. data/config/locales/ru.yml +6 -5
  44. data/config/locales/sv.yml +20 -5
  45. data/config/locales/tr-TR.yml +20 -5
  46. data/config/locales/uk.yml +6 -5
  47. data/db/migrate/20181211112538_add_reference_to_initiatives.rb +24 -0
  48. data/lib/decidim/initiatives/version.rb +1 -1
  49. metadata +14 -13
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c5979e87038225a6d130d039817b1462d36566ac5085c81a7deb2000782fcc36
4
- data.tar.gz: 5ccac2eff9e91c1bc02703749da02c44dbcd06401cf7524a979a39e0f1f497bd
3
+ metadata.gz: 400915f5a9e0d88995d34fed19dc72a1d07b80c4e55e0bf0b1b35df268cdfb24
4
+ data.tar.gz: 9fa5cf0876f72c3065ec75d57189aa93dd208693f5f8cbd8cb5e2df20639c512
5
5
  SHA512:
6
- metadata.gz: 38a0ff42ef3d00c861c70531d28fa695f235c037ceddea661194c884ce36b63169a41f16ad2223bac551c993504b99c139c139005f6c5977b27635b1aac7d3f8
7
- data.tar.gz: 899b5060e5d0179f0fa49bb6326bf96f6eaf2c78964a0b2bd07e44d1f1a8d7ec5feb70644d807aa53eb06a11760e1da463325c6d9017b2fdf73d71d3a98a8015
6
+ metadata.gz: 0d7da84292e39c67413482d0019b4b357870fd5b445e80660aa90eba7ccdb89b40cc140887bc6ac66ab5f702cfa8bcfec3ee5d8a072b43aea344252a8b6bdd8c
7
+ data.tar.gz: 0a6408707f3ebee6f382f74a9f299e693da3a5606f0079736e71d8f85d38c33f67e87bb8d603e96eacd8f10ca79573b4de1b633f39089b7c092c84bcbef26448
@@ -56,26 +56,6 @@
56
56
  text-transform: lowercase !important;
57
57
  }
58
58
 
59
- .initiative-creation-header__container{
60
- position: relative;
61
- z-index: 1;
62
- padding: 0 0 0 1rem;
63
- background: #fafafa;
64
-
65
- .initiative-creation-header__phase{
66
- background: #fafafa;
67
- color: #fff;
68
- text-align: center;
69
- padding: 0 1rem;
70
- margin-left: -1rem;
71
-
72
- .caption{
73
- color: #8c838a;
74
- font-size: .9em;
75
- }
76
- }
77
- }
78
-
79
59
  .legal_text{
80
60
  font-size: 8pt;
81
61
  }
@@ -71,7 +71,7 @@ module Decidim
71
71
  event: "decidim.events.initiatives.initiative_extended",
72
72
  event_class: Decidim::Initiatives::ExtendInitiativeEvent,
73
73
  resource: initiative,
74
- recipient_ids: initiative.followers.pluck(:id)
74
+ followers: initiative.followers - [initiative.author]
75
75
  )
76
76
  end
77
77
  end
@@ -95,7 +95,7 @@ module Decidim
95
95
  event: "decidim.events.initiatives.initiative_created",
96
96
  event_class: Decidim::Initiatives::CreateInitiativeEvent,
97
97
  resource: initiative,
98
- recipient_ids: initiative.author.followers.pluck(:id)
98
+ followers: initiative.author.followers
99
99
  )
100
100
  end
101
101
 
@@ -53,7 +53,7 @@ module Decidim
53
53
  event: "decidim.events.initiatives.initiative_endorsed",
54
54
  event_class: Decidim::Initiatives::EndorseInitiativeEvent,
55
55
  resource: @initiative,
56
- recipient_ids: @initiative.author.followers.pluck(:id)
56
+ followers: @initiative.author.followers
57
57
  )
58
58
  end
59
59
 
@@ -68,7 +68,8 @@ module Decidim
68
68
  event: "decidim.events.initiatives.milestone_completed",
69
69
  event_class: Decidim::Initiatives::MilestoneCompletedEvent,
70
70
  resource: @initiative,
71
- recipient_ids: @initiative.followers.pluck(:id),
71
+ affected_users: [@initiative.author],
72
+ followers: @initiative.followers - [@initiative.author],
72
73
  extra: {
73
74
  percentage: percentage
74
75
  }
@@ -15,6 +15,7 @@ module Decidim
15
15
  helper Decidim::IconHelper
16
16
  helper Decidim::Comments::CommentsHelper
17
17
  helper Decidim::Admin::IconLinkHelper
18
+ helper Decidim::ResourceReferenceHelper
18
19
  helper PaginateHelper
19
20
  helper InitiativeHelper
20
21
  include InitiativeSlug
@@ -55,7 +56,7 @@ module Decidim
55
56
  end
56
57
 
57
58
  def initiatives
58
- @initiatives = search.results.includes(:author, :scoped_type)
59
+ @initiatives = search.results.includes(:scoped_type)
59
60
  @initiatives = reorder(@initiatives)
60
61
  @initiatives = paginate(@initiatives)
61
62
  end
@@ -12,6 +12,10 @@ module Decidim
12
12
  def participatory_space
13
13
  resource
14
14
  end
15
+
16
+ def event_has_roles?
17
+ true
18
+ end
15
19
  end
16
20
  end
17
21
  end
@@ -16,6 +16,7 @@ module Decidim
16
16
  include Decidim::Loggable
17
17
  include Decidim::Initiatives::InitiativeSlug
18
18
  include Decidim::Resourceable
19
+ include Decidim::HasReference
19
20
 
20
21
  belongs_to :organization,
21
22
  foreign_key: "decidim_organization_id",
@@ -97,6 +98,14 @@ module Decidim
97
98
  end
98
99
  end
99
100
 
101
+ def self.future_spaces
102
+ none
103
+ end
104
+
105
+ def self.past_spaces
106
+ closed
107
+ end
108
+
100
109
  def self.log_presenter_class_for(_log)
101
110
  Decidim::Initiatives::AdminLog::InitiativePresenter
102
111
  end
@@ -23,5 +23,9 @@ module Decidim
23
23
  only_integer: true,
24
24
  greater_than: 0
25
25
  }
26
+
27
+ def scope_name
28
+ scope&.name.presence || I18n.t("decidim.initiatives.unavailable_scope")
29
+ end
26
30
  end
27
31
  end
@@ -15,7 +15,7 @@ module Decidim
15
15
 
16
16
  def base_query
17
17
  Decidim::Initiative
18
- .includes(:author, scoped_type: [:scope])
18
+ .includes(scoped_type: [:scope])
19
19
  .where(organization: options[:organization])
20
20
  end
21
21
 
@@ -44,12 +44,9 @@ module Decidim
44
44
  def search_type
45
45
  return query if type == "all"
46
46
 
47
- query
48
- .joins(:scoped_type)
49
- .where(
50
- "decidim_initiatives_type_scopes.decidim_initiatives_types_id IN (?)",
51
- type
52
- )
47
+ types = InitiativesTypeScope.where(decidim_initiatives_types_id: type).pluck(:id)
48
+
49
+ query.where(scoped_type: types)
53
50
  end
54
51
 
55
52
  def search_author
@@ -50,6 +50,7 @@
50
50
  <table class="table-list">
51
51
  <thead>
52
52
  <tr>
53
+ <th><%= t("models.initiatives.fields.id", scope: "decidim.admin") %></th>
53
54
  <th><%= t("models.initiatives.fields.title", scope: "decidim.admin") %></th>
54
55
  <th><%= t("models.initiatives.fields.state", scope: "decidim.admin") %></th>
55
56
  <th><%= t("models.initiatives.fields.supports_count", scope: "decidim.admin") %></th>
@@ -60,6 +61,7 @@
60
61
  <tbody>
61
62
  <% @initiatives.each do |initiative| %>
62
63
  <tr>
64
+ <td><%= initiative.id %></td>
63
65
  <td>
64
66
  <% if allowed_to? :edit, :initiative, initiative: initiative %>
65
67
  <%= link_to translated_attribute(initiative.title),
@@ -22,7 +22,7 @@
22
22
  <tbody>
23
23
  <% initiative_type.scopes.each do |s| %>
24
24
  <tr>
25
- <td><%= translated_attribute(s.scope.name) %></td>
25
+ <td><%= translated_attribute(s.scope_name) %></td>
26
26
  <td class="text-right"><%= s.supports_required %></td>
27
27
  <td class="table-list__actions">
28
28
  <%= icon_link_to "pencil",
@@ -1,5 +1,5 @@
1
1
  <% content_for :back_link do %>
2
- <%= link_to :back, class: "muted-link" do %>
2
+ <%= link_to :back do %>
3
3
  <%= icon "chevron-left", class: "icon--small" %>
4
4
  <%= t(".back") %>
5
5
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :back_link do %>
2
- <%= link_to :back, class: "muted-link" do %>
2
+ <%= link_to :back do %>
3
3
  <%= icon "chevron-left", class: "icon--small" %>
4
4
  <%= t(".back") %>
5
5
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :back_link do %>
2
- <%= link_to :back, class: "muted-link" do %>
2
+ <%= link_to :back do %>
3
3
  <%= icon "chevron-left", class: "icon--small" %>
4
4
  <%= t(".back") %>
5
5
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :back_link do %>
2
- <%= link_to :back, class: "muted-link" do %>
2
+ <%= link_to :back do %>
3
3
  <%= icon "chevron-left", class: "icon--small" %>
4
4
  <%= t(".back") %>
5
5
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :back_link do %>
2
- <%= link_to initiatives_path, class: "muted-link" do %>
2
+ <%= link_to initiatives_path do %>
3
3
  <%= icon "chevron-left", class: "icon--small" %>
4
4
  <%= t(".back") %>
5
5
  <% end %>
@@ -1,5 +1,5 @@
1
1
  <% content_for :back_link do %>
2
- <%= link_to :back, class: "muted-link" do %>
2
+ <%= link_to :back do %>
3
3
  <%= icon "chevron-left", class: "icon--small" %>
4
4
  <%= t(".back") %>
5
5
  <% end %>
@@ -7,7 +7,8 @@ edit_link(
7
7
  %>
8
8
 
9
9
  <% provide :meta_title, t("initiatives.index.title", scope: "decidim") %>
10
- <main class="wrapper">
10
+
11
+ <%= participatory_space_wrapper do %>
11
12
  <div class="row columns">
12
13
  <div class="title-action">
13
14
  <%= render partial: "index_header" %>
@@ -25,7 +26,7 @@ edit_link(
25
26
  <%= render partial: "initiatives" %>
26
27
  </div>
27
28
  </div>
28
- </main>
29
+ <% end %>
29
30
 
30
31
  <%= javascript_include_tag "decidim/filters" %>
31
32
  <%= javascript_include_tag "decidim/orders" %>
@@ -15,6 +15,8 @@ edit_link(
15
15
  )
16
16
  %>
17
17
 
18
+ <%= participatory_space_floating_help %>
19
+
18
20
  <% add_decidim_page_title(translated_attribute(current_initiative.title)) %>
19
21
  <% provide :meta_image_url, current_initiative.type.banner_image.url %>
20
22
  <div class="row">
@@ -42,7 +44,7 @@ edit_link(
42
44
  <% end %>
43
45
 
44
46
  <% if current_user %>
45
- <%= render partial: "decidim/shared/follow_button", locals: { followable: current_initiative } %>
47
+ <%= render partial: "decidim/shared/follow_button", locals: { followable: current_initiative, large: false } %>
46
48
  <% end %>
47
49
  </div>
48
50
  </div>
@@ -51,6 +53,7 @@ edit_link(
51
53
  <%= embed_modal_for initiative_initiative_widget_url(current_initiative, format: :js) %>
52
54
 
53
55
  <%= render partial: "statistics" %>
56
+ <%= resource_reference(current_initiative) %>
54
57
  </div>
55
58
 
56
59
  <div class="columns mediumlarge-8 mediumlarge-pull-4">
@@ -1,35 +1,37 @@
1
- <div class="process-header row column">
2
- <div class="row column process-header__main">
3
- <div class="initiative-creation-header__container row">
4
- <div class="columns mediumlarge-3">
1
+ <div class="process-header">
2
+ <div class="process-header__inner">
3
+ <div class="row column process-header__main">
4
+ </div>
5
+ <div class="process-header__container initiative-creation-header__container row collapse column">
6
+ <div class="columns mediumlarge-8 process-header__info">
5
7
  <% if content_for? :back_link %>
6
- <%= content_for :back_link %>
8
+ <%= content_for :back_link %>
7
9
  <% end %>
8
10
 
9
- <h2 class="section-heading"><%= t(".#{step}") %></h2>
11
+ <h1 class="text-highlight heading2"><%= t(".title") %></h1>
10
12
  </div>
11
- <div class="columns mediumlarge-6">
12
- <div class="initiative-creation-header__phase">
13
+ <div class="columns mediumlarge-4">
14
+ <div class="process-header__phase initiative-creation-header__phase">
13
15
  <div class="process-header__progress show-for-medium">
14
16
  <ol>
15
17
  <% wizard_steps.each do |wizard_step| %>
16
18
  <% unless future_step? wizard_step %>
17
19
  <li class="phase-item--past">
18
20
  <span></span>
19
- <div class="caption"><%= t ".#{wizard_step}" %></div>
20
21
  </li>
21
22
  <% else %>
22
23
  <li>
23
24
  <span></span>
24
- <div class="caption"><%= t ".#{wizard_step}" %></div>
25
25
  </li>
26
26
  <% end %>
27
27
  <% end %>
28
+ <% step_index = wizard_steps.index(step) %>
28
29
  </ol>
30
+ <span class="phase-current"><%= t(".step", current: (step_index + 1), total: wizard_steps.length) %></span>
31
+ <span class="phase-title"><%= t(".#{step}") %></span>
29
32
  </div>
30
33
  </div>
31
34
  </div>
32
- <div class="columns mediumlarge-3"></div>
33
35
  </div>
34
36
  </div>
35
37
  </div>
@@ -1,8 +1,10 @@
1
- <div class="process-header row column">
2
- <div class="row column process-header__main"
3
- style="background-image:url(<%= current_participatory_space.type.banner_image.url %>);">
4
- <div class="process-header__container row">
5
- <div class="columns mediumlarge-9 process-header__info">
1
+ <div class="process-header">
2
+ <div class="process-header__inner">
3
+ <div class="row column process-header__main"
4
+ style="background-image:url(<%= current_participatory_space.type.banner_image.url %>);">
5
+ </div>
6
+ <div class="process-header__container row collapse column">
7
+ <div class="columns mediumlarge-8 process-header__info">
6
8
  <div>
7
9
  <h1 class="text-highlight heading2">
8
10
  <%= participatory_space_helpers.translated_attribute(current_participatory_space.title) %>
@@ -22,44 +24,23 @@
22
24
  <%= render partial: "layouts/decidim/initiative_header_steps", locals: { initiative: current_participatory_space } %>
23
25
  </div>
24
26
  </div>
25
- <% if current_participatory_space.components.any? %>
26
- <div class="row column">
27
- <div class="process-nav">
28
- <button class="process-nav__trigger hide-for-medium" data-toggle="process-nav-content">
29
- <%= icon "caret-bottom", class: "icon--small process-nav__trigger__icon", aria_label: t(".unfold"), role: "img" %>
30
- <div class="process-nav__link">
31
- <% if self.try(:current_component) %>
32
- <%= component_icon(current_component) %>
33
- <%= translated_attribute(current_component.name) %>
34
- <% else %>
35
- <%= icon "chat" %>
36
- <%= t ".initiative_menu_item" %>
37
- <% end %>
38
- </div>
39
- </button>
40
- <div class="row column process-nav__content is-active" id="process-nav-content" data-toggler=".is-active">
41
- <ul>
42
- <li class="<%= "is-active" if is_active_link?(decidim_initiatives.initiative_path(current_participatory_space), :exclusive) %>">
43
- <%= active_link_to decidim_initiatives.initiative_path(current_participatory_space), active: :exclusive, class: "process-nav__link", class_active: "is-active" do %>
44
- <%= icon "chat" %>
45
- <%= t ".initiative_menu_item" %>
46
- <% end %>
47
- </li>
48
-
49
- <% current_participatory_space.components.each do |component| %>
50
- <% if component.published? || component == self.try(:current_component) %>
51
- <li class="<%= "is-active" if is_active_link?(main_component_path(component), :inclusive) %>">
52
- <%= active_link_to main_component_path(component), class: "process-nav__link", active: :inclusive, class_active: "is-active" do %>
53
- <%= component_icon(component) %>
27
+ <%
28
+ components = current_participatory_space.components.published.or(Decidim::Component.where(id: self.try(:current_component)))
29
+ %>
54
30
 
55
- <%= translated_attribute(component.name) %>
56
- <% end %>
57
- </li>
58
- <% end %>
59
- <% end %>
60
- </ul>
61
- </div>
62
- </div>
63
- </div>
64
- <% end %>
31
+ <%=
32
+ extended_navigation_bar([
33
+ {
34
+ name: t(".initiative_menu_item"),
35
+ url: decidim_initiatives.initiative_path(current_participatory_space),
36
+ active: is_active_link?(decidim_initiatives.initiative_path(current_participatory_space), :exclusive)
37
+ }
38
+ ] + components.map do |component|
39
+ {
40
+ name: translated_attribute(component.name),
41
+ url: main_component_path(component),
42
+ active: is_active_link?(main_component_path(component), :inclusive)
43
+ }
44
+ end)
45
+ %>
65
46
  </div>
@@ -1,12 +1,6 @@
1
1
  <% if initiative.has_signature_interval_defined? %>
2
- <div class="columns mediumlarge-3">
2
+ <div class="columns mediumlarge-4">
3
3
  <div class="process-header__phase">
4
- <div class="process-header__progress show-for-medium">
5
- <ol>
6
- <li><span></span></li>
7
- </ol>
8
- <span class="phase-current"><!-- Step 1 of 1 --></span>
9
- </div>
10
4
  <div>
11
5
  <span class="phase-title"><!-- Step name --></span>
12
6
  <span class="phase-date">
@@ -1,15 +1,15 @@
1
1
  <%= render "layouts/decidim/application" do %>
2
- <div class="wrapper">
3
- <%= render partial: "layouts/decidim/initiative_header" %>
4
- <%= yield %>
5
- </div>
6
- <% if content_for? :expanded %>
7
- <div class="expanded">
8
- <div class="wrapper wrapper--inner">
9
- <div class="row">
10
- <%= yield :expanded %>
11
- </div>
12
- </div>
2
+ <%= render partial: "layouts/decidim/initiative_header" %>
3
+ <div class="wrapper">
4
+ <%= yield %>
5
+ </div>
6
+ <% if content_for? :expanded %>
7
+ <div class="expanded">
8
+ <div class="wrapper wrapper--inner">
9
+ <div class="row">
10
+ <%= yield :expanded %>
13
11
  </div>
14
- <% end %>
12
+ </div>
13
+ </div>
14
+ <% end %>
15
15
  <% end %>