decidim-assemblies 0.27.9 → 0.28.0.rc4

Sign up to get free protection for your applications and to get access to all the features.
Files changed (198) hide show
  1. checksums.yaml +4 -4
  2. data/app/cells/decidim/assemblies/assemblies/show.erb +16 -0
  3. data/app/cells/decidim/assemblies/assemblies_cell.rb +24 -0
  4. data/app/cells/decidim/assemblies/assembly_cell.rb +7 -2
  5. data/app/cells/decidim/assemblies/assembly_dropdown_metadata_cell.rb +19 -0
  6. data/app/cells/decidim/assemblies/assembly_g_cell.rb +23 -0
  7. data/app/cells/decidim/assemblies/assembly_member/data.erb +19 -0
  8. data/app/cells/decidim/assemblies/assembly_member/name_and_position.erb +11 -0
  9. data/app/cells/decidim/assemblies/assembly_member/show.erb +8 -52
  10. data/app/cells/decidim/assemblies/assembly_metadata_g_cell.rb +46 -0
  11. data/app/cells/decidim/assemblies/assembly_s_cell.rb +15 -0
  12. data/app/cells/decidim/assemblies/content_block_cell.rb +21 -0
  13. data/app/cells/decidim/assemblies/content_blocks/children_assemblies_cell.rb +27 -0
  14. data/app/cells/decidim/assemblies/content_blocks/dates_metadata_cell.rb +23 -0
  15. data/app/cells/decidim/assemblies/content_blocks/extra_data_cell.rb +39 -0
  16. data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_cell.rb +15 -23
  17. data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies_settings_form/show.erb +1 -1
  18. data/app/cells/decidim/assemblies/content_blocks/main_data_cell.rb +52 -0
  19. data/app/cells/decidim/assemblies/content_blocks/metadata_cell.rb +23 -0
  20. data/app/cells/decidim/assemblies/content_blocks/related_assemblies/content.erb +1 -0
  21. data/app/cells/decidim/assemblies/content_blocks/related_assemblies_cell.rb +34 -0
  22. data/app/cells/decidim/assemblies/content_blocks/stats_cell.rb +15 -0
  23. data/app/commands/decidim/assemblies/admin/copy_assembly.rb +2 -2
  24. data/app/commands/decidim/assemblies/admin/create_assemblies_type.rb +1 -1
  25. data/app/commands/decidim/assemblies/admin/create_assembly.rb +2 -1
  26. data/app/commands/decidim/assemblies/admin/create_assembly_member.rb +3 -3
  27. data/app/commands/decidim/assemblies/admin/destroy_assemblies_type.rb +1 -1
  28. data/app/commands/decidim/assemblies/admin/destroy_assembly_member.rb +1 -1
  29. data/app/commands/decidim/assemblies/admin/import_assembly.rb +1 -1
  30. data/app/commands/decidim/assemblies/admin/update_assemblies_type.rb +1 -1
  31. data/app/commands/decidim/assemblies/admin/update_assembly.rb +1 -1
  32. data/app/commands/decidim/assemblies/admin/update_assembly_member.rb +1 -1
  33. data/app/constraints/decidim/assemblies/current_assembly.rb +1 -1
  34. data/app/controllers/concerns/decidim/assemblies/admin/assembly_context.rb +1 -1
  35. data/app/controllers/concerns/decidim/assemblies/admin/assembly_members/filterable.rb +39 -0
  36. data/app/controllers/concerns/decidim/assemblies/assembly_breadcrumb.rb +36 -0
  37. data/app/controllers/decidim/assemblies/admin/assemblies_controller.rb +1 -0
  38. data/app/controllers/decidim/assemblies/admin/assemblies_types_controller.rb +1 -1
  39. data/app/controllers/decidim/assemblies/admin/assembly_attachment_collections_controller.rb +5 -0
  40. data/app/controllers/decidim/assemblies/admin/assembly_attachments_controller.rb +5 -0
  41. data/app/controllers/decidim/assemblies/admin/assembly_imports_controller.rb +2 -0
  42. data/app/controllers/decidim/assemblies/admin/assembly_landing_page_content_blocks_controller.rb +35 -0
  43. data/app/controllers/decidim/assemblies/admin/assembly_landing_page_controller.rb +37 -0
  44. data/app/controllers/decidim/assemblies/admin/assembly_members_controller.rb +2 -6
  45. data/app/controllers/decidim/assemblies/admin/assembly_publications_controller.rb +9 -29
  46. data/app/controllers/decidim/assemblies/admin/assembly_user_roles_controller.rb +8 -91
  47. data/app/controllers/decidim/assemblies/admin/concerns/assembly_admin.rb +1 -1
  48. data/app/controllers/decidim/assemblies/assemblies_controller.rb +12 -7
  49. data/app/controllers/decidim/assemblies/assembly_members_controller.rb +2 -0
  50. data/app/events/decidim/assemblies/create_assembly_member_event.rb +1 -1
  51. data/app/events/decidim/role_assigned_to_assembly_event.rb +11 -6
  52. data/app/forms/decidim/assemblies/admin/assembly_copy_form.rb +1 -1
  53. data/app/forms/decidim/assemblies/admin/assembly_form.rb +1 -1
  54. data/app/forms/decidim/assemblies/admin/assembly_import_form.rb +1 -1
  55. data/app/forms/decidim/assemblies/admin/assembly_user_role_form.rb +2 -18
  56. data/app/helpers/decidim/assemblies/admin/assembly_members_helper.rb +11 -0
  57. data/app/helpers/decidim/assemblies/application_helper.rb +12 -0
  58. data/app/helpers/decidim/assemblies/assemblies_helper.rb +21 -19
  59. data/app/helpers/decidim/assemblies/filter_assemblies_helper.rb +15 -30
  60. data/app/models/decidim/assembly.rb +6 -5
  61. data/app/models/decidim/assembly_user_role.rb +5 -33
  62. data/app/packs/entrypoints/decidim_assemblies.js +0 -1
  63. data/app/packs/src/decidim/assemblies/admin/assemblies.js +2 -2
  64. data/app/packs/src/decidim/assemblies/orgchart.js +0 -701
  65. data/app/permissions/decidim/assemblies/permissions.rb +14 -27
  66. data/app/presenters/decidim/assemblies/admin_log/assemblies_setting_presenter.rb +2 -2
  67. data/app/presenters/decidim/assemblies/admin_log/assemblies_type_presenter.rb +2 -2
  68. data/app/presenters/decidim/assemblies/admin_log/assembly_member_presenter.rb +2 -2
  69. data/app/presenters/decidim/assemblies/admin_log/assembly_presenter.rb +2 -2
  70. data/app/presenters/decidim/assemblies/admin_log/assembly_user_role_presenter.rb +2 -2
  71. data/app/presenters/decidim/assemblies/assembly_presenter.rb +38 -0
  72. data/app/presenters/decidim/assemblies/assembly_stats_presenter.rb +2 -41
  73. data/app/presenters/decidim/assembly_member_presenter.rb +18 -4
  74. data/app/queries/decidim/assemblies/admin/admin_users.rb +1 -1
  75. data/app/queries/decidim/assemblies/assemblies_with_user_role.rb +2 -2
  76. data/app/serializers/decidim/assemblies/assembly_importer.rb +3 -3
  77. data/app/serializers/decidim/assemblies/assembly_serializer.rb +1 -1
  78. data/app/views/decidim/assemblies/admin/assemblies/_form.html.erb +218 -176
  79. data/app/views/decidim/assemblies/admin/assemblies/edit.html.erb +25 -11
  80. data/app/views/decidim/assemblies/admin/assemblies/index.html.erb +105 -115
  81. data/app/views/decidim/assemblies/admin/assemblies/new.html.erb +16 -9
  82. data/app/views/decidim/assemblies/admin/assemblies_types/_form.html.erb +6 -8
  83. data/app/views/decidim/assemblies/admin/assemblies_types/edit.html.erb +11 -5
  84. data/app/views/decidim/assemblies/admin/assemblies_types/index.html.erb +34 -35
  85. data/app/views/decidim/assemblies/admin/assemblies_types/new.html.erb +16 -6
  86. data/app/views/decidim/assemblies/admin/assembly_copies/_form.html.erb +12 -20
  87. data/app/views/decidim/assemblies/admin/assembly_copies/new.html.erb +17 -5
  88. data/app/views/decidim/assemblies/admin/assembly_imports/_form.html.erb +28 -37
  89. data/app/views/decidim/assemblies/admin/assembly_imports/new.html.erb +17 -5
  90. data/app/views/decidim/assemblies/admin/assembly_members/_form.html.erb +45 -49
  91. data/app/views/decidim/assemblies/admin/assembly_members/edit.html.erb +17 -6
  92. data/app/views/decidim/assemblies/admin/assembly_members/index.html.erb +51 -88
  93. data/app/views/decidim/assemblies/admin/assembly_members/new.html.erb +17 -6
  94. data/app/views/decidim/assemblies/admin/assembly_user_roles/_form.html.erb +14 -18
  95. data/app/views/decidim/assemblies/admin/assembly_user_roles/edit.html.erb +17 -6
  96. data/app/views/decidim/assemblies/admin/assembly_user_roles/index.html.erb +54 -55
  97. data/app/views/decidim/assemblies/admin/assembly_user_roles/new.html.erb +17 -6
  98. data/app/views/decidim/assemblies/assemblies/_collection.html.erb +7 -0
  99. data/app/views/decidim/assemblies/assemblies/index.html.erb +20 -19
  100. data/app/views/decidim/assemblies/assemblies/index.js.erb +1 -8
  101. data/app/views/decidim/assemblies/assemblies/show.html.erb +17 -207
  102. data/app/views/decidim/assemblies/assembly_members/index.html.erb +7 -5
  103. data/app/views/decidim/assemblies/pages/user_profile/_member_of.html.erb +6 -9
  104. data/app/views/layouts/decidim/admin/_manage_assemblies.html.erb +36 -0
  105. data/app/views/layouts/decidim/admin/assemblies.html.erb +13 -11
  106. data/app/views/layouts/decidim/admin/assemblies_imports.html.erb +9 -0
  107. data/app/views/layouts/decidim/admin/assemblies_types.html.erb +17 -0
  108. data/app/views/layouts/decidim/admin/assembly.html.erb +12 -13
  109. data/app/views/layouts/decidim/assembly.html.erb +7 -14
  110. data/config/locales/ar.yml +7 -68
  111. data/config/locales/bg.yml +0 -466
  112. data/config/locales/ca.yml +62 -71
  113. data/config/locales/cs.yml +59 -66
  114. data/config/locales/de.yml +60 -69
  115. data/config/locales/el.yml +11 -61
  116. data/config/locales/en.yml +57 -66
  117. data/config/locales/es-MX.yml +57 -66
  118. data/config/locales/es-PY.yml +57 -66
  119. data/config/locales/es.yml +63 -72
  120. data/config/locales/eu.yml +57 -70
  121. data/config/locales/fi-plain.yml +58 -67
  122. data/config/locales/fi.yml +57 -66
  123. data/config/locales/fr-CA.yml +57 -66
  124. data/config/locales/fr.yml +57 -66
  125. data/config/locales/ga-IE.yml +4 -15
  126. data/config/locales/gl.yml +4 -62
  127. data/config/locales/hu.yml +33 -65
  128. data/config/locales/id-ID.yml +6 -47
  129. data/config/locales/is-IS.yml +5 -40
  130. data/config/locales/it.yml +5 -62
  131. data/config/locales/ja.yml +51 -66
  132. data/config/locales/kaa.yml +0 -8
  133. data/config/locales/ko.yml +0 -92
  134. data/config/locales/lb.yml +5 -61
  135. data/config/locales/lt.yml +40 -63
  136. data/config/locales/lv.yml +5 -57
  137. data/config/locales/nl.yml +4 -62
  138. data/config/locales/no.yml +5 -62
  139. data/config/locales/pl.yml +3 -93
  140. data/config/locales/pt-BR.yml +77 -132
  141. data/config/locales/pt.yml +5 -62
  142. data/config/locales/ro-RO.yml +20 -63
  143. data/config/locales/ru.yml +4 -44
  144. data/config/locales/sk.yml +0 -26
  145. data/config/locales/sl.yml +5 -48
  146. data/config/locales/sq-AL.yml +0 -364
  147. data/config/locales/sr-CS.yml +0 -5
  148. data/config/locales/sv.yml +132 -193
  149. data/config/locales/tr-TR.yml +8 -69
  150. data/config/locales/uk.yml +4 -44
  151. data/config/locales/zh-CN.yml +5 -60
  152. data/config/locales/zh-TW.yml +7 -63
  153. data/db/migrate/20200108123050_migrate_decidim_assembly_types.rb +1 -1
  154. data/lib/decidim/api/assemblies_type_type.rb +1 -1
  155. data/lib/decidim/api/assembly_member_type.rb +1 -1
  156. data/lib/decidim/api/assembly_type.rb +1 -1
  157. data/lib/decidim/assemblies/admin_engine.rb +21 -126
  158. data/lib/decidim/assemblies/content_blocks/registry_manager.rb +184 -0
  159. data/lib/decidim/assemblies/engine.rb +15 -21
  160. data/lib/decidim/assemblies/menu.rb +161 -0
  161. data/lib/decidim/assemblies/participatory_space.rb +7 -229
  162. data/lib/decidim/assemblies/query_extensions.rb +6 -6
  163. data/lib/decidim/assemblies/seeds.rb +161 -0
  164. data/lib/decidim/assemblies/test/factories.rb +47 -55
  165. data/lib/decidim/assemblies/version.rb +1 -1
  166. metadata +54 -51
  167. data/app/cells/decidim/assemblies/assembly_m/footer.erb +0 -15
  168. data/app/cells/decidim/assemblies/assembly_m/tags.erb +0 -1
  169. data/app/cells/decidim/assemblies/assembly_m_cell.rb +0 -77
  170. data/app/cells/decidim/assemblies/content_blocks/highlighted_assemblies/show.erb +0 -30
  171. data/app/commands/decidim/assemblies/admin/create_assembly_admin.rb +0 -54
  172. data/app/commands/decidim/assemblies/admin/destroy_assembly_admin.rb +0 -58
  173. data/app/commands/decidim/assemblies/admin/notify_role_assigned_to_assembly.rb +0 -22
  174. data/app/commands/decidim/assemblies/admin/publish_assembly.rb +0 -39
  175. data/app/commands/decidim/assemblies/admin/unpublish_assembly.rb +0 -39
  176. data/app/commands/decidim/assemblies/admin/update_assemblies_setting.rb +0 -46
  177. data/app/commands/decidim/assemblies/admin/update_assembly_admin.rb +0 -53
  178. data/app/controllers/decidim/assemblies/admin/assemblies_settings_controller.rb +0 -49
  179. data/app/controllers/decidim/assemblies/widgets_controller.rb +0 -33
  180. data/app/forms/decidim/assemblies/admin/assemblies_setting_form.rb +0 -14
  181. data/app/models/decidim/assemblies_setting.rb +0 -17
  182. data/app/queries/decidim/assemblies/admin/assembly_members.rb +0 -56
  183. data/app/views/decidim/assemblies/_filter_by_type.html.erb +0 -19
  184. data/app/views/decidim/assemblies/admin/assemblies_settings/_form.html.erb +0 -10
  185. data/app/views/decidim/assemblies/admin/assemblies_settings/edit.html.erb +0 -7
  186. data/app/views/decidim/assemblies/assemblies/_count.html.erb +0 -1
  187. data/app/views/decidim/assemblies/assemblies/_nav_breadcumb.html.erb +0 -11
  188. data/app/views/decidim/assemblies/assemblies/_parent_assemblies.html.erb +0 -15
  189. data/app/views/decidim/assemblies/assemblies/_promoted_assembly.html.erb +0 -27
  190. data/app/views/layouts/decidim/_assembly_header.html.erb +0 -27
  191. data/app/views/layouts/decidim/_assembly_navigation.html.erb +0 -24
  192. data/app/views/layouts/decidim/admin/assembly_members.html.erb +0 -18
  193. data/config/locales/he-IL.yml +0 -110
  194. data/db/seeds/Exampledocument.pdf +0 -0
  195. data/db/seeds/city.jpeg +0 -0
  196. data/db/seeds/city2.jpeg +0 -0
  197. data/db/seeds/homepage_image.jpg +0 -0
  198. data/decidim-assemblies.gemspec +0 -32
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5187d6864a8b39b81508e1766cdc6909e4d8cc51d5cbe7c4215995c34054849d
4
- data.tar.gz: fdeec388fc516fe0545b4f7b83ccb7085eb413a08c826b1bcce4ce404efc0725
3
+ metadata.gz: e8a9b53150a9eaf9e2666b2605108873e16f6d3a34c85dc9d1c4dd983179e6a7
4
+ data.tar.gz: 8675b6cb5150806349a85e7a6d59bca1a56701f1cdce4c520a4d862034aec818
5
5
  SHA512:
6
- metadata.gz: 8abffd1232d60a3838838d50c5c621e009dd30302735085b4186e4002a8eb3c1f5c7f2987b0fccf37ccbbdea894835b4afa8524c6c652619236ca762b0340539
7
- data.tar.gz: 0a22eed69b8160189b9adf4e4a5f00b021c779badecfcde8dca903fd93554b5b17cf7a86dc9b11d12b67219d6b2bc9d830ee5381ed7159796cf4be0c900aa0a6
6
+ metadata.gz: 127bee807517c724cc25aac51deacc318225a8238c9788ec63aacee429f94722019a8ab02efbd8f53f428fa4d75749594fac9a52a29d697f653df8e9afb531a9
7
+ data.tar.gz: 8bc3f4df2e9119a094fa9c665e491887e787c57424abc8ce61d472a814024ecf72e22b5337a77331b4b24d951cd1b8c0e34bfef3b1fb3bba76425b819f16eb73
@@ -0,0 +1,16 @@
1
+ <div class="content-block__title">
2
+ <h2 class="h2 decorator"><%= title %></h2>
3
+ <div class="label text-lg"><%= total_count %></div>
4
+ <% if show_all_path.present? %>
5
+ <%= link_to show_all_path, class: "button button__sm button__text-secondary" do %>
6
+ <span><%= t("decidim.assemblies.pages.home.highlighted_assemblies.see_all_spaces") %></span>
7
+ <%= icon "arrow-right-line" %>
8
+ <% end %>
9
+ <% end %>
10
+ </div>
11
+
12
+ <div class="participatory-space__block-grid">
13
+ <% assemblies.each do |assembly| %>
14
+ <%= card_for(assembly) %>
15
+ <% end %>
16
+ </div>
@@ -0,0 +1,24 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ # This cell renders a list of assemblies in content blocks
6
+ class AssembliesCell < Decidim::ViewModel
7
+ include Decidim::CardHelper
8
+
9
+ alias assemblies model
10
+
11
+ def total_count
12
+ @total_count ||= options[:total_count] || assemblies.size
13
+ end
14
+
15
+ def show_all_path
16
+ @show_all_path ||= options[:show_all_path].presence
17
+ end
18
+
19
+ def title
20
+ @title ||= options[:title] || t("name", scope: "decidim.assemblies.content_blocks.related_assemblies")
21
+ end
22
+ end
23
+ end
24
+ end
@@ -3,7 +3,7 @@
3
3
  module Decidim
4
4
  module Assemblies
5
5
  # This cell renders the assembly card for an instance of an Assembly
6
- # the default size is the Medium Card (:m)
6
+ # the default size is the Grid Card (:g)
7
7
  class AssemblyCell < Decidim::ViewModel
8
8
  def show
9
9
  cell card_size, model, options
@@ -12,7 +12,12 @@ module Decidim
12
12
  private
13
13
 
14
14
  def card_size
15
- "decidim/assemblies/assembly_m"
15
+ case @options[:size]
16
+ when :s
17
+ "decidim/assemblies/assembly_s"
18
+ else
19
+ "decidim/assemblies/assembly_g"
20
+ end
16
21
  end
17
22
  end
18
23
  end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ class AssemblyDropdownMetadataCell < Decidim::ParticipatorySpaceDropdownMetadataCell
6
+ include AssembliesHelper
7
+ include Decidim::ComponentPathHelper
8
+ include ActiveLinkTo
9
+
10
+ def decidim_assemblies
11
+ Decidim::Assemblies::Engine.routes.url_helpers
12
+ end
13
+
14
+ private
15
+
16
+ def nav_items_method = :assembly_nav_items
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ # This cell renders the Grid (:g) assembly card
6
+ # for a given instance of an Assembly
7
+ class AssemblyGCell < Decidim::CardGCell
8
+ private
9
+
10
+ def resource_path
11
+ Decidim::Assemblies::Engine.routes.url_helpers.assembly_path(model)
12
+ end
13
+
14
+ def resource_image_path
15
+ model.attached_uploader(:hero_image).path
16
+ end
17
+
18
+ def metadata_cell
19
+ "decidim/assemblies/assembly_metadata_g"
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,19 @@
1
+ <div class="profile__user-avatar-container">
2
+ <div class="<%= has_profile? ? "profile__user-avatar" : "profile__user-avatar !border-0" %>">
3
+ <%= image_tag(has_profile? ? model.avatar_url(:big) : model.non_user_avatar_path, alt: "member-avatar") %>
4
+ </div>
5
+ </div>
6
+ <div>
7
+ <%= render :name_and_position %>
8
+ <div class="mt-2">
9
+ <span class="text-gray-2">
10
+ <%= t("decidim.assembly_members.assembly_member.designated_on") %>
11
+ </span>
12
+ <strong>
13
+ <%= l designation_date, format: :decidim_short %>
14
+ </strong>
15
+ </div>
16
+ <span class="profile__user-nick">
17
+ <%= personal_information %>
18
+ </span>
19
+ </div>
@@ -0,0 +1,11 @@
1
+ <div class="<%= has_profile? ? "profile__user-name" : "profile__user-name !no-underline" %>">
2
+ <%= name %>
3
+ <span class="capitalize label alert">
4
+ <%= position %>
5
+ </span>
6
+ </div>
7
+ <% if nickname.present? %>
8
+ <span class="profile__user-nick block">
9
+ <%= nickname %>
10
+ </span>
11
+ <% end %>
@@ -1,53 +1,9 @@
1
- <div class="column">
2
- <div class="card card--member">
3
- <div class="card__content">
4
- <div class="card__header collapse">
5
- <div class="author-data author-data--big">
6
- <div class="author-data__main">
7
- <div class="author author--flex">
8
- <% if has_profile? %>
9
- <%= link_to profile_url, class: "author__avatar" do %>
10
- <%= image_tag model.avatar_url(:big), alt: "member-avatar" %>
11
- <% end %>
12
- <div>
13
- <div class="author__name--container">
14
- <%= link_to profile_url, class: "author__name" do %>
15
- <%= name %>
16
- <% end %>
17
- </div>
18
- <% if nickname.present? %>
19
- <%= link_to profile_url, class: "author__nickname" do %>
20
- <%= nickname %>
21
- <% end %>
22
- <% else %>
23
- <div class="author__nickname">&nbsp;</div>
24
- <% end %>
25
- </div>
26
- <% else %>
27
- <div class="author__avatar"><%= image_tag model.non_user_avatar_path, alt: "member-avatar" %></div>
28
- <div>
29
- <div class="author__name--container">
30
- <div class="author__name">
31
- <%= name %>
32
- </div>
33
- </div>
34
- <div class="author__nickname"><%= nickname.presence || "&nbsp;" %></div>
35
- </div>
36
- <% end %>
37
- </div>
38
- </div>
39
- </div>
40
- </div>
41
- <div class="card__text card--picture-offset">
42
- <div>
43
- <small><strong><%= position %></strong></small>
44
- </div>
45
- <div class="text-small">
46
- <%= t("decidim.assembly_members.assembly_member.designated_on") %>
47
- <strong> <%= l designation_date, format: :decidim_short %></strong>
48
- </div>
49
- <div class="text-small mt-s"><%= personal_information %></div>
50
- </div>
51
- </div>
1
+ <% if has_profile? %>
2
+ <%= link_to profile_url, class: "profile__user" do %>
3
+ <%= render :data %>
4
+ <% end %>
5
+ <% else %>
6
+ <div class="profile__user">
7
+ <%= render :data %>
52
8
  </div>
53
- </div>
9
+ <% end %>
@@ -0,0 +1,46 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ # This cell renders the assembly metadata for g card
6
+ class AssemblyMetadataGCell < Decidim::CardMetadataCell
7
+ alias current_participatory_space model
8
+
9
+ private
10
+
11
+ def items
12
+ [children_item, assembly_type].compact
13
+ end
14
+
15
+ def assembly_type
16
+ return unless has_assembly_type?
17
+
18
+ {
19
+ text: translated_attribute(model.assembly_type.title),
20
+ icon: "group-2-line"
21
+ }
22
+ end
23
+
24
+ def children_item
25
+ return if children_assemblies_count_for_user.zero?
26
+
27
+ {
28
+ text: t("children_item", count: children_assemblies_count_for_user, scope: "layouts.decidim.assemblies.metadata"),
29
+ icon: "government-line"
30
+ }
31
+ end
32
+
33
+ def children_assemblies_count_for_user
34
+ @children_assemblies_count_for_user ||= published_children_assemblies.visible_for(current_user).count
35
+ end
36
+
37
+ def published_children_assemblies
38
+ @published_children_assemblies ||= model.children.published
39
+ end
40
+
41
+ def has_assembly_type?
42
+ model.assembly_type.present?
43
+ end
44
+ end
45
+ end
46
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ # This cell renders the Search (:s) process card
6
+ # for a given instance of an Assembly
7
+ class AssemblySCell < Decidim::CardSCell
8
+ private
9
+
10
+ def metadata_cell
11
+ "decidim/assemblies/assembly_metadata_g"
12
+ end
13
+ end
14
+ end
15
+ end
@@ -0,0 +1,21 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ class ContentBlockCell < Decidim::Admin::ContentBlockCell
6
+ delegate :scoped_resource, to: :controller
7
+
8
+ def edit_content_block_path
9
+ decidim_assemblies.edit_assembly_landing_page_content_block_path(scoped_resource, model)
10
+ end
11
+
12
+ def content_block_path
13
+ decidim_assemblies.assembly_landing_page_content_block_path(scoped_resource, model)
14
+ end
15
+
16
+ def decidim_assemblies
17
+ Decidim::Assemblies::AdminEngine.routes.url_helpers
18
+ end
19
+ end
20
+ end
21
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module ContentBlocks
6
+ class ChildrenAssembliesCell < RelatedAssembliesCell
7
+ def related_assemblies
8
+ @related_assemblies ||= resource.children.visible_for(current_user).published.order(weight: :asc)
9
+ end
10
+
11
+ def total_count
12
+ related_assemblies.size
13
+ end
14
+
15
+ private
16
+
17
+ def title
18
+ t("name", scope: "decidim.assemblies.content_blocks.children_assemblies")
19
+ end
20
+
21
+ def limit
22
+ model.settings.try(:max_results)
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module ContentBlocks
6
+ class DatesMetadataCell < Decidim::ContentBlocks::ParticipatorySpaceMetadataCell
7
+ private
8
+
9
+ def metadata_items
10
+ %w(creation_date created_by included_at closing_date)
11
+ end
12
+
13
+ def space_presenter
14
+ AssemblyPresenter
15
+ end
16
+
17
+ def translations_scope
18
+ "decidim.assemblies.assemblies.description"
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,39 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module ContentBlocks
6
+ class ExtraDataCell < Decidim::ContentBlocks::ParticipatorySpaceExtraDataCell
7
+ delegate :assembly_type, :duration, to: :presented_resource
8
+
9
+ private
10
+
11
+ def extra_data_items
12
+ [type_item, duration_item].compact
13
+ end
14
+
15
+ def presented_resource
16
+ AssemblyPresenter.new(resource)
17
+ end
18
+
19
+ def type_item
20
+ return if assembly_type.blank?
21
+
22
+ {
23
+ title: t("assembly_type", scope: "decidim.assemblies.show"),
24
+ icon: "group-2-line",
25
+ text: assembly_type
26
+ }
27
+ end
28
+
29
+ def duration_item
30
+ {
31
+ title: t("duration", scope: "decidim.assemblies.show"),
32
+ icon: "calendar-line",
33
+ text: duration
34
+ }
35
+ end
36
+ end
37
+ end
38
+ end
39
+ end
@@ -3,41 +3,33 @@
3
3
  module Decidim
4
4
  module Assemblies
5
5
  module ContentBlocks
6
- class HighlightedAssembliesCell < Decidim::ViewModel
6
+ class HighlightedAssembliesCell < Decidim::ContentBlocks::HighlightedParticipatorySpacesCell
7
7
  delegate :current_user, to: :controller
8
8
 
9
- def show
10
- render if highlighted_assemblies.any?
11
- end
12
-
13
- def max_results
14
- model.settings.max_results
15
- end
16
-
17
- def highlighted_assemblies
18
- @highlighted_assemblies ||= OrganizationPrioritizedAssemblies
19
- .new(current_organization, current_user)
20
- .query
21
- .with_attached_hero_image
22
- .includes([:organization])
23
- .limit(max_results)
9
+ def highlighted_spaces
10
+ @highlighted_spaces ||= OrganizationPrioritizedAssemblies
11
+ .new(current_organization, current_user)
12
+ .query
13
+ .with_attached_hero_image
14
+ .includes([:organization])
24
15
  end
25
16
 
26
17
  def i18n_scope
27
18
  "decidim.assemblies.pages.home.highlighted_assemblies"
28
19
  end
29
20
 
30
- def decidim_assemblies
31
- Decidim::Assemblies::Engine.routes.url_helpers
21
+ def all_path
22
+ Decidim::Assemblies::Engine.routes.url_helpers.assemblies_path
23
+ end
24
+
25
+ def max_results
26
+ model.settings.max_results
32
27
  end
33
28
 
34
29
  private
35
30
 
36
- def cache_hash
37
- hash = []
38
- hash.push(I18n.locale)
39
- hash.push(highlighted_assemblies.map(&:cache_key_with_version))
40
- hash.join(Decidim.cache_key_separator)
31
+ def block_id
32
+ "highlighted-assemblies"
41
33
  end
42
34
  end
43
35
  end
@@ -1,3 +1,3 @@
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, [6, 9, 12], prompt: "", label: %>
3
3
  <% end %>
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module ContentBlocks
6
+ class MainDataCell < Decidim::ContentBlocks::ParticipatorySpaceMainDataCell
7
+ include AssembliesHelper
8
+ include Decidim::ComponentPathHelper
9
+ include ActiveLinkTo
10
+
11
+ EXTRA_ATTRIBUTES = %w(purpose_of_action internal_organisation composition).freeze
12
+
13
+ delegate :short_description, :description, to: :resource
14
+ delegate(*EXTRA_ATTRIBUTES, to: :resource)
15
+
16
+ private
17
+
18
+ def decidim_assemblies
19
+ Decidim::Assemblies::Engine.routes.url_helpers
20
+ end
21
+
22
+ def title_text
23
+ t("title", scope: "decidim.assemblies.assemblies.show")
24
+ end
25
+
26
+ def short_description_text
27
+ decidim_sanitize_editor_admin translated_attribute(short_description)
28
+ end
29
+
30
+ def description_text
31
+ [decidim_sanitize_editor_admin(translated_attribute(description)), extra_attributes].compact_blank.join("\n")
32
+ end
33
+
34
+ def extra_attributes
35
+ EXTRA_ATTRIBUTES.filter_map do |attribute|
36
+ text = translated_attribute(send(attribute))
37
+ next if text.blank? || text == "<p></p>"
38
+
39
+ [
40
+ content_tag(:h3, class: "h4") { t(attribute, scope: "activemodel.attributes.assembly") },
41
+ decidim_sanitize_editor_admin(text)
42
+ ].join("\n")
43
+ end
44
+ end
45
+
46
+ def nav_items
47
+ assembly_nav_items(resource)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module ContentBlocks
6
+ class MetadataCell < Decidim::ContentBlocks::ParticipatorySpaceMetadataCell
7
+ private
8
+
9
+ def metadata_items
10
+ %w(meta_scope developer_group local_area target participatory_scope participatory_structure area_name)
11
+ end
12
+
13
+ def space_presenter
14
+ AssemblyPresenter
15
+ end
16
+
17
+ def translations_scope
18
+ "decidim.assemblies.assemblies.description"
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -0,0 +1 @@
1
+ <%= cell "decidim/assemblies/assemblies", related_assemblies.limit(limit), total_count:, title: %>
@@ -0,0 +1,34 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module ContentBlocks
6
+ class RelatedAssembliesCell < Decidim::ContentBlocks::BaseCell
7
+ def show
8
+ render if total_count.positive?
9
+ end
10
+
11
+ def related_assemblies
12
+ @related_assemblies ||=
13
+ resource
14
+ .linked_participatory_space_resources(:assembly, "included_participatory_processes")
15
+ .public_spaces
16
+ end
17
+
18
+ def total_count
19
+ related_assemblies.size
20
+ end
21
+
22
+ private
23
+
24
+ def title
25
+ t("name", scope: "decidim.assemblies.content_blocks.related_assemblies")
26
+ end
27
+
28
+ def limit
29
+ model.settings.try(:max_results)
30
+ end
31
+ end
32
+ end
33
+ end
34
+ end
@@ -0,0 +1,15 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Assemblies
5
+ module ContentBlocks
6
+ class StatsCell < Decidim::ContentBlocks::ParticipatorySpaceStatsCell
7
+ private
8
+
9
+ def stats
10
+ @stats ||= resource.show_statistics && AssemblyStatsPresenter.new(assembly: resource).collection
11
+ end
12
+ end
13
+ end
14
+ end
15
+ end
@@ -19,7 +19,7 @@ module Decidim
19
19
  # Executes the command. Broadcasts these events:
20
20
  #
21
21
  # - :ok when everything is valid.
22
- # - :invalid if the form wasn't valid and we couldn't proceed.
22
+ # - :invalid if the form was not valid and we could not proceed.
23
23
  #
24
24
  # Returns nothing.
25
25
  def call
@@ -93,7 +93,7 @@ module Decidim
93
93
  step_settings: component.step_settings,
94
94
  weight: component.weight
95
95
  )
96
- component.manifest.run_hooks(:copy, new_component: new_component, old_component: component)
96
+ component.manifest.run_hooks(:copy, new_component:, old_component: component)
97
97
  end
98
98
  end
99
99
  end
@@ -16,7 +16,7 @@ module Decidim
16
16
  # Executes the command. Broadcasts these events:
17
17
  #
18
18
  # - :ok when everything is valid.
19
- # - :invalid if the form wasn't valid and we couldn't proceed.
19
+ # - :invalid if the form was not valid and we could not proceed.
20
20
  #
21
21
  # Returns nothing.
22
22
  def call
@@ -16,7 +16,7 @@ module Decidim
16
16
  # Executes the command. Broadcasts these events:
17
17
  #
18
18
  # - :ok when everything is valid.
19
- # - :invalid if the form wasn't valid and we couldn't proceed.
19
+ # - :invalid if the form was not valid and we could not proceed.
20
20
  #
21
21
  # Returns nothing.
22
22
  def call
@@ -25,6 +25,7 @@ module Decidim
25
25
  if assembly.persisted?
26
26
  add_admins_as_followers(assembly)
27
27
  link_participatory_processes(assembly)
28
+ Decidim::ContentBlocksCreator.new(assembly).create_default!
28
29
 
29
30
  broadcast(:ok, assembly)
30
31
  else
@@ -21,7 +21,7 @@ module Decidim
21
21
  # Executes the command. Broadcasts these events:
22
22
  #
23
23
  # - :ok when everything is valid.
24
- # - :invalid if the form wasn't valid and we couldn't proceed.
24
+ # - :invalid if the form was not valid and we could not proceed.
25
25
  #
26
26
  # Returns nothing.
27
27
  def call
@@ -63,7 +63,7 @@ module Decidim
63
63
  "position_other",
64
64
  "weight"
65
65
  ).symbolize_keys.merge(
66
- assembly: assembly,
66
+ assembly:,
67
67
  user: form.user
68
68
  ).merge(
69
69
  attachment_attributes(:non_user_avatar)
@@ -97,7 +97,7 @@ module Decidim
97
97
  event: "decidim.events.assemblies.create_assembly_member",
98
98
  event_class: Decidim::Assemblies::CreateAssemblyMemberEvent,
99
99
  resource: assembly,
100
- followers: followers
100
+ followers:
101
101
  }
102
102
  Decidim::EventsManager.publish(**data)
103
103
  end