decidim-meetings 0.14.4 → 0.15.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (81) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +6 -0
  3. data/app/assets/config/{admin/decidim_meetings_manifest.js → decidim_meetings_manifest.js} +1 -0
  4. data/app/assets/images/decidim/gamification/badges/attended_meetings.svg +106 -0
  5. data/app/cells/decidim/meetings/content_blocks/upcoming_events/show.erb +26 -0
  6. data/app/cells/decidim/meetings/content_blocks/upcoming_events_cell.rb +52 -0
  7. data/app/cells/decidim/meetings/meeting_activity_cell.rb +19 -0
  8. data/app/cells/decidim/meetings/meeting_cell.rb +6 -0
  9. data/app/cells/decidim/meetings/meeting_list_item_cell.rb +1 -1
  10. data/app/cells/decidim/meetings/meeting_m/address.erb +1 -14
  11. data/app/cells/decidim/meetings/meeting_m_cell.rb +7 -3
  12. data/app/cells/decidim/meetings/meeting_s/show.erb +27 -0
  13. data/app/cells/decidim/meetings/meeting_s_cell.rb +31 -0
  14. data/app/cells/decidim/meetings/meetings_map/show.erb +33 -0
  15. data/app/cells/decidim/meetings/meetings_map_cell.rb +23 -0
  16. data/app/commands/decidim/meetings/admin/create_meeting.rb +12 -5
  17. data/app/commands/decidim/meetings/admin/update_meeting.rb +5 -2
  18. data/app/commands/decidim/meetings/join_meeting.rb +5 -0
  19. data/app/commands/decidim/meetings/leave_meeting.rb +5 -0
  20. data/app/controllers/decidim/meetings/admin/application_controller.rb +1 -0
  21. data/app/controllers/decidim/meetings/admin/registrations_controller.rb +1 -0
  22. data/app/controllers/decidim/meetings/directory/meetings_controller.rb +73 -0
  23. data/app/controllers/decidim/meetings/meetings_controller.rb +8 -6
  24. data/app/helpers/decidim/meetings/map_helper.rb +4 -3
  25. data/app/helpers/decidim/meetings/meeting_cells_helper.rb +0 -1
  26. data/app/helpers/decidim/meetings/meetings_helper.rb +1 -1
  27. data/app/mailers/decidim/meetings/admin/invite_join_meeting_mailer.rb +2 -0
  28. data/app/mailers/decidim/meetings/registration_mailer.rb +4 -2
  29. data/app/models/decidim/meetings/meeting.rb +3 -0
  30. data/app/presenters/decidim/meetings/admin_log/meeting_presenter.rb +6 -2
  31. data/app/presenters/decidim/meetings/admin_log/value_types/meeting_title_description_presenter.rb +20 -0
  32. data/app/presenters/decidim/meetings/log/resource_presenter.rb +18 -0
  33. data/app/presenters/decidim/meetings/meeting_presenter.rb +40 -0
  34. data/app/queries/decidim/meetings/metrics/meetings_metric_manage.rb +53 -0
  35. data/app/services/decidim/meetings/meeting_search.rb +8 -1
  36. data/app/views/decidim/meetings/admin/agenda/_form.html.erb +1 -1
  37. data/app/views/decidim/meetings/admin/invite_join_meeting_mailer/invite.html.erb +2 -2
  38. data/app/views/decidim/meetings/admin/meeting_closes/_form.html.erb +3 -3
  39. data/app/views/decidim/meetings/admin/meeting_copies/_form.html.erb +2 -2
  40. data/app/views/decidim/meetings/admin/meetings/_form.html.erb +4 -4
  41. data/app/views/decidim/meetings/admin/meetings/index.html.erb +1 -1
  42. data/app/views/decidim/meetings/directory/meetings/_meetings.html.erb +14 -0
  43. data/app/views/decidim/meetings/directory/meetings/index.html.erb +34 -0
  44. data/app/views/decidim/meetings/directory/meetings/index.js.erb +11 -0
  45. data/app/views/decidim/meetings/meeting_widgets/show.html.erb +1 -1
  46. data/app/views/decidim/meetings/meetings/_linked_meetings.html.erb +2 -2
  47. data/app/views/decidim/meetings/meetings/index.html.erb +1 -33
  48. data/app/views/decidim/meetings/meetings/index.js.erb +1 -1
  49. data/app/views/decidim/meetings/meetings/show.html.erb +5 -5
  50. data/app/views/decidim/meetings/registration_mailer/confirmation.html.erb +1 -1
  51. data/app/views/decidim/participatory_processes/participatory_process_groups/_meeting.html.erb +1 -1
  52. data/app/views/decidim/participatory_spaces/_conference_venues.html.erb +20 -0
  53. data/config/locales/ca.yml +37 -2
  54. data/config/locales/de.yml +37 -0
  55. data/config/locales/en.yml +37 -2
  56. data/config/locales/es-PY.yml +37 -2
  57. data/config/locales/es.yml +37 -2
  58. data/config/locales/eu.yml +37 -0
  59. data/config/locales/fi.yml +37 -2
  60. data/config/locales/fr.yml +37 -0
  61. data/config/locales/gl.yml +37 -0
  62. data/config/locales/hu.yml +37 -0
  63. data/config/locales/it.yml +37 -0
  64. data/config/locales/nl.yml +37 -0
  65. data/config/locales/pl.yml +37 -0
  66. data/config/locales/pt-BR.yml +37 -0
  67. data/config/locales/pt.yml +37 -0
  68. data/config/locales/ru.yml +1 -0
  69. data/config/locales/sv.yml +37 -0
  70. data/config/locales/uk.yml +1 -0
  71. data/db/migrate/20180809134748_add_upcoming_events_as_content_block.rb +27 -0
  72. data/lib/decidim/meetings/admin_engine.rb +0 -4
  73. data/lib/decidim/meetings/component.rb +30 -3
  74. data/lib/decidim/meetings/directory.rb +10 -0
  75. data/lib/decidim/meetings/directory_engine.rb +32 -0
  76. data/lib/decidim/meetings/engine.rb +38 -1
  77. data/lib/decidim/meetings/seeds/city.jpeg +0 -0
  78. data/lib/decidim/meetings/test/factories.rb +13 -12
  79. data/lib/decidim/meetings/version.rb +1 -1
  80. data/lib/decidim/meetings.rb +2 -1
  81. metadata +34 -14
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c3a80a3e0834cd8c4fb113f36ea9921edc8ee7e26da8bd334ce0a8d4345fca82
4
- data.tar.gz: a45af092a11571f71e4e66bcb0e9e820fc583cb72c23eb79f47329474133b07c
3
+ metadata.gz: b804ad17a1daa6813bec7232c59b68a474de79aa9b4e1f43d3b0f866a6a55baa
4
+ data.tar.gz: 823b27f1efe76f2f3a1a338b9025f42d665e45e138af4ee632207f702a8674eb
5
5
  SHA512:
6
- metadata.gz: a65e3c988a40ab91fadf72a8d41cf78d8168d567113a80c21c1a584107e144f04cca6b4d165e8d3bb7cf5ebe035e6b5ecdfd21ba4b77b5c36c279b1f2594351f
7
- data.tar.gz: b439f9d1dbb9e5c84e78af1337923c7f1a6433f132f96c2bffcd683e04fdc9cdf0210678e3935918f24f4e83ec1429960629ceae688db1d9d540a2c51dd02ed0
6
+ metadata.gz: 13f77daa93bfb5283845fbf1772610f0e2d9f2064266a141fb2ebef843871381b0f64905bc8271fc523d93bfd51cd8497eb791fdfc7c324fb4827df0236684be
7
+ data.tar.gz: b049db58acfd97463789254b6704dccf227abb7a8c8f65bca251906e60826baeddd8223a278e7ac988769b6eb454c876c9ded06270eb4afd7f4485474c7bfed8
data/README.md CHANGED
@@ -20,6 +20,12 @@ And then execute:
20
20
  bundle
21
21
  ```
22
22
 
23
+ ## Global Search
24
+
25
+ This module includes the following models to Decidim's Global Search:
26
+
27
+ - `Meetings`
28
+
23
29
  ## Contributing
24
30
 
25
31
  See [Decidim](https://github.com/decidim/decidim).
@@ -3,3 +3,4 @@
3
3
  //= link decidim/meetings/admin/registrations_invite_form.js
4
4
  //= link decidim/meetings/admin/meetings_form.js
5
5
  //= link decidim/meetings/admin/agendas.js
6
+ //= link_tree ../images/decidim
@@ -0,0 +1,106 @@
1
+ <svg version="1.1" id="meetings-svg" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px"
2
+ y="0px" width="1080px" height="1080px" viewBox="0 0 1080 1080" enable-background="new 0 0 1080 1080" xml:space="preserve">
3
+ <g id="meetings" class="stroke-primary">
4
+ <g id="paper_down">
5
+
6
+ <polyline class="fill-primary" id="_x32_5-pct_14_" fill="#31536E" fill-opacity="0.25" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
7
+ 604.753,874.5 378.529,924.816 367.337,874.497 "/>
8
+
9
+ <polyline class="fill-primary" id="_x32_5-pct_13_" fill="#31536E" fill-opacity="0.25" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
10
+ 836.5,510.5 902.72,808.227 836.5,822.955 "/>
11
+
12
+ <polyline class="fill-primary" id="_x32_5-pct_12_" fill="#31536E" fill-opacity="0.25" stroke="#31536E" stroke-width="16" stroke-linejoin="round" stroke-miterlimit="10" points="
13
+ 531.249,205.5 757.471,155.184 766.35,197.105 "/>
14
+
15
+ <polyline class="fill-primary" id="_x32_5-pct_11_" fill="#31536E" fill-opacity="0.25" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
16
+ 299.5,569.499 233.28,271.774 299.5,257.045 "/>
17
+ </g>
18
+ <g id="paper">
19
+
20
+ <polyline fill="none" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
21
+ 836.5,294.5 836.5,874.5 299.5,874.5 299.5,824.5 "/>
22
+
23
+ <polyline fill="none" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
24
+ 299.5,661.5 299.5,205.5 755.5,205.5 "/>
25
+ </g>
26
+ <g id="pencil">
27
+ <path fill="none" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
28
+ M310.292,820.867l554.726-554.725c23.627-23.627,23.785-61.775,0.354-85.207l0,0c-23.433-23.431-61.58-23.273-85.206,0.354
29
+ L225.439,736.015l-47.714,132.567L310.292,820.867z"/>
30
+
31
+ <path class="fill-primary" id="_x35_0-pct_11_" fill="#31536E" fill-opacity="0.5" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
32
+ M836.379,294.78l28.639-28.638c23.627-23.627,23.785-61.775,0.354-85.207l0,0c-23.433-23.431-61.58-23.273-85.206,0.354
33
+ l-28.637,28.638"/>
34
+
35
+ <line fill="#31536E" stroke="#31536E" stroke-width="16" stroke-miterlimit="10" x1="751.527" y1="209.927" x2="836.38" y2="294.78"/>
36
+
37
+ <line fill="none" stroke="#31536E" stroke-width="16" stroke-miterlimit="10" x1="716.172" y1="245.283" x2="801.023" y2="330.136"/>
38
+
39
+ <polyline fill="none" stroke="#31536E" stroke-width="16" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="
40
+ 227.476,733.785 270.5,734.958 270.5,771.5 309.745,771.5 310.195,820.982 "/>
41
+
42
+ <polygon class="fill-primary" id="_x32_5-pct_15_" fill="#31536E" fill-opacity="0.25" stroke="#31536E" stroke-width="8" stroke-miterlimit="10" points="
43
+ 310.292,771.37 776.275,305.387 738.092,267.203 270.694,734.601 270.5,771.5 "/>
44
+ <polygon class="fill-primary" fill="#31536E" points="177.629,868.678 200.69,804.604 241.703,845.616 "/>
45
+ </g>
46
+ <g id="stars_8" class="stars">
47
+
48
+ <path fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
49
+ M155.26,565.735c0-14.688-18.667-35.354-35.355-35.354c15.355,0,35.355-20.333,35.355-35.355
50
+ c0,15.022,16.666,35.355,35.355,35.355C171.593,530.381,155.26,551.048,155.26,565.735z"/>
51
+ <g>
52
+
53
+ <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="904.382" cy="162.858" r="13.5"/>
54
+
55
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="887.883" y1="146.123" x2="866.67" y2="124.91"/>
56
+
57
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="921.824" y1="180.064" x2="943.037" y2="201.277"/>
58
+
59
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="921.117" y1="146.83" x2="942.33" y2="125.617"/>
60
+
61
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="887.883" y1="180.064" x2="866.67" y2="201.277"/>
62
+ </g>
63
+ <g>
64
+
65
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="266.689" y1="898.798" x2="240.528" y2="924.962"/>
66
+
67
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="231.335" y1="934.153" x2="205.173" y2="960.317"/>
68
+
69
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="265.982" y1="960.317" x2="239.82" y2="934.153"/>
70
+
71
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="230.628" y1="924.962" x2="204.466" y2="898.798"/>
72
+ </g>
73
+
74
+ <path fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" d="
75
+ M922.592,965.056c0,0-21.565,4.035-26.516,8.983c-4.948,4.947-8.982,26.515-8.982,26.515s-4.035-21.564-8.983-26.515
76
+ c-4.947-4.948-26.515-8.983-26.515-8.983s22.077-4.546,26.515-8.982c4.438-4.438,8.983-26.516,8.983-26.516
77
+ s4.034,21.565,8.982,26.516C901.025,961.021,922.592,965.056,922.592,965.056z"/>
78
+ <g>
79
+
80
+ <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="896.863" cy="447.201" r="16.604"/>
81
+
82
+ <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="860.962" cy="447.201" r="6.432"/>
83
+
84
+ <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="896.863" cy="483.103" r="6.433"/>
85
+
86
+ <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="932.765" cy="447.201" r="6.432"/>
87
+
88
+ <circle fill="#FFD92B" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" cx="896.863" cy="411.3" r="6.432"/>
89
+ </g>
90
+ <g>
91
+
92
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="298.746" y1="98.42" x2="353.649" y2="153.325"/>
93
+
94
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="353.649" y1="98.42" x2="298.746" y2="153.325"/>
95
+
96
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="308" y1="125.447" x2="281" y2="125.447"/>
97
+
98
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="346" y1="125.447" x2="373" y2="125.447"/>
99
+
100
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="327" y1="144.447" x2="327" y2="171.447"/>
101
+
102
+ <line fill="none" stroke="#31536E" stroke-width="4" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" x1="327" y1="106.447" x2="327" y2="79.447"/>
103
+ </g>
104
+ </g>
105
+ </g>
106
+ </svg>
@@ -0,0 +1,26 @@
1
+ <section class="wrapper-home upcoming-events home-section">
2
+ <div class="row">
3
+ <h3 class="section-heading"><%= t("decidim.meetings.content_blocks.upcoming_events.upcoming_events") %></h3>
4
+ <div class="row">
5
+ <div class="columns medium-6">
6
+ <% upcoming_events.first(4).each do |event| %>
7
+ <%= card_for event, size: :s %>
8
+ <% end %>
9
+ </div>
10
+ <div class="columns medium-6">
11
+ <% if geolocation_enabled? %>
12
+ <%= cell "decidim/meetings/meetings_map", upcoming_events %>
13
+ <% else %>
14
+ <% upcoming_events.last(4).each do |event| %>
15
+ <%= card_for event, size: :s %>
16
+ <% end %>
17
+ <% end %>
18
+ </div>
19
+ </div>
20
+ <div class="row">
21
+ <div class="column">
22
+ <%= link_to t("decidim.meetings.content_blocks.upcoming_events.view_all_events"), meetings_directory_path, class: "button hollow button--sc pull-right" %>
23
+ </div>
24
+ </div>
25
+ </div>
26
+ </section>
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ module ContentBlocks
6
+ class UpcomingEventsCell < Decidim::ViewModel
7
+ include Decidim::CardHelper
8
+
9
+ delegate :current_organization, to: :controller
10
+
11
+ def show
12
+ return if upcoming_events.blank?
13
+ render
14
+ end
15
+
16
+ def upcoming_events
17
+ @upcoming_events ||= Decidim::Meetings::Meeting
18
+ .includes(component: :participatory_space)
19
+ .where(component: meeting_components)
20
+ .where("end_time >= ?", Time.current)
21
+ .order(start_time: :asc)
22
+ .limit(limit)
23
+ end
24
+
25
+ def geolocation_enabled?
26
+ Decidim.geocoder.present?
27
+ end
28
+
29
+ def meetings_directory_path
30
+ Decidim::Meetings::DirectoryEngine.routes.url_helpers.root_path
31
+ end
32
+
33
+ private
34
+
35
+ def limit
36
+ geolocation_enabled? ? 4 : 8
37
+ end
38
+
39
+ def meeting_components
40
+ @meeting_components ||= Decidim::Component
41
+ .where(manifest_name: "meetings")
42
+ .where(participatory_space: participatory_spaces)
43
+ .published
44
+ end
45
+
46
+ def participatory_spaces
47
+ @participatory_spaces ||= current_organization.public_participatory_spaces
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,19 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ # A cell to display when a meeting has been created.
6
+ class MeetingActivityCell < ActivityCell
7
+ def title
8
+ I18n.t(
9
+ "decidim.meetings.last_activity.new_meeting_at_html",
10
+ link: participatory_space_link
11
+ )
12
+ end
13
+
14
+ def resource_link_text
15
+ Decidim::Meetings::MeetingPresenter.new(resource).title
16
+ end
17
+ end
18
+ end
19
+ end
@@ -19,11 +19,17 @@ module Decidim
19
19
  case @options[:size]
20
20
  when :list_item
21
21
  "decidim/meetings/meeting_list_item"
22
+ when :s
23
+ "decidim/meetings/meeting_s"
22
24
  else
23
25
  "decidim/meetings/meeting_m"
24
26
  end
25
27
  end
26
28
 
29
+ def title
30
+ present(model).title
31
+ end
32
+
27
33
  def resource_icon
28
34
  icon "meetings", remove_icon_class: true, width: 40, height: 70
29
35
  end
@@ -18,7 +18,7 @@ module Decidim
18
18
  end
19
19
 
20
20
  def title
21
- translated_attribute model.title
21
+ present(model).title
22
22
  end
23
23
 
24
24
  def resource_date_time
@@ -1,14 +1 @@
1
- <div class="card__icondata">
2
- <ul class="card-data">
3
- <li class="card-data__item">
4
- <%= resource_icon %>
5
- </li>
6
- <li class="card-data__item">
7
- <div class="text-left">
8
- <div class="card__icondata--address">
9
- <%= render partial: "decidim/shared/address_details.html", locals: { geolocalizable: model } %>
10
- </div>
11
- </div>
12
- </li>
13
- </ul>
14
- </div>
1
+ <%= cell "decidim/address", model %>
@@ -11,12 +11,16 @@ module Decidim
11
11
  render
12
12
  end
13
13
 
14
- private
14
+ def address
15
+ render
16
+ end
15
17
 
16
- def resource_icon
17
- icon "meetings", class: "icon--big"
18
+ def title
19
+ present(model).title
18
20
  end
19
21
 
22
+ private
23
+
20
24
  def spans_multiple_dates?
21
25
  start_date != end_date
22
26
  end
@@ -0,0 +1,27 @@
1
+ <article class="card">
2
+ <div class="p-s">
3
+ <div class="card__header">
4
+ <%= link_to meeting_path, class: "card__link" do %>
5
+ <h5 class="card__title">
6
+ <%= title %>
7
+ </h5>
8
+ <% end %>
9
+ </div>
10
+ <div class="card__text">
11
+ <div class="row collapse text-medium">
12
+ <time datetime="<%= model.start_time.utc %>" class="column medium-4 icon--container">
13
+ <%= icon "datetime", class: "primary" %>
14
+ &nbsp;
15
+ <%= l start_date, format: :decidim_with_month_name %>
16
+ &nbsp;-&nbsp;
17
+ <%= formatted_start_time %>
18
+ </time>
19
+ <span class="column medium-8">
20
+ <%= participatory_space_class_name %>
21
+ &nbsp;
22
+ <%= link_to participatory_space_title, participatory_space_path %>
23
+ </span>
24
+ </div>
25
+ </div>
26
+ </div>
27
+ </article>
@@ -0,0 +1,31 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ # This cell renders the Small (:s) meeting card
6
+ # for an given instance of a Meeting
7
+ class MeetingSCell < MeetingMCell
8
+ delegate :title, to: :presenter
9
+
10
+ def meeting_path
11
+ resource_locator(model).path
12
+ end
13
+
14
+ def participatory_space_class_name
15
+ model.component.participatory_space.class.model_name.human
16
+ end
17
+
18
+ def participatory_space_title
19
+ translated_attribute model.component.participatory_space.title
20
+ end
21
+
22
+ def participatory_space_path
23
+ resource_locator(model.component.participatory_space).path
24
+ end
25
+
26
+ def presenter
27
+ @presenter ||= Decidim::Meetings::MeetingPresenter.new(model)
28
+ end
29
+ end
30
+ end
31
+ end
@@ -0,0 +1,33 @@
1
+ <%= dynamic_map_for meetings_data_for_map(geocoded_meetings) do %>
2
+ <template id="marker-popup">
3
+ <div class="map-info__content">
4
+ <h3>${title}</h3>
5
+ <div id="bodyContent">
6
+ <p>{{html description}}</p>
7
+ <div class="map__date-adress">
8
+ <div class="card__datetime">
9
+ <div class="card__datetime__date">
10
+ ${startTimeDay} <span class="card__datetime__month">${startTimeMonth} ${startTimeYear}</span>
11
+ </div>
12
+ <div class="card__datetime__time">${starTime}</div>
13
+ </div>
14
+ <div class="address card__extra">
15
+ <div class="address__icon">{{html icon}}</div>
16
+ <div class="address__details">
17
+ <strong>{{html location}}</strong><br />
18
+ <span>${address}</span><br />
19
+ <span>{{html locationHints}}</span>
20
+ </div>
21
+ </div>
22
+ </div>
23
+ <div class="map-info__button">
24
+ <a href="${link}" class="button button--sc">
25
+ <%= t("decidim.meetings.meetings_map.view_meeting") %>
26
+ </a>
27
+ </div>
28
+ </div>
29
+ </div>
30
+ </template>
31
+ <%= stylesheet_link_tag "decidim/map" %>
32
+ <%= javascript_include_tag "decidim/map" %>
33
+ <% end.html_safe %>
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ class MeetingsMapCell < MeetingMCell
6
+ include Decidim::MapHelper
7
+ include Decidim::Meetings::MapHelper
8
+
9
+ def show
10
+ return if Decidim.geocoder.blank?
11
+ render
12
+ end
13
+
14
+ def geocoded_meetings
15
+ @geocoded_meetings ||= meetings.select(&:geocoded?)
16
+ end
17
+
18
+ def meetings
19
+ model
20
+ end
21
+ end
22
+ end
23
+ end
@@ -28,13 +28,13 @@ module Decidim
28
28
  private
29
29
 
30
30
  def create_meeting!
31
- @meeting = Decidim.traceability.create!(
32
- Meeting,
33
- @form.current_user,
31
+ parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, @form.title, current_organization: @form.current_organization).rewrite
32
+ parsed_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, @form.description, current_organization: @form.current_organization).rewrite
33
+ params = {
34
34
  scope: @form.scope,
35
35
  category: @form.category,
36
- title: @form.title,
37
- description: @form.description,
36
+ title: parsed_title,
37
+ description: parsed_description,
38
38
  services: @form.services_to_persist.map { |service| { "title" => service.title, "description" => service.description } },
39
39
  end_time: @form.end_time,
40
40
  start_time: @form.start_time,
@@ -48,6 +48,13 @@ module Decidim
48
48
  organizer: @form.organizer,
49
49
  registration_terms: @form.current_component.settings.default_registration_terms,
50
50
  component: @form.current_component
51
+ }
52
+
53
+ @meeting = Decidim.traceability.create!(
54
+ Meeting,
55
+ @form.current_user,
56
+ params,
57
+ visibility: "all"
51
58
  )
52
59
  end
53
60
 
@@ -35,13 +35,16 @@ module Decidim
35
35
  attr_reader :form, :meeting
36
36
 
37
37
  def update_meeting!
38
+ parsed_title = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.title, current_organization: form.current_organization).rewrite
39
+ parsed_description = Decidim::ContentProcessor.parse_with_processor(:hashtag, form.description, current_organization: form.current_organization).rewrite
40
+
38
41
  Decidim.traceability.update!(
39
42
  meeting,
40
43
  form.current_user,
41
44
  scope: form.scope,
42
45
  category: form.category,
43
- title: form.title,
44
- description: form.description,
46
+ title: parsed_title,
47
+ description: parsed_description,
45
48
  services: form.services_to_persist.map { |service| { "title" => service.title, "description" => service.description } },
46
49
  end_time: form.end_time,
47
50
  start_time: form.start_time,
@@ -24,6 +24,7 @@ module Decidim
24
24
  accept_invitation
25
25
  send_email_confirmation
26
26
  send_notification
27
+ increment_score
27
28
  end
28
29
  broadcast(:ok)
29
30
  end
@@ -70,6 +71,10 @@ module Decidim
70
71
  )
71
72
  end
72
73
 
74
+ def increment_score
75
+ Decidim::Gamification.increment_score(user, :attended_meetings)
76
+ end
77
+
73
78
  def occupied_slots_over?(percentage)
74
79
  @meeting.remaining_slots == (@meeting.available_slots * (1 - percentage)).round
75
80
  end
@@ -21,6 +21,7 @@ module Decidim
21
21
  @meeting.with_lock do
22
22
  return broadcast(:invalid) unless registration
23
23
  destroy_registration
24
+ decrement_score
24
25
  end
25
26
  broadcast(:ok)
26
27
  end
@@ -34,6 +35,10 @@ module Decidim
34
35
  def destroy_registration
35
36
  registration.destroy!
36
37
  end
38
+
39
+ def decrement_score
40
+ Decidim::Gamification.decrement_score(@user, :attended_meetings)
41
+ end
37
42
  end
38
43
  end
39
44
  end
@@ -9,6 +9,7 @@ module Decidim
9
9
  # Note that it inherits from `Decidim::Components::BaseController`, which
10
10
  # override its layout and provide all kinds of useful methods.
11
11
  class ApplicationController < Decidim::Admin::Components::BaseController
12
+ helper Decidim::ApplicationHelper
12
13
  helper_method :meetings, :meeting
13
14
 
14
15
  def meetings
@@ -16,6 +16,7 @@ module Decidim
16
16
  enforce_permission_to :update, :meeting, meeting: meeting
17
17
 
18
18
  @form = MeetingRegistrationsForm.from_params(params).with_context(current_organization: meeting.organization, meeting: meeting)
19
+ @validation_form = ValidateRegistrationCodeForm.new
19
20
 
20
21
  UpdateRegistrations.call(@form, meeting) do
21
22
  on(:ok) do
@@ -0,0 +1,73 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Decidim
4
+ module Meetings
5
+ module Directory
6
+ # Exposes the meeting resource so users can view them
7
+ class MeetingsController < Decidim::ApplicationController
8
+ layout "layouts/decidim/application"
9
+
10
+ include FilterResource
11
+ include Paginable
12
+
13
+ helper Decidim::WidgetUrlsHelper
14
+ helper Decidim::FiltersHelper
15
+ helper Decidim::Meetings::MapHelper
16
+ helper Decidim::ResourceHelper
17
+
18
+ helper_method :meetings, :search
19
+
20
+ def index
21
+ @meeting_spaces = search.results.map do |meeting|
22
+ klass = meeting.component.participatory_space.class
23
+ [klass.model_name.name.underscore, klass.model_name.human.pluralize]
24
+ end.uniq
25
+ @meeting_spaces = @meeting_spaces.sort_by do |_param, name|
26
+ name
27
+ end
28
+ @meeting_spaces = @meeting_spaces.prepend(["all", t(".all")])
29
+ end
30
+
31
+ private
32
+
33
+ def meetings
34
+ @meetings ||= paginate(search.results)
35
+ end
36
+
37
+ def search_klass
38
+ MeetingSearch
39
+ end
40
+
41
+ def default_filter_params
42
+ {
43
+ date: "upcoming",
44
+ search_text: "",
45
+ scope_id: "",
46
+ space: "all"
47
+ }
48
+ end
49
+
50
+ def default_search_params
51
+ {
52
+ scope: Meeting.visible_meeting_for(current_user)
53
+ }
54
+ end
55
+
56
+ def context_params
57
+ { component: meeting_components, organization: current_organization }
58
+ end
59
+
60
+ def meeting_components
61
+ @meeting_components ||= Decidim::Component
62
+ .where(manifest_name: "meetings")
63
+ .where(participatory_space: participatory_spaces)
64
+ .published
65
+ end
66
+
67
+ def participatory_spaces
68
+ @participatory_spaces ||= current_organization.public_participatory_spaces
69
+ end
70
+ end
71
+ end
72
+ end
73
+ end
@@ -8,7 +8,7 @@ module Decidim
8
8
  include Paginable
9
9
  helper Decidim::WidgetUrlsHelper
10
10
 
11
- helper_method :meetings, :geocoded_meetings, :meeting
11
+ helper_method :meetings, :meeting, :search
12
12
 
13
13
  def index
14
14
  return unless search.results.empty? && params.dig("filter", "date") != "past"
@@ -35,11 +35,7 @@ module Decidim
35
35
  end
36
36
 
37
37
  def meetings
38
- @meetings ||= paginate(search.results).visible_meeting_for(current_user)
39
- end
40
-
41
- def geocoded_meetings
42
- @geocoded_meetings ||= search.results.select(&:geocoded?)
38
+ @meetings ||= paginate(search.results)
43
39
  end
44
40
 
45
41
  def search_klass
@@ -55,6 +51,12 @@ module Decidim
55
51
  }
56
52
  end
57
53
 
54
+ def default_search_params
55
+ {
56
+ scope: Meeting.visible_meeting_for(current_user)
57
+ }
58
+ end
59
+
58
60
  def context_params
59
61
  { component: current_component, organization: current_organization }
60
62
  end