decidim-assemblies 0.19.0 → 0.22.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (123) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/images/decidim/assemblies/assembly.svg +1 -3
  3. data/app/assets/javascripts/decidim/assemblies/orgchart.js.es6 +698 -0
  4. data/app/cells/decidim/assemblies/assembly_m/footer.erb +2 -2
  5. data/app/cells/decidim/assemblies/assembly_m_cell.rb +5 -5
  6. data/app/cells/decidim/assemblies/assembly_member/show.erb +4 -4
  7. data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies/show.erb +10 -11
  8. data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb +1 -0
  9. data/app/commands/decidim/assemblies/admin/create_assemblies_type.rb +45 -0
  10. data/app/commands/decidim/assemblies/admin/create_assembly.rb +1 -2
  11. data/app/commands/decidim/assemblies/admin/create_assembly_admin.rb +2 -1
  12. data/app/commands/decidim/assemblies/admin/create_assembly_member.rb +12 -3
  13. data/app/commands/decidim/assemblies/admin/destroy_assemblies_type.rb +45 -0
  14. data/app/commands/decidim/assemblies/admin/notify_role_assigned_to_assembly.rb +22 -0
  15. data/app/commands/decidim/assemblies/admin/update_assemblies_setting.rb +46 -0
  16. data/app/commands/decidim/assemblies/admin/update_assemblies_type.rb +46 -0
  17. data/app/commands/decidim/assemblies/admin/update_assembly.rb +1 -2
  18. data/app/commands/decidim/assemblies/admin/update_assembly_admin.rb +2 -1
  19. data/app/controllers/concerns/decidim/assemblies/admin/filterable.rb +30 -0
  20. data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +8 -29
  21. data/app/controllers/decidim/assemblies/admin/assemblies_settings_controller.rb +49 -0
  22. data/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb +107 -0
  23. data/app/controllers/decidim/assemblies/assemblies_controller.rb +6 -2
  24. data/app/events/decidim/assemblies/create_assembly_member_event.rb +17 -0
  25. data/app/events/decidim/role_assigned_to_assembly_event.rb +28 -0
  26. data/app/forms/decidim/assemblies/admin/assemblies_setting_form.rb +14 -0
  27. data/app/forms/decidim/assemblies/admin/assemblies_type_form.rb +17 -0
  28. data/app/forms/decidim/assemblies/admin/assembly_form.rb +32 -13
  29. data/app/helpers/decidim/assemblies/admin/assemblies_helper.rb +6 -0
  30. data/app/helpers/decidim/assemblies/assemblies_helper.rb +6 -3
  31. data/app/helpers/decidim/assemblies/filter_assemblies_helper.rb +10 -7
  32. data/app/models/decidim/assemblies_setting.rb +17 -0
  33. data/app/models/decidim/assemblies_type.rb +24 -0
  34. data/app/models/decidim/assembly.rb +25 -2
  35. data/app/models/decidim/assembly_user_role.rb +1 -1
  36. data/app/permissions/decidim/assemblies/permissions.rb +55 -1
  37. data/app/presenters/decidim/assemblies/admin_log/assemblies_setting_presenter.rb +27 -0
  38. data/app/presenters/decidim/assemblies/admin_log/assemblies_type_presenter.rb +43 -0
  39. data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +1 -2
  40. data/app/presenters/decidim/assemblies/assembly_stats_presenter.rb +1 -1
  41. data/app/presenters/decidim/log/value_types/assembly_type_presenter.rb +29 -0
  42. data/app/queries/decidim/assemblies/filtered_assemblies.rb +2 -2
  43. data/app/queries/decidim/assemblies/parent_assemblies_for_select.rb +42 -0
  44. data/app/services/decidim/assemblies/assembly_search.rb +3 -3
  45. data/app/types/decidim/assemblies/assemblies_type_type.rb +17 -0
  46. data/app/types/decidim/assemblies/assembly_member_type.rb +29 -0
  47. data/app/types/decidim/assemblies/assembly_type.rb +67 -0
  48. data/app/views/decidim/assemblies/_filter_by_type.html.erb +11 -7
  49. data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +2 -6
  50. data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +8 -4
  51. data/app/views/decidim/assemblies/admin/assemblies_settings/_form.html.erb +10 -0
  52. data/app/views/decidim/assemblies/admin/assemblies_settings/edit.html.erb +6 -0
  53. data/app/views/decidim/assemblies/admin/assemblies_types/_form.html.erb +11 -0
  54. data/app/views/decidim/assemblies/admin/assemblies_types/edit.html.erb +6 -0
  55. data/app/views/decidim/assemblies/admin/assemblies_types/index.html.erb +43 -0
  56. data/app/views/decidim/assemblies/admin/assemblies_types/new.html.erb +7 -0
  57. data/app/views/decidim/assemblies/admin/assembly_members/index.html.erb +30 -30
  58. data/app/views/decidim/assemblies/assemblies/_parent_assemblies.html.erb +2 -2
  59. data/app/views/decidim/assemblies/assemblies/_promoted_assembly.html.erb +3 -3
  60. data/app/views/decidim/assemblies/assemblies/index.html.erb +11 -8
  61. data/app/views/decidim/assemblies/assemblies/show.html.erb +10 -13
  62. data/app/views/decidim/assemblies/assembly_members/index.html.erb +1 -1
  63. data/app/views/layouts/decidim/admin/assemblies.html.erb +22 -0
  64. data/app/views/layouts/decidim/admin/assembly.html.erb +2 -2
  65. data/config/locales/ar.yml +60 -27
  66. data/config/locales/bg-BG.yml +7 -0
  67. data/config/locales/ca.yml +79 -1
  68. data/config/locales/cs.yml +125 -47
  69. data/config/locales/da-DK.yml +1 -0
  70. data/config/locales/de.yml +80 -0
  71. data/config/locales/el-GR.yml +1 -0
  72. data/config/locales/el.yml +456 -0
  73. data/config/locales/en.yml +78 -0
  74. data/config/locales/es-MX.yml +79 -0
  75. data/config/locales/es-PY.yml +79 -0
  76. data/config/locales/es.yml +78 -0
  77. data/config/locales/et-EE.yml +1 -0
  78. data/config/locales/eu.yml +11 -0
  79. data/config/locales/fi-plain.yml +78 -0
  80. data/config/locales/fi.yml +81 -3
  81. data/config/locales/fr-CA.yml +456 -0
  82. data/config/locales/fr.yml +78 -0
  83. data/config/locales/ga-IE.yml +1 -0
  84. data/config/locales/gl.yml +11 -0
  85. data/config/locales/hr-HR.yml +1 -0
  86. data/config/locales/hu.yml +67 -2
  87. data/config/locales/id-ID.yml +11 -0
  88. data/config/locales/is-IS.yml +263 -0
  89. data/config/locales/it.yml +181 -102
  90. data/config/locales/ja-JP.yml +452 -0
  91. data/config/locales/lt-LT.yml +1 -0
  92. data/config/locales/lv-LV.yml +454 -0
  93. data/config/locales/mt-MT.yml +1 -0
  94. data/config/locales/nl.yml +86 -8
  95. data/config/locales/no.yml +451 -0
  96. data/config/locales/pl.yml +222 -142
  97. data/config/locales/pt-BR.yml +12 -1
  98. data/config/locales/pt.yml +198 -118
  99. data/config/locales/ro-RO.yml +422 -0
  100. data/config/locales/ru.yml +11 -0
  101. data/config/locales/sk-SK.yml +168 -0
  102. data/config/locales/sk.yml +172 -0
  103. data/config/locales/sl.yml +132 -0
  104. data/config/locales/sr-CS.yml +73 -0
  105. data/config/locales/sv.yml +167 -88
  106. data/config/locales/tr-TR.yml +11 -0
  107. data/config/locales/uk.yml +11 -0
  108. data/db/migrate/20200108113855_create_decidim_assembly_types.rb +19 -0
  109. data/db/migrate/20200108123050_migrate_decidim_assembly_types.rb +83 -0
  110. data/db/migrate/20200320105906_index_foreign_keys_in_decidim_assemblies.rb +7 -0
  111. data/db/migrate/20200320105907_index_foreign_keys_in_decidim_assembly_user_roles.rb +7 -0
  112. data/db/migrate/20200416132109_remove_legacy_decidim_assembly_type.rb +8 -0
  113. data/db/migrate/20200430202456_create_decidim_assemblies_settings.rb +10 -0
  114. data/db/seeds/city.jpeg +0 -0
  115. data/db/seeds/city2.jpeg +0 -0
  116. data/lib/decidim/assemblies/admin_engine.rb +3 -0
  117. data/lib/decidim/assemblies/engine.rb +7 -0
  118. data/lib/decidim/assemblies/participatory_space.rb +11 -3
  119. data/lib/decidim/assemblies/query_extensions.rb +40 -0
  120. data/lib/decidim/assemblies/test/factories.rb +29 -2
  121. data/lib/decidim/assemblies/version.rb +1 -1
  122. metadata +62 -10
  123. data/app/views/decidim/assemblies/assembly_widgets/show.html.erb +0 -11
@@ -2,14 +2,14 @@
2
2
  <div class="card__support">
3
3
  <% if has_assembly_type? %>
4
4
  <div class="card__support__data--left">
5
- <div class="text-uppercase"><%= t("assemblies.show.assembly_type", scope: "decidim") %></div>
5
+ <div><%= t("assemblies.show.assembly_type", scope: "decidim") %></div>
6
6
  <div class="text-ellipsis"><strong><%= assembly_type %></strong></div>
7
7
  </div>
8
8
  <% end %>
9
9
  <%= link_to(
10
10
  t(model.cta_button_text_key, scope: "layouts.decidim.assemblies.assembly"),
11
11
  resource_path,
12
- class: "card__button button button--sc secondary light small"
12
+ class: "card__button button button--sc small"
13
13
  ) %>
14
14
  </div>
15
15
  </div>
@@ -36,6 +36,10 @@ module Decidim
36
36
  [:creation_date, :follow, :children_count]
37
37
  end
38
38
 
39
+ def creation_date_status
40
+ l(model.creation_date, format: :decidim_short) if model.creation_date
41
+ end
42
+
39
43
  def children_count_status
40
44
  content_tag(
41
45
  :strong,
@@ -64,11 +68,7 @@ module Decidim
64
68
  end
65
69
 
66
70
  def assembly_type
67
- if model.assembly_type == "others"
68
- translated_attribute(model.assembly_type_other)
69
- else
70
- t("assembly_types.#{model.assembly_type}", scope: "decidim.assemblies").to_s
71
- end
71
+ translated_attribute model.assembly_type.title
72
72
  end
73
73
  end
74
74
  end
@@ -1,5 +1,5 @@
1
1
  <div class="column">
2
- <article class="card card--member">
2
+ <div class="card card--member">
3
3
  <div class="card__content">
4
4
  <div class="card__header collapse">
5
5
  <div class="author-data author-data--big">
@@ -7,7 +7,7 @@
7
7
  <div class="author author--flex">
8
8
  <% if has_profile? %>
9
9
  <%= link_to profile_url, class: "author__avatar" do %>
10
- <%= image_tag model.avatar_url(:big) %>
10
+ <%= image_tag model.avatar_url(:big), alt: "member-avatar" %>
11
11
  <% end %>
12
12
  <div>
13
13
  <div class="author__name--container">
@@ -24,7 +24,7 @@
24
24
  <% end %>
25
25
  </div>
26
26
  <% else %>
27
- <div class="author__avatar"><%= image_tag asset_path("decidim/default-avatar.svg") %></div>
27
+ <div class="author__avatar"><%= image_tag asset_path("decidim/default-avatar.svg"), alt: "member-avatar" %></div>
28
28
  <div>
29
29
  <div class="author__name--container">
30
30
  <div class="author__name">
@@ -49,5 +49,5 @@
49
49
  <div class="text-small mt-s"><%= personal_information %></div>
50
50
  </div>
51
51
  </div>
52
- </article>
52
+ </div>
53
53
  </div>
@@ -1,4 +1,4 @@
1
- <section class="wrapper-home home-section">
1
+ <section class="wrapper-home home-section" xmlns="http://www.w3.org/1999/xhtml">
2
2
  <div class="row" id="highlighted-assemblies">
3
3
  <h3 class="section-heading"><%= t("active_assemblies", scope: i18n_scope) %></h3>
4
4
  <div class="row collapse">
@@ -6,17 +6,13 @@
6
6
  large-up-4 card-grid">
7
7
  <% highlighted_assemblies.each do |assembly| %>
8
8
  <div class="column">
9
- <article class="card card--assembly card--mini">
10
- <%= link_to decidim_assemblies.assembly_path(assembly), class: "card__link" do %>
11
- <div class="card__image-top"
12
- style="background-image:url(<%= assembly.hero_image.url %>)"></div>
13
- <% end %>
9
+ <%= link_to decidim_assemblies.assembly_path(assembly), class: "card card--assembly card--mini" do %>
10
+ <div aria-hidden="true" class="card__image-top"
11
+ style="background-image:url(<%= assembly.hero_image.url %>)"></div>
14
12
  <div class="card__content">
15
- <%= link_to decidim_assemblies.assembly_path(assembly), class: "card__link" do %>
16
- <h4 class="card__title"><%= translated_attribute assembly.title %></h4>
17
- <% end %>
13
+ <span class="card__title card__link"><%= translated_attribute assembly.title %></span>
18
14
  </div>
19
- </article>
15
+ <% end %>
20
16
  </div>
21
17
  <% end %>
22
18
  </div>
@@ -25,7 +21,10 @@
25
21
  <div class="row" id="see-all-assemblies">
26
22
  <div class="columns small-centered small-12
27
23
  smallmedium-8 medium-6 large-4">
28
- <%= link_to t("see_all_assemblies", scope: i18n_scope), decidim_assemblies.assemblies_path, class: "button expanded hollow button--sc home-section__cta" %>
24
+ <%= link_to t("see_all_assemblies", scope: i18n_scope),
25
+ decidim_assemblies.assemblies_path,
26
+ class: "button expanded hollow button--sc home-section__cta",
27
+ title: t("assemblies_button_title", scope: i18n_scope) %>
29
28
  </div>
30
29
  </div>
31
30
  </section>
@@ -18,6 +18,7 @@ module Decidim
18
18
  @highlighted_assemblies ||= OrganizationPrioritizedAssemblies
19
19
  .new(current_organization, current_user)
20
20
  .query
21
+ .includes([:organization])
21
22
  .limit(max_results)
22
23
  end
23
24
 
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module Admin
6
+ # A command with all the business logic when creating a new assembly
7
+ # type in the system.
8
+ class CreateAssembliesType < Rectify::Command
9
+ # Public: Initializes the command.
10
+ #
11
+ # form - A form object with the params.
12
+ def initialize(form)
13
+ @form = form
14
+ end
15
+
16
+ # Executes the command. Broadcasts these events:
17
+ #
18
+ # - :ok when everything is valid.
19
+ # - :invalid if the form wasn't valid and we couldn't proceed.
20
+ #
21
+ # Returns nothing.
22
+ def call
23
+ return broadcast(:invalid) if form.invalid?
24
+
25
+ create_assemblies_type!
26
+
27
+ broadcast(:ok)
28
+ end
29
+
30
+ private
31
+
32
+ attr_reader :form
33
+
34
+ def create_assemblies_type!
35
+ Decidim.traceability.create!(
36
+ AssembliesType,
37
+ form.current_user,
38
+ organization: form.current_organization,
39
+ title: form.title
40
+ )
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -67,7 +67,6 @@ module Decidim
67
67
  purpose_of_action: form.purpose_of_action,
68
68
  composition: form.composition,
69
69
  assembly_type: form.assembly_type,
70
- assembly_type_other: form.assembly_type_other,
71
70
  creation_date: form.creation_date,
72
71
  created_by: form.created_by,
73
72
  created_by_other: form.created_by_other,
@@ -104,7 +103,7 @@ module Decidim
104
103
  end
105
104
 
106
105
  def link_participatory_processes(assembly)
107
- assembly.link_participatory_spaces_resources(participatory_processes(assembly), "included_participatory_processes")
106
+ assembly.link_participatory_space_resources(participatory_processes(assembly), "included_participatory_processes")
108
107
  end
109
108
  end
110
109
  end
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # A command with all the business logic when creating a new participatory
7
7
  # process admin in the system.
8
- class CreateAssemblyAdmin < Rectify::Command
8
+ class CreateAssemblyAdmin < NotifyRoleAssignedToAssembly
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # form - A form object with the params.
@@ -57,6 +57,7 @@ module Decidim
57
57
  assembly: @assembly
58
58
  )
59
59
  end
60
+ send_notification user
60
61
  end
61
62
 
62
63
  def existing_user
@@ -25,9 +25,8 @@ module Decidim
25
25
  def call
26
26
  return broadcast(:invalid) if form.invalid?
27
27
 
28
- transaction do
29
- create_assembly_member!
30
- end
28
+ create_assembly_member!
29
+ notify_assembly_member_about_new_membership
31
30
 
32
31
  broadcast(:ok)
33
32
  end
@@ -67,6 +66,16 @@ module Decidim
67
66
  log_info
68
67
  )
69
68
  end
69
+
70
+ def notify_assembly_member_about_new_membership
71
+ data = {
72
+ event: "decidim.events.assemblies.create_assembly_member",
73
+ event_class: Decidim::Assemblies::CreateAssemblyMemberEvent,
74
+ resource: assembly,
75
+ followers: [form.user]
76
+ }
77
+ Decidim::EventsManager.publish(data)
78
+ end
70
79
  end
71
80
  end
72
81
  end
@@ -0,0 +1,45 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module Admin
6
+ # A command with all the business logic when destroying an assembly
7
+ # type in the system.
8
+ class DestroyAssembliesType < Rectify::Command
9
+ # Public: Initializes the command.
10
+ #
11
+ # assemblies_type - the AssemblyMember to destroy
12
+ # current_user - the user performing the action
13
+ def initialize(assemblies_type, current_user)
14
+ @assemblies_type = assemblies_type
15
+ @current_user = current_user
16
+ end
17
+
18
+ # Executes the command. Broadcasts these events:
19
+ #
20
+ # - :ok when everything is valid.
21
+ # - :invalid if the form wasn't valid and we couldn't proceed.
22
+ #
23
+ # Returns nothing.
24
+ def call
25
+ destroy_assembly_type!
26
+ broadcast(:ok)
27
+ end
28
+
29
+ private
30
+
31
+ attr_reader :current_user
32
+
33
+ def destroy_assembly_type!
34
+ Decidim.traceability.perform_action!(
35
+ "delete",
36
+ @assemblies_type,
37
+ current_user
38
+ ) do
39
+ @assemblies_type.destroy!
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
45
+ end
@@ -0,0 +1,22 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module Admin
6
+ # A command to notify users when a role is assigned for an assembly
7
+ class NotifyRoleAssignedToAssembly < Rectify::Command
8
+ def send_notification(user)
9
+ Decidim::EventsManager.publish(
10
+ event: "decidim.events.assembly.role_assigned",
11
+ event_class: Decidim::RoleAssignedToAssemblyEvent,
12
+ resource: form.current_participatory_space,
13
+ affected_users: [user],
14
+ extra: {
15
+ role: form.role
16
+ }
17
+ )
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module Admin
6
+ # A command with all the business logic when updating assemblies
7
+ # settings in admin area.
8
+ class UpdateAssembliesSetting < Rectify::Command
9
+ # Public: Initializes the command.
10
+ #
11
+ # assemblies_setting - A assemblies_setting object to update.
12
+ # form - A form object with the params.
13
+ def initialize(assemblies_settings, form)
14
+ @assemblies_settings = assemblies_settings
15
+ @form = form
16
+ end
17
+
18
+ # Executes the command. Broadcasts these events:
19
+ #
20
+ # - :ok when everything is valid.
21
+ # - :invalid if the form or assemblies_settings isn't valid and we couldn't proceed.
22
+ #
23
+ # Returns nothing.
24
+ def call
25
+ return broadcast(:invalid) if form.invalid? || assemblies_settings.invalid?
26
+
27
+ update_assemblies_setting!
28
+
29
+ broadcast(:ok)
30
+ end
31
+
32
+ private
33
+
34
+ attr_reader :form, :assemblies_settings
35
+
36
+ def update_assemblies_setting!
37
+ Decidim.traceability.update!(
38
+ @assemblies_settings,
39
+ form.current_user,
40
+ enable_organization_chart: form.enable_organization_chart
41
+ )
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module Admin
6
+ # A command with all the business logic when updating a new assembly
7
+ # type in the system.
8
+ class UpdateAssembliesType < Rectify::Command
9
+ # Public: Initializes the command.
10
+ #
11
+ # assemblies_type - A assemblies_type object to update.
12
+ # form - A form object with the params.
13
+ def initialize(assemblies_type, form)
14
+ @assemblies_type = assemblies_type
15
+ @form = form
16
+ end
17
+
18
+ # Executes the command. Broadcasts these events:
19
+ #
20
+ # - :ok when everything is valid.
21
+ # - :invalid if the form wasn't valid and we couldn't proceed.
22
+ #
23
+ # Returns nothing.
24
+ def call
25
+ return broadcast(:invalid) if form.invalid?
26
+
27
+ update_assemblies_type!
28
+
29
+ broadcast(:ok)
30
+ end
31
+
32
+ private
33
+
34
+ attr_reader :form
35
+
36
+ def update_assemblies_type!
37
+ Decidim.traceability.update!(
38
+ @assemblies_type,
39
+ form.current_user,
40
+ title: form.title
41
+ )
42
+ end
43
+ end
44
+ end
45
+ end
46
+ end
@@ -84,7 +84,6 @@ module Decidim
84
84
  purpose_of_action: form.purpose_of_action,
85
85
  composition: form.composition,
86
86
  assembly_type: form.assembly_type,
87
- assembly_type_other: form.assembly_type_other,
88
87
  creation_date: form.creation_date,
89
88
  created_by: form.created_by,
90
89
  created_by_other: form.created_by_other,
@@ -108,7 +107,7 @@ module Decidim
108
107
  end
109
108
 
110
109
  def link_participatory_processes(assembly)
111
- assembly.link_participatory_spaces_resources(participatory_processes(assembly), "included_participatory_processes")
110
+ assembly.link_participatory_space_resources(participatory_processes(assembly), "included_participatory_processes")
112
111
  end
113
112
 
114
113
  # Resets the children counter cache to its correct value using an SQL count query.
@@ -5,7 +5,7 @@ module Decidim
5
5
  module Admin
6
6
  # A command with all the business logic when updated a participatory
7
7
  # process admin in the system.
8
- class UpdateAssemblyAdmin < Rectify::Command
8
+ class UpdateAssemblyAdmin < NotifyRoleAssignedToAssembly
9
9
  # Public: Initializes the command.
10
10
  #
11
11
  # form - A form object with the params.
@@ -45,6 +45,7 @@ module Decidim
45
45
  { role: form.role },
46
46
  log_info
47
47
  )
48
+ send_notification user_role.user
48
49
  end
49
50
  end
50
51
  end
@@ -0,0 +1,30 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "active_support/concern"
4
+
5
+ module Decidim
6
+ module Assemblies
7
+ module Admin
8
+ module Filterable
9
+ extend ActiveSupport::Concern
10
+
11
+ included do
12
+ include Decidim::Admin::Filterable
13
+
14
+ private
15
+
16
+ # Unless we are explicitly looking for child assemblies, we filter them out.
17
+ def base_query
18
+ return collection if ransack_params[:parent_id_eq]
19
+
20
+ collection.parent_assemblies
21
+ end
22
+
23
+ def extra_filters
24
+ [:parent_id_eq]
25
+ end
26
+ end
27
+ end
28
+ end
29
+ end
30
+ end