decidim-core 0.13.1 → 0.14.1

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of decidim-core might be problematic. Click here for more details.

Files changed (236) hide show
  1. checksums.yaml +4 -4
  2. data/app/assets/config/decidim_core_manifest.js +1 -1
  3. data/app/assets/images/decidim/gamification/badges/invitations.svg +117 -0
  4. data/app/assets/javascripts/decidim.js.es6 +4 -1
  5. data/app/assets/javascripts/decidim/ajax_modals.js.es6 +17 -0
  6. data/app/assets/javascripts/decidim/conferences.js.es6 +16 -0
  7. data/app/assets/javascripts/decidim/input_hashtags.js.es6 +115 -0
  8. data/app/assets/javascripts/decidim/input_mentions.js.es6 +2 -3
  9. data/app/assets/javascripts/decidim/vizzs/areachart.js.es6 +226 -0
  10. data/app/assets/javascripts/decidim/vizzs/metrics.js.es6 +26 -0
  11. data/app/assets/javascripts/decidim/vizzs/orgchart.js.es6 +701 -0
  12. data/app/assets/javascripts/decidim/vizzs/renders.js.es6 +11 -0
  13. data/app/assets/stylesheets/decidim/extras/_proposal_form.scss +3 -1
  14. data/app/assets/stylesheets/decidim/layouts/_home.scss +1 -1
  15. data/app/assets/stylesheets/decidim/modules/_areachart.scss +74 -0
  16. data/app/assets/stylesheets/decidim/modules/_badges.scss +116 -0
  17. data/app/assets/stylesheets/decidim/modules/_buttons.scss +5 -0
  18. data/app/assets/stylesheets/decidim/modules/_cards.scss +21 -4
  19. data/app/assets/stylesheets/decidim/modules/_chart-tooltip.scss +42 -0
  20. data/app/assets/stylesheets/decidim/modules/_collapsible-list.scss +12 -8
  21. data/app/assets/stylesheets/decidim/modules/_conference-nav.scss +31 -0
  22. data/app/assets/stylesheets/decidim/modules/_conference-programme.scss +110 -0
  23. data/app/assets/stylesheets/decidim/modules/_conference-speaker.scss +86 -0
  24. data/app/assets/stylesheets/decidim/modules/_conversation.scss +58 -0
  25. data/app/assets/stylesheets/decidim/modules/_help.scss +38 -0
  26. data/app/assets/stylesheets/decidim/modules/_hover-section.scss +29 -0
  27. data/app/assets/stylesheets/decidim/modules/_icons.scss +10 -4
  28. data/app/assets/stylesheets/decidim/modules/_input-hashtags.scss +124 -0
  29. data/app/assets/stylesheets/decidim/modules/_loading-spinner.scss +12 -0
  30. data/app/assets/stylesheets/decidim/modules/_margins.scss +2 -2
  31. data/app/assets/stylesheets/decidim/modules/_modules.scss +15 -0
  32. data/app/assets/stylesheets/decidim/modules/_navbar.scss +9 -0
  33. data/app/assets/stylesheets/decidim/modules/_orgchart.scss +62 -0
  34. data/app/assets/stylesheets/decidim/modules/_status-labels.scss +2 -1
  35. data/app/assets/stylesheets/decidim/modules/_typography.scss +9 -0
  36. data/app/assets/stylesheets/decidim/utils/_helpers.scss +28 -0
  37. data/app/assets/stylesheets/decidim/utils/_mixins.scss +63 -0
  38. data/app/cells/decidim/author/withdraw.erb +1 -1
  39. data/app/cells/decidim/author_cell.rb +1 -1
  40. data/app/cells/decidim/badge/show.erb +36 -0
  41. data/app/cells/decidim/badge_cell.rb +53 -0
  42. data/app/cells/decidim/badges/show.erb +6 -0
  43. data/app/cells/decidim/badges_cell.rb +14 -0
  44. data/app/cells/decidim/card_m/header.erb +1 -1
  45. data/app/cells/decidim/card_m/show.erb +1 -2
  46. data/app/cells/decidim/card_m/top.erb +7 -0
  47. data/app/cells/decidim/card_m_cell.rb +14 -17
  48. data/app/cells/decidim/coauthorships_cell.rb +77 -0
  49. data/app/cells/decidim/collapsible_authors/show.erb +0 -1
  50. data/app/cells/decidim/collapsible_authors_cell.rb +4 -4
  51. data/app/cells/decidim/collapsible_list/show.erb +12 -4
  52. data/app/cells/decidim/collapsible_list_cell.rb +14 -12
  53. data/app/cells/decidim/content_blocks/footer_sub_hero/show.erb +14 -0
  54. data/app/cells/decidim/content_blocks/footer_sub_hero_cell.rb +12 -0
  55. data/app/{views/decidim/pages/home/_hero.html.erb → cells/decidim/content_blocks/hero/show.erb} +4 -4
  56. data/app/cells/decidim/content_blocks/hero_cell.rb +25 -0
  57. data/app/cells/decidim/content_blocks/hero_settings_form/show.erb +7 -0
  58. data/app/cells/decidim/content_blocks/hero_settings_form_cell.rb +13 -0
  59. data/app/cells/decidim/content_blocks/highlighted_content_banner/show.erb +24 -0
  60. data/app/cells/decidim/content_blocks/highlighted_content_banner_cell.rb +16 -0
  61. data/app/{views/decidim/pages/home/_extended.html.erb → cells/decidim/content_blocks/how_to_participate/show.erb} +10 -10
  62. data/app/cells/decidim/content_blocks/how_to_participate_cell.rb +9 -0
  63. data/app/{views/decidim/pages/home/_statistics.html.erb → cells/decidim/content_blocks/stats/show.erb} +2 -2
  64. data/app/cells/decidim/content_blocks/stats_cell.rb +18 -0
  65. data/app/{views/decidim/pages/home/_sub_hero.html.erb → cells/decidim/content_blocks/sub_hero/show.erb} +2 -2
  66. data/app/cells/decidim/content_blocks/sub_hero_cell.rb +17 -0
  67. data/app/cells/decidim/conversation/show.erb +18 -0
  68. data/app/cells/decidim/conversation_cell.rb +23 -0
  69. data/app/cells/decidim/conversation_header/show.erb +17 -0
  70. data/app/cells/decidim/conversation_header_cell.rb +16 -0
  71. data/app/cells/decidim/conversations/show.erb +45 -0
  72. data/app/cells/decidim/conversations_cell.rb +24 -0
  73. data/app/cells/decidim/follow_button/show.erb +3 -3
  74. data/app/cells/decidim/follow_button_cell.rb +1 -5
  75. data/app/cells/decidim/following_cell.rb +1 -7
  76. data/app/cells/decidim/message/show.erb +15 -0
  77. data/app/cells/decidim/message_cell.rb +23 -0
  78. data/app/cells/decidim/new_conversation/show.erb +19 -0
  79. data/app/cells/decidim/new_conversation_cell.rb +19 -0
  80. data/app/cells/decidim/notifications/show.erb +1 -1
  81. data/app/cells/decidim/profile/show.erb +27 -0
  82. data/app/cells/decidim/profile_cell.rb +33 -0
  83. data/app/cells/decidim/profile_sidebar/show.erb +57 -0
  84. data/app/cells/decidim/profile_sidebar_cell.rb +31 -0
  85. data/app/cells/decidim/tos_page_cell.rb +0 -4
  86. data/app/cells/decidim/user_profile/header.erb +1 -1
  87. data/app/controllers/concerns/decidim/action_authorization.rb +13 -38
  88. data/app/controllers/concerns/decidim/needs_permission.rb +15 -6
  89. data/app/controllers/decidim/application_controller.rb +1 -0
  90. data/app/controllers/decidim/authorization_modals_controller.rb +35 -0
  91. data/app/controllers/decidim/components/base_controller.rb +0 -1
  92. data/app/controllers/decidim/devise/invitations_controller.rb +2 -1
  93. data/app/controllers/decidim/messaging/conversations_controller.rb +2 -11
  94. data/app/controllers/decidim/newsletters_controller.rb +4 -6
  95. data/app/controllers/decidim/notifications_controller.rb +4 -0
  96. data/app/controllers/decidim/pages_controller.rb +3 -7
  97. data/app/controllers/decidim/profiles_controller.rb +17 -7
  98. data/app/forms/decidim/notifications_settings_form.rb +1 -1
  99. data/app/forms/decidim/registration_form.rb +1 -1
  100. data/app/helpers/decidim/action_authorization_helper.rb +51 -46
  101. data/app/helpers/decidim/application_helper.rb +18 -0
  102. data/app/helpers/decidim/card_helper.rb +1 -1
  103. data/app/helpers/decidim/cells_helper.rb +6 -2
  104. data/app/helpers/decidim/resource_helper.rb +8 -1
  105. data/app/helpers/decidim/searches_helper.rb +5 -4
  106. data/app/helpers/decidim/traceability_helper.rb +5 -1
  107. data/app/models/decidim/authorization.rb +2 -2
  108. data/app/models/decidim/content_block.rb +144 -0
  109. data/app/models/decidim/gamification/badge_score.rb +13 -0
  110. data/app/models/decidim/messaging/message.rb +1 -1
  111. data/app/models/decidim/messaging/receipt.rb +1 -1
  112. data/app/models/decidim/organization.rb +1 -5
  113. data/app/models/decidim/resource_permission.rb +8 -0
  114. data/app/models/decidim/searchable_resource.rb +1 -1
  115. data/app/models/decidim/user.rb +17 -1
  116. data/app/permissions/decidim/default_permissions.rb +4 -3
  117. data/app/permissions/decidim/permissions.rb +33 -1
  118. data/app/presenters/decidim/hashtag_presenter.rb +32 -0
  119. data/app/presenters/decidim/resource_locator_presenter.rb +13 -0
  120. data/app/presenters/decidim/user_presenter.rb +1 -1
  121. data/app/queries/decidim/messaging/user_conversations.rb +1 -1
  122. data/app/resolvers/decidim/hashtags_resolver.rb +15 -0
  123. data/app/services/decidim/action_authorizer.rb +9 -8
  124. data/app/types/decidim/core/date_time_type.rb +1 -1
  125. data/app/types/decidim/core/hashtag_type.rb +13 -0
  126. data/app/uploaders/decidim/homepage_image_uploader.rb +1 -1
  127. data/app/uploaders/decidim/image_uploader.rb +1 -0
  128. data/app/views/decidim/authorization_modals/show.html.erb +32 -0
  129. data/app/views/decidim/messaging/conversations/create.js.erb +1 -1
  130. data/app/views/decidim/messaging/conversations/index.html.erb +1 -51
  131. data/app/views/decidim/messaging/conversations/new.html.erb +1 -5
  132. data/app/views/decidim/messaging/conversations/show.html.erb +1 -9
  133. data/app/views/decidim/messaging/conversations/update.js.erb +1 -1
  134. data/app/views/decidim/notifications/index.html.erb +1 -0
  135. data/app/views/decidim/pages/decidim_page.html.erb +9 -0
  136. data/app/views/decidim/pages/home.html.erb +12 -16
  137. data/app/views/decidim/pages/index.html.erb +8 -0
  138. data/app/views/decidim/profiles/_user_follow.erb +2 -2
  139. data/app/views/decidim/profiles/show.html.erb +1 -37
  140. data/app/views/decidim/searches/_results.html.erb +1 -1
  141. data/app/views/decidim/shared/_author_reference.html.erb +1 -1
  142. data/app/views/decidim/shared/_authorization_modal.html.erb +1 -0
  143. data/app/views/decidim/shared/_tags.html.erb +1 -1
  144. data/app/views/kaminari/decidim/_page.html.erb +1 -1
  145. data/app/views/layouts/decidim/_application.html.erb +6 -1
  146. data/app/views/layouts/decidim/_edit_link.html.erb +8 -0
  147. data/app/views/layouts/decidim/_impersonation_warning.html.erb +1 -1
  148. data/app/views/layouts/decidim/_user_menu.html.erb +2 -2
  149. data/app/views/layouts/decidim/_wrapper.html.erb +14 -1
  150. data/config/initializers/carrierwave.rb +15 -0
  151. data/config/locales/ca.yml +78 -30
  152. data/config/locales/en.yml +78 -30
  153. data/config/locales/es-PY.yml +78 -30
  154. data/config/locales/es.yml +78 -30
  155. data/config/locales/eu.yml +78 -30
  156. data/config/locales/fi.yml +262 -214
  157. data/config/locales/fr.yml +78 -30
  158. data/config/locales/gl.yml +78 -30
  159. data/config/locales/hu.yml +781 -0
  160. data/config/locales/it.yml +78 -30
  161. data/config/locales/nl.yml +78 -30
  162. data/config/locales/pl.yml +78 -30
  163. data/config/locales/pt-BR.yml +106 -58
  164. data/config/locales/pt.yml +78 -30
  165. data/config/locales/ru.yml +52 -32
  166. data/config/locales/sv.yml +183 -135
  167. data/config/locales/uk.yml +60 -40
  168. data/config/routes.rb +8 -6
  169. data/db/migrate/20180705091019_create_decidim_resource_permissions.rb +12 -0
  170. data/db/migrate/20180706104107_add_nickname_to_managed_users.rb +14 -0
  171. data/db/migrate/20180706111847_fix_result_follows.rb +9 -0
  172. data/db/migrate/20180724103814_add_content_blocks.rb +22 -0
  173. data/db/migrate/20180726112510_create_decidim_hashtags.rb +17 -0
  174. data/db/migrate/20180730071851_add_core_content_blocks.rb +28 -0
  175. data/db/migrate/20180802132147_rename_content_block_options_to_settings.rb +7 -0
  176. data/db/migrate/20180806095628_add_badge_scores.rb +11 -0
  177. data/db/migrate/20180808135006_add_images_to_content_blocks.rb +7 -0
  178. data/db/migrate/20180810092428_move_organization_fields_to_hero_content_block.rb +23 -0
  179. data/db/seeds.rb +10 -2
  180. data/lib/decidim/api/authorable_interface.rb +1 -1
  181. data/lib/decidim/coauthorable.rb +1 -0
  182. data/lib/decidim/content_block_manifest.rb +58 -0
  183. data/lib/decidim/content_block_registry.rb +87 -0
  184. data/lib/decidim/content_parsers.rb +1 -0
  185. data/lib/decidim/content_parsers/hashtag_parser.rb +36 -0
  186. data/lib/decidim/content_processor.rb +11 -0
  187. data/lib/decidim/content_renderers.rb +1 -0
  188. data/lib/decidim/content_renderers/hashtag_renderer.rb +43 -0
  189. data/lib/decidim/core.rb +28 -6
  190. data/lib/decidim/core/api.rb +1 -0
  191. data/lib/decidim/core/engine.rb +52 -1
  192. data/lib/decidim/core/test.rb +3 -0
  193. data/lib/decidim/core/test/factories.rb +32 -17
  194. data/lib/decidim/core/test/shared_examples/authorable_interface_examples.rb +10 -0
  195. data/lib/decidim/core/test/shared_examples/coauthorable.rb +3 -0
  196. data/lib/decidim/core/test/shared_examples/edit_link_shared_examples.rb +30 -0
  197. data/lib/decidim/core/test/shared_examples/has_space_in_mcell_examples.rb +15 -0
  198. data/lib/decidim/core/test/shared_examples/publicable.rb +1 -1
  199. data/lib/decidim/core/test/shared_examples/railtie_examples.rb +15 -0
  200. data/lib/decidim/core/test/shared_examples/scope_helper_examples.rb +1 -0
  201. data/lib/decidim/core/version.rb +1 -1
  202. data/lib/decidim/events/base_event.rb +2 -1
  203. data/lib/decidim/form_builder.rb +9 -3
  204. data/lib/decidim/friendly_dates.rb +1 -1
  205. data/lib/decidim/gamification.rb +109 -0
  206. data/lib/decidim/gamification/badge.rb +54 -0
  207. data/lib/decidim/gamification/badge_earned_event.rb +9 -0
  208. data/lib/decidim/gamification/badge_registry.rb +63 -0
  209. data/lib/decidim/gamification/badge_scorer.rb +118 -0
  210. data/lib/decidim/gamification/badge_status.rb +41 -0
  211. data/lib/decidim/gamification/base_event.rb +40 -0
  212. data/lib/decidim/gamification/level_up_event.rb +9 -0
  213. data/lib/decidim/hashtag.rb +15 -0
  214. data/lib/decidim/hashtaggable.rb +20 -0
  215. data/lib/decidim/query_extensions.rb +10 -0
  216. data/lib/decidim/resource_manifest.rb +10 -0
  217. data/lib/decidim/resourceable.rb +13 -0
  218. data/lib/decidim/search_resource_fields_mapper.rb +8 -3
  219. data/lib/decidim/searchable.rb +8 -0
  220. data/lib/decidim/translatable_attributes.rb +6 -18
  221. data/lib/decidim/view_model.rb +6 -0
  222. data/lib/devise/models/decidim_newsletterable.rb +1 -1
  223. data/vendor/assets/javascripts/d3.js +17813 -0
  224. metadata +125 -27
  225. data/app/cells/decidim/card_m/author.erb +0 -3
  226. data/app/cells/decidim/card_m/authors.erb +0 -9
  227. data/app/views/decidim/messaging/conversations/_message.html.erb +0 -14
  228. data/app/views/decidim/messaging/conversations/_reply.html.erb +0 -11
  229. data/app/views/decidim/messaging/conversations/_show.html.erb +0 -21
  230. data/app/views/decidim/messaging/conversations/_start.html.erb +0 -12
  231. data/app/views/decidim/pages/home/_footer_sub_hero.html.erb +0 -14
  232. data/app/views/decidim/pages/home/_highlighted_content_banner.html.erb +0 -26
  233. data/app/views/decidim/pages/home/_highlighted_processes.html.erb +0 -7
  234. data/app/views/decidim/profiles/_user.html.erb +0 -59
  235. data/app/views/decidim/shared/_action_authorization_modal.html.erb +0 -39
  236. data/app/views/layouts/decidim/_component_authorization_modals.html.erb +0 -5
@@ -3,7 +3,6 @@
3
3
  list,
4
4
  cell_name: cell_name,
5
5
  cell_options: options.merge(has_actions: false),
6
- hidden_elements_count_i18n_key: "decidim.proposals.proposal.show.hidden_authors_count",
7
6
  size: size
8
7
  ) %>
9
8
  <% if actionable? %>
@@ -5,9 +5,9 @@ module Decidim
5
5
  # array of Users will be rendered with the `:cell` cell.
6
6
  #
7
7
  # Available sizes:
8
- # - `:small` => collapses after 3 elements.
9
- # - `:default` => collapses after 7 elements. If not specified, this one is
10
- # used.
8
+ # - any number from 1 to 12
9
+ # - default value is 3
10
+ # - it is delegated to the `decidim/collapsible_list` cell
11
11
  #
12
12
  # Example:
13
13
  #
@@ -17,7 +17,7 @@ module Decidim
17
17
  # cell_name: "my/cell",
18
18
  # cell_options: { my: :options },
19
19
  # hidden_elements_count_i18n_key: "my.custom.key",
20
- # size: :small
20
+ # size: 3
21
21
  # )
22
22
  class CollapsibleAuthorsCell < CollapsibleListCell
23
23
  include CellsHelper
@@ -1,7 +1,11 @@
1
1
  <% if collapsible? %>
2
- <div id="collapsible-list-<%= seed %>" class="collapsible-list is-filtered <%= list_size_class %>" data-toggler=".is-filtered">
2
+ <div id="collapsible-list-<%= seed %>" class="collapsible-list is-filtered <%= list_size_class %> <%= list_class %>" data-toggler=".is-filtered">
3
3
  <% list.each do |element| %>
4
- <%= cell cell_name, element, cell_options %>
4
+ <% if cell_name %>
5
+ <%= cell cell_name, element, cell_options %>
6
+ <% else %>
7
+ <%= card_for element, cell_options %>
8
+ <% end %>
5
9
  <% end %>
6
10
  <span class="collapsible-list__see-more">
7
11
  <%= t(hidden_elements_count_i18n_key, count: hidden_elements_count) %>
@@ -12,9 +16,13 @@
12
16
  </span>
13
17
  </div>
14
18
  <% else %>
15
- <div class="collapsible-list">
19
+ <div class="collapsible-list <%= list_class %>">
16
20
  <% list.each do |element| %>
17
- <%= cell cell_name, element, cell_options %>
21
+ <% if cell_name %>
22
+ <%= cell cell_name, element, cell_options %>
23
+ <% else %>
24
+ <%= card_for element, cell_options %>
25
+ <% end %>
18
26
  <% end %>
19
27
  </div>
20
28
  <% end %>
@@ -2,12 +2,12 @@
2
2
 
3
3
  module Decidim
4
4
  # This cell renders a collapsible list of elements. Each element from the
5
- # `model` array will be rendered with the `:cell` cell.
5
+ # `model` array will be rendered with the `:cell_name` cell.
6
+ # `:cell_name` is optional, if not provided `card_for` helper is used.
6
7
  #
7
8
  # Available sizes:
8
- # - `:small` => collapses after 3 elements.
9
- # - `:default` => collapses after 7 elements. If not specified, this one is
10
- # used.
9
+ # - any number between 1 and 12
10
+ # - default value is 3
11
11
  #
12
12
  # Example:
13
13
  #
@@ -17,10 +17,10 @@ module Decidim
17
17
  # cell_name: "my/cell",
18
18
  # cell_options: { my: :options },
19
19
  # hidden_elements_count_i18n_key: "my.custom.key",
20
- # size: :small
20
+ # size: 4
21
21
  # )
22
22
  class CollapsibleListCell < Decidim::ViewModel
23
- MIN_LENGTH_FOR_SIZE = { small: 3, default: 7 }.freeze
23
+ include Decidim::CardHelper
24
24
 
25
25
  private
26
26
 
@@ -37,22 +37,24 @@ module Decidim
37
37
  end
38
38
 
39
39
  def size
40
- return :small if options[:size].to_s == "small"
41
- :default
40
+ options[:size] || 3
42
41
  end
43
42
 
44
43
  def list_size_class
45
- return "small" if size == :small
46
- ""
44
+ "show-#{size}"
45
+ end
46
+
47
+ def list_class
48
+ options[:list_class]
47
49
  end
48
50
 
49
51
  def collapsible?
50
- list.size > MIN_LENGTH_FOR_SIZE[size]
52
+ list.size > size
51
53
  end
52
54
 
53
55
  def hidden_elements_count
54
56
  return 0 unless collapsible?
55
- list.size - MIN_LENGTH_FOR_SIZE[size]
57
+ list.size - size
56
58
  end
57
59
 
58
60
  def hidden_elements_count_i18n_key
@@ -0,0 +1,14 @@
1
+ <section class="footer__subhero extended subhero home-section">
2
+ <div class="row">
3
+ <div class="columns small-centered large-10">
4
+ <h2 class="heading3"><%= t("decidim.pages.home.footer_sub_hero.footer_sub_hero_headline", organization: current_organization.name) %></h2>
5
+ <h5 class="heading4"><%== t("decidim.pages.home.footer_sub_hero.footer_sub_hero_body") %></h5>
6
+ <% unless current_user %>
7
+ <%= link_to decidim.new_user_registration_path, class: "button--sc link subhero-cta" do %>
8
+ <%= t("decidim.pages.home.footer_sub_hero.register") %>
9
+ <%= icon "chevron-right", aria_hidden: true %>
10
+ <% end %>
11
+ <% end %>
12
+ </div>
13
+ </div>
14
+ </section>
@@ -0,0 +1,12 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ContentBlocks
5
+ class FooterSubHeroCell < Decidim::ViewModel
6
+ include Decidim::IconHelper
7
+
8
+ delegate :current_organization, to: :controller
9
+ delegate :current_user, to: :controller
10
+ end
11
+ end
12
+ end
@@ -1,12 +1,12 @@
1
- <section class="extended hero" style="background-image:url(<%= current_organization.homepage_image.url %>);">
1
+ <section class="extended hero home-section" style="background-image:url(<%= background_image %>);">
2
2
  <div class="hero__container">
3
3
  <div class="row">
4
4
  <div class="columns small-centered large-10">
5
5
  <h1 class="text-highlight heading1 hero-heading">
6
- <% if translated_attribute(current_organization.welcome_text).blank? %>
7
- <%= t(".welcome", organization: current_organization.name) %>
6
+ <% if translated_welcome_text.blank? %>
7
+ <%= t("decidim.pages.home.hero.welcome", organization: current_organization.name) %>
8
8
  <% else %>
9
- <%= decidim_sanitize translated_attribute current_organization.welcome_text %>
9
+ <%= decidim_sanitize translated_welcome_text %>
10
10
  <% end %>
11
11
  </h1>
12
12
  </div>
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ContentBlocks
5
+ class HeroCell < Decidim::ViewModel
6
+ include Decidim::CtaButtonHelper
7
+ include Decidim::SanitizeHelper
8
+
9
+ delegate :current_organization, to: :controller
10
+
11
+ # Needed so that the `CtaButtonHelper` can work.
12
+ def decidim_participatory_processes
13
+ Decidim::ParticipatoryProcesses::Engine.routes.url_helpers
14
+ end
15
+
16
+ def translated_welcome_text
17
+ translated_attribute(model.settings.welcome_text)
18
+ end
19
+
20
+ def background_image
21
+ model.images_container.background_image.big.url
22
+ end
23
+ end
24
+ end
25
+ end
@@ -0,0 +1,7 @@
1
+ <% form.fields_for :settings, form.object.settings do |settings_fields| %>
2
+ <%= settings_fields.translated :text_field, :welcome_text %>
3
+ <% end %>
4
+
5
+ <% form.fields_for :images, form.object.images do |images_fields| %>
6
+ <%= images_fields.upload :background_image %>
7
+ <% end %>
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ContentBlocks
5
+ class HeroSettingsFormCell < Decidim::ViewModel
6
+ alias form model
7
+
8
+ def content_block
9
+ options[:content_block]
10
+ end
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,24 @@
1
+ <section class="extended highligted-content-banner home-section"
2
+ style="background-image:url(<%= current_organization.highlighted_content_banner_image.url %>);">
3
+ <div class="highligted-content-banner__container">
4
+ <div class="row">
5
+ <div class="columns large-10">
6
+ <h1 class="text-highlight heading1 highligted-content-banner-heading">
7
+ <%= translated_attribute current_organization.highlighted_content_banner_title %>
8
+ </h1>
9
+ <span class="text-highlight">
10
+ <%= decidim_sanitize translated_attribute current_organization.highlighted_content_banner_short_description %>
11
+ </span>
12
+ </div>
13
+ <div class="columns large-2">
14
+ <%= link_to current_organization.highlighted_content_banner_action_url,
15
+ class: "button expanded button--sc" do %>
16
+ <%= translated_attribute current_organization.highlighted_content_banner_action_title %>
17
+ <span class="button__info">
18
+ <%= translated_attribute current_organization.highlighted_content_banner_action_subtitle %>
19
+ </span>
20
+ <% end %>
21
+ </div>
22
+ </div>
23
+ </div>
24
+ </section>
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ContentBlocks
5
+ class HighlightedContentBannerCell < Decidim::ViewModel
6
+ include Decidim::SanitizeHelper
7
+
8
+ def show
9
+ return unless current_organization.highlighted_content_banner_enabled
10
+ render
11
+ end
12
+
13
+ delegate :current_organization, to: :controller
14
+ end
15
+ end
16
+ end
@@ -1,7 +1,7 @@
1
- <section class="extended">
2
- <div class="wrapper-home home-section">
1
+ <section class="extended home-section">
2
+ <div class="wrapper-home">
3
3
  <div class="row column text-center">
4
- <h3 class="heading2"><%= t(".how_to_participate") %></h3>
4
+ <h3 class="heading2"><%= t("decidim.pages.home.extended.how_to_participate") %></h3>
5
5
  </div>
6
6
  <div class="row small-up-1 medium-up-3 home-bullets">
7
7
  <div class="column">
@@ -10,8 +10,8 @@
10
10
  <%= icon "meetings" %>
11
11
  </div>
12
12
  <div class="home-bullet__desc">
13
- <h4 class="heading6"><%= t(".meetings") %></h4>
14
- <p><%= t(".meetings_explanation") %></p>
13
+ <h4 class="heading6"><%= t("decidim.pages.home.extended.meetings") %></h4>
14
+ <p><%= t("decidim.pages.home.extended.meetings_explanation") %></p>
15
15
  </div>
16
16
  </div>
17
17
  </div>
@@ -21,8 +21,8 @@
21
21
  <%= icon "debates" %>
22
22
  </div>
23
23
  <div class="home-bullet__desc">
24
- <h4 class="heading6"><%= t(".debates") %></h4>
25
- <p><%= t(".debates_explanation") %></p>
24
+ <h4 class="heading6"><%= t("decidim.pages.home.extended.debates") %></h4>
25
+ <p><%= t("decidim.pages.home.extended.debates_explanation") %></p>
26
26
  </div>
27
27
  </div>
28
28
  </div>
@@ -32,8 +32,8 @@
32
32
  <%= icon "proposals" %>
33
33
  </div>
34
34
  <div class="home-bullet__desc">
35
- <h4 class="heading6"><%= t(".proposals") %></h4>
36
- <p><%= t(".proposals_explanation") %></p>
35
+ <h4 class="heading6"><%= t("decidim.pages.home.extended.proposals") %></h4>
36
+ <p><%= t("decidim.pages.home.extended.proposals_explanation") %></p>
37
37
  </div>
38
38
  </div>
39
39
  </div>
@@ -41,7 +41,7 @@
41
41
  <div class="row">
42
42
  <div class="columns small-centered small-10
43
43
  smallmedium-8 medium-6 large-4">
44
- <%= link_to t(".more_info"), page_path("faq"), class: "button expanded hollow button--sc" %>
44
+ <%= link_to t("decidim.pages.home.extended.more_info"), decidim.page_path("faq"), class: "button expanded hollow button--sc" %>
45
45
  </div>
46
46
  </div>
47
47
  </div>
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ContentBlocks
5
+ class HowToParticipateCell < Decidim::ViewModel
6
+ include Decidim::IconHelper
7
+ end
8
+ end
9
+ end
@@ -1,7 +1,7 @@
1
- <section class="extended" id="statistics">
1
+ <section class="extended home-section" id="statistics">
2
2
  <div class="wrapper-home">
3
3
  <div class="row column text-center">
4
- <h3 class="heading2"><%= t(".headline", organization: current_organization.name) %></h3>
4
+ <h3 class="heading2"><%= t("decidim.pages.home.statistics.headline", organization: current_organization.name) %></h3>
5
5
  </div>
6
6
  <div class="row">
7
7
  <div class="columns small-centered mediumlarge-10 large-8">
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ContentBlocks
5
+ class StatsCell < Decidim::ViewModel
6
+ delegate :current_organization, to: :controller
7
+
8
+ def show
9
+ return unless current_organization.show_statistics?
10
+ render
11
+ end
12
+
13
+ def stats
14
+ @stats ||= HomeStatsPresenter.new(organization: current_organization)
15
+ end
16
+ end
17
+ end
18
+ end
@@ -3,8 +3,8 @@
3
3
  <div class="columns small-centered large-10">
4
4
  <h2 class="heading3"><%= decidim_sanitize translated_attribute current_organization.description %></h2>
5
5
  <% unless current_user %>
6
- <%= link_to new_user_registration_path, class: "button--sc link subhero-cta" do %>
7
- <%= t(".register") %>
6
+ <%= link_to decidim.new_user_registration_path, class: "button--sc link subhero-cta" do %>
7
+ <%= t("decidim.pages.home.sub_hero.register") %>
8
8
  <%= icon "chevron-right", aria_hidden: true %>
9
9
  <% end %>
10
10
  <% end %>
@@ -0,0 +1,17 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module ContentBlocks
5
+ class SubHeroCell < Decidim::ViewModel
6
+ include Decidim::IconHelper
7
+ include Decidim::SanitizeHelper
8
+
9
+ def show
10
+ return if translated_attribute(current_organization.description).blank?
11
+ render
12
+ end
13
+
14
+ delegate :current_organization, to: :controller
15
+ end
16
+ end
17
+ end
@@ -0,0 +1,18 @@
1
+ <div class="conversation">
2
+ <%= cell "decidim/conversation_header", recipient %>
3
+
4
+ <div id="messages">
5
+ <% conversation.messages.each do |message| %>
6
+ <%= cell "decidim/message", message %>
7
+ <% end %>
8
+ </div>
9
+
10
+ <div class="conversation-reply conversation-reply--offset">
11
+ <h2 class="section-heading"><%= t("decidim.messaging.conversations.show.reply") %></h2>
12
+ <%= form_for @form, url: decidim.conversation_path(conversation.id), method: :put, remote: true do |f| %>
13
+ <%= f.text_area :body, label: false, rows: 4, required: true %>
14
+
15
+ <%= f.submit t("decidim.messaging.conversations.show.send"), data: { disable: true }, class: "button secondary light pull-right" %>
16
+ <% end %>
17
+ </div>
18
+ </div>
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ class ConversationCell < Decidim::ViewModel
5
+ include Decidim::Core::Engine.routes.url_helpers
6
+ include ActionView::Helpers::DateHelper
7
+
8
+ delegate :current_user, to: :controller
9
+
10
+ def show
11
+ @form = Decidim::Messaging::MessageForm.new
12
+ render :show
13
+ end
14
+
15
+ def recipient
16
+ @recipient ||= conversation.interlocutors(current_user).first
17
+ end
18
+
19
+ def conversation
20
+ @conversation ||= context[:conversation]
21
+ end
22
+ end
23
+ end
@@ -0,0 +1,17 @@
1
+ <div class="conversation-header flex--cc absolutes">
2
+ <div class="left center mr-s">
3
+ <%= link_to conversations_path, "data-tabs-target": "conversations" do %>
4
+ <%= icon "chevron-left", class: "card__link icon--big" %>
5
+ <% end %>
6
+ </div>
7
+
8
+ <%= link_to recipient.profile_path do %>
9
+ <%= image_tag recipient.avatar_url %>
10
+ <% end %>
11
+
12
+ <div class="ml-s">
13
+ <%= t("decidim.messaging.conversations.show.conversation_with_html", name: recipient.name) %>
14
+ <br />
15
+ <span class="muted"><%= recipient.nickname %></span>
16
+ </div>
17
+ </div>