decidim-meetings 0.0.3 → 0.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 39ecff3ff25e1f270d3bcd1b057d2f6035179297
4
- data.tar.gz: a9796345f56085b0bf6613ec26b83823fb8e1652
3
+ metadata.gz: 8042c1ee86056372caec282e1b3e663492cfa664
4
+ data.tar.gz: 76a12945a27cc259cec4131655c7630fed8bb142
5
5
  SHA512:
6
- metadata.gz: 23ab8448060b0e8b10c0f079a31ded9cda519842ca798c0e5c42a4fb17acd5b9b5ce73c9ce4a9d0b5c66dabc3899fe4e5a78065da5709b3698a7de383b3b1f5b
7
- data.tar.gz: 37d206c6c7ff80a8d82416233c6a30a2c9f868c6acff8ab5d6a3b2f0a517ab394d9c56fc3b8ad50f3c53bb50ba70616e511051f41c8cd022c324f322607733b9
6
+ metadata.gz: 46eb80f168fe576614772d45ed418e0301ede6628e60dc7ec7c874b3191c60ba8aeb0681fad4820a79036713fd65088a2db87c5c9a6a027d095120bcd2a80e75
7
+ data.tar.gz: 193d415e8a9a3cb445ee1392c4fb4d4c509aad59255ddf8d0e865ea7195f3eb31d8ae57fc422fc54f835e43bd74fe5cfcff0544d4c2f59d1ca08a7133d0fab4d
@@ -1,6 +1,7 @@
1
1
  // = require leaflet
2
2
  // = require leaflet-tilelayer-here
3
3
  // = require leaflet-svg-icon
4
+ // = require leaflet.markercluster
4
5
  // = require jquery-tmpl
5
6
  // = require_self
6
7
 
@@ -22,13 +23,13 @@ L.DivIcon.SVGIcon.DecidimIcon = L.DivIcon.SVGIcon.extend({
22
23
  const popupTemplateId = 'meeting-popup';
23
24
  $.template('meeting-popup', $(`#${popupTemplateId}`).html());
24
25
 
25
- const addMarkers = (meetingsData, map) => {
26
+ const addMarkers = (meetingsData, markerClusters, map) => {
26
27
  const bounds = new L.LatLngBounds(meetingsData.map((meeting) => [meeting.latitude, meeting.longitude]));
27
28
 
28
29
  meetingsData.forEach((meeting) => {
29
30
  let marker = L.marker([meeting.latitude, meeting.longitude], {
30
31
  icon: new L.DivIcon.SVGIcon.DecidimIcon()
31
- }).addTo(map);
32
+ });
32
33
  let node = document.createElement('div');
33
34
 
34
35
  $.tmpl('meeting-popup', meeting).appendTo(node);
@@ -39,12 +40,16 @@ const addMarkers = (meetingsData, map) => {
39
40
  keepInView: true,
40
41
  className: 'map-info'
41
42
  }).openPopup();
43
+
44
+ markerClusters.addLayer(marker);
42
45
  });
43
46
 
47
+ map.addLayer(markerClusters);
44
48
  map.fitBounds(bounds, { padding: [100, 100] });
45
49
  };
46
50
 
47
51
  const loadMap = (mapId, meetingsData) => {
52
+ let markerClusters = L.markerClusterGroup();
48
53
  const { hereAppId, hereAppCode } = window.DecidimMeetings.mapConfiguration;
49
54
 
50
55
  if (window.DecidimMeetings.currentMap) {
@@ -60,7 +65,7 @@ const loadMap = (mapId, meetingsData) => {
60
65
  }).addTo(map);
61
66
 
62
67
  if (meetingsData.length > 0) {
63
- addMarkers(meetingsData, map);
68
+ addMarkers(meetingsData, markerClusters, map);
64
69
  } else {
65
70
  map.fitWorld();
66
71
  }
@@ -1 +1,3 @@
1
- /* = require leaflet */
1
+ /* = require leaflet */
2
+ /* = require MarkerCluster */
3
+ /* = require MarkerCluster.Default */
@@ -26,7 +26,7 @@ module Decidim
26
26
  end
27
27
 
28
28
  def meeting
29
- @meeting ||= meetings.find(params[:id])
29
+ @meeting ||= Meeting.where(feature: current_feature).find(params[:id])
30
30
  end
31
31
 
32
32
  def search_klass
@@ -35,7 +35,7 @@ module Decidim
35
35
 
36
36
  def default_filter_params
37
37
  {
38
- order_start_time: "asc",
38
+ date: "upcoming",
39
39
  search_text: "",
40
40
  scope_id: "",
41
41
  category_id: ""
@@ -15,7 +15,8 @@ module Decidim
15
15
  attribute :closed_at, DateTime, default: ->(_form, _attribute) { Time.current }
16
16
 
17
17
  validates :closing_report, translatable_presence: true
18
- validates :attendees_count, :contributions_count, presence: true, numericality: { greater_than_or_equal_to: 0 }
18
+ validates :attendees_count, presence: true, numericality: { greater_than_or_equal_to: 0 }
19
+ validates :contributions_count, numericality: true, allow_blank: true
19
20
  validates :attending_organizations, presence: true
20
21
 
21
22
  # Private: Gets the proposals from the meeting and injects them to the form.
@@ -11,8 +11,8 @@ module Decidim
11
11
  translatable_attribute :location, String
12
12
  translatable_attribute :location_hints, String
13
13
  attribute :address, String
14
- attribute :start_time, DateTime
15
- attribute :end_time, DateTime
14
+ attribute :start_time, Decidim::Attributes::TimeWithZone
15
+ attribute :end_time, Decidim::Attributes::TimeWithZone
16
16
  attribute :decidim_scope_id, Integer
17
17
  attribute :decidim_category_id, Integer
18
18
 
@@ -34,6 +34,7 @@ module Decidim
34
34
  description: translated_attribute(meeting.description),
35
35
  startTimeDay: l(meeting.start_time, format: "%d"),
36
36
  startTimeMonth: l(meeting.start_time, format: "%B"),
37
+ startTimeYear: l(meeting.start_time, format: "%Y"),
37
38
  startTime: "#{meeting.start_time.strftime("%H:%M")} - #{meeting.end_time.strftime("%H:%M")}",
38
39
  icon: icon("meetings", width: 40, height: 70, remove_icon_class: true),
39
40
  location: translated_attribute(meeting.location),
@@ -20,9 +20,13 @@ module Decidim
20
20
  .or(query.where(localized_search_text_in(:description), text: "%#{search_text}%"))
21
21
  end
22
22
 
23
- # Handle the order_start_time filter
24
- def search_order_start_time
25
- query.order(start_time: order_start_time)
23
+ # Handle the date filter
24
+ def search_date
25
+ if options[:date] == "upcoming"
26
+ query.where("start_time >= ? ", Time.current).order("start_time ASC")
27
+ elsif options[:date] == "past"
28
+ query.where("start_time <= ? ", Time.current).order("start_time DESC")
29
+ end
26
30
  end
27
31
 
28
32
  # Handle the scope_id filter
@@ -1,6 +1,6 @@
1
1
  <h3><%= t ".title" %></h3>
2
2
 
3
- <%= form_for(@form, url: meeting_meeting_close_path(meeting, @form)) do |f| %>
3
+ <%= decidim_form_for(@form, url: meeting_meeting_close_path(meeting, @form)) do |f| %>
4
4
  <%= render partial: 'form', object: f %>
5
5
 
6
6
  <div class="actions">
@@ -1,6 +1,6 @@
1
1
  <h3><%= t ".title" %></h3>
2
2
 
3
- <%= form_for(@form) do |f| %>
3
+ <%= decidim_form_for(@form) do |f| %>
4
4
  <%= render partial: 'form', object: f %>
5
5
 
6
6
  <div class="actions">
@@ -1,6 +1,6 @@
1
1
  <h3><%= t ".title" %></h3>
2
2
 
3
- <%= form_for(@form) do |f| %>
3
+ <%= decidim_form_for(@form) do |f| %>
4
4
  <%= render partial: 'form', object: f %>
5
5
 
6
6
  <div class="actions">
@@ -1,6 +1,6 @@
1
1
  <div class="card__datetime">
2
2
  <div class="card__datetime__date">
3
- <%= l meeting.start_time, format: "%d" %> <span class="card__datetime__month"><%= l meeting.start_time, format: "%B" %></span>
3
+ <%= l meeting.start_time, format: "%d" %> <span class="card__datetime__month"><%= l meeting.start_time, format: "%B %Y" %></span>
4
4
  </div>
5
5
  <div class="card__datetime__time">
6
6
  <%= meeting.start_time.strftime("%H:%M") %> - <%= meeting.end_time.strftime("%H:%M") %>
@@ -2,23 +2,23 @@
2
2
  <div class="filters__section">
3
3
  <div class="filters__search">
4
4
  <div class="input-group">
5
- <%= form.search_field :search_text, label: false, class: "input-group-field", placeholder: t('.search') %>
5
+ <%= form.search_field :search_text, label: false, class: "input-group-field", placeholder: t(".search") %>
6
6
  <div class="input-group-button">
7
7
  <button type="submit" class="button button--muted">
8
- <%= icon "magnifying-glass", aria_label: t('.search') %>
8
+ <%= icon "magnifying-glass", aria_label: t(".search") %>
9
9
  </button>
10
10
  </div>
11
11
  </div>
12
12
  </div>
13
13
  </div>
14
14
 
15
- <%= form.collection_radio_buttons :order_start_time, [["asc", t('.ascendent')], ["desc", t('.descendent')]], :first, :last, legend_title: t('.date') %>
15
+ <%= form.collection_radio_buttons :date, [["upcoming", t(".upcoming")], ["past", t(".past")]], :first, :last, legend_title: t(".date") %>
16
16
 
17
17
  <% if current_organization.scopes.any? %>
18
- <%= form.collection_check_boxes :scope_id, current_organization.scopes, lambda {|scope| scope.id.to_s}, :name, legend_title: t('.scopes') %>
18
+ <%= form.collection_check_boxes :scope_id, current_organization.scopes, lambda {|scope| scope.id.to_s}, :name, legend_title: t(".scopes") %>
19
19
  <% end %>
20
20
 
21
21
  <% if current_feature.categories.any? %>
22
- <%= form.categories_select :category_id, current_feature.categories, legend_title: t('.category'), disable_parents: false, label: false, include_blank: true %>
22
+ <%= form.categories_select :category_id, current_feature.categories, legend_title: t(".category"), disable_parents: false, label: false, include_blank: true %>
23
23
  <% end %>
24
24
  <% end %>
@@ -8,7 +8,7 @@
8
8
  <% end %>
9
9
  <div class="card__datetime">
10
10
  <div class="card__datetime__date">
11
- <%= l meeting.start_time, format: "%d" %> <span class="card__datetime__month"><%= l meeting.start_time, format: "%B" %></span>
11
+ <%= l meeting.start_time, format: "%d" %> <span class="card__datetime__month"><%= l meeting.start_time, format: "%B %Y" %></span>
12
12
  </div>
13
13
  <div class="card__datetime__time">
14
14
  <%= meeting.start_time.strftime("%H:%M") %> - <%= meeting.end_time.strftime("%H:%M") %>
@@ -1,5 +1,3 @@
1
- <% content_for(:title, t(".title")) %>
2
-
3
1
  <% if Decidim.geocoder.present? %>
4
2
  <div class="row column">
5
3
  <div class="google-map" id="meetings-map" data-meetings="<%= meetings_data_for_map(geocoded_meetings).to_json %>" data-here-app-id="<%= Decidim.geocoder[:here_app_id] %>" data-here-app-code="<%= Decidim.geocoder[:here_app_code] %>">
@@ -13,7 +11,7 @@
13
11
  <div class="map__date-adress">
14
12
  <div class="card__datetime">
15
13
  <div class="card__datetime__date">
16
- ${startTimeDay} <span class="card__datetime__month">${startTimeMonth}</span>
14
+ ${startTimeDay} <span class="card__datetime__month">${startTimeMonth} ${startTimeYear}</span>
17
15
  </div>
18
16
  <div class="card__datetime__time">${starTime}</div>
19
17
  </div>
@@ -1,4 +1,10 @@
1
- <% content_for(:title, translated_attribute(meeting.title)) %>
1
+ <% provide(:title, translated_attribute(meeting.title)) %>
2
+
3
+ <% add_decidim_meta_tags({
4
+ title: translated_attribute(meeting.title),
5
+ description: translated_attribute(meeting.description),
6
+ url: meeting_url(meeting.id)
7
+ }) %>
2
8
 
3
9
  <div class="row column view-header">
4
10
  <h2 class="heading2"><%= translated_attribute meeting.title %></h2>
@@ -18,20 +24,28 @@
18
24
  </div>
19
25
  <% if meeting.closed? %>
20
26
  <div class="card card--secondary extra definition-data">
21
- <div class="definition-data__item definition-data__item--double">
22
- <span class="definition-data__title"><%= t(".attendees") %></span>
23
- <span class="definition-data__number"><%= meeting.attendees_count %></span>
24
- </div>
25
- <div class="definition-data__item definition-data__item--double">
26
- <span class="definition-data__title"><%= t(".contributions") %></span>
27
- <span class="definition-data__number"><%= meeting.contributions_count %></span>
28
- </div>
27
+ <% if meeting.contributions_count && meeting.contributions_count.positive? %>
28
+ <div class="definition-data__item definition-data__item--double">
29
+ <span class="definition-data__title"><%= t(".attendees") %></span>
30
+ <span class="definition-data__number"><%= meeting.attendees_count %></span>
31
+ </div>
32
+ <div class="definition-data__item definition-data__item--double">
33
+ <span class="definition-data__title"><%= t(".contributions") %></span>
34
+ <span class="definition-data__number"><%= meeting.contributions_count %></span>
35
+ </div>
36
+ <% else %>
37
+ <div class="definition-data__item">
38
+ <span class="definition-data__title"><%= t(".attendees") %></span>
39
+ <span class="definition-data__number"><%= meeting.attendees_count %></span>
40
+ </div>
41
+ <% end %>
29
42
  <div class="definition-data__item">
30
43
  <span class="definition-data__title"><%= t(".organizations") %></span>
31
44
  <span class="definition-data__text"><%= meeting.attending_organizations %></span>
32
45
  </div>
33
46
  </div>
34
47
  <% end %>
48
+ <%= render partial: "decidim/shared/share_modal" %>
35
49
  </div>
36
50
  <div class="columns mediumlarge-8 mediumlarge-pull-4">
37
51
  <div class="section">
@@ -64,3 +78,6 @@
64
78
  </div>
65
79
  </div>
66
80
  <%= attachments_for meeting %>
81
+
82
+ <%= javascript_include_tag "decidim/proposals/social_share" %>
83
+ <%= stylesheet_link_tag "decidim/proposals/social_share" %>
@@ -10,7 +10,7 @@ ca:
10
10
  decidim:
11
11
  features:
12
12
  meetings:
13
- name: Llistat de trobades
13
+ name: Trobades
14
14
  meetings:
15
15
  actions:
16
16
  attachments: Adjunts
@@ -38,7 +38,7 @@ ca:
38
38
  title: Edita trobada
39
39
  update: Actualitzar trobada
40
40
  index:
41
- title: Llistat de trobades
41
+ title: Trobades
42
42
  new:
43
43
  create: Crear trobada
44
44
  title: Nova trobada
@@ -50,19 +50,18 @@ ca:
50
50
  name: Trobada
51
51
  meetings:
52
52
  filters:
53
- ascendent: Ascendent
54
53
  category: Categoria
55
54
  date: Data
56
- descendent: Descendent
55
+ past: Passades
57
56
  scopes: Àmbits
58
57
  search: Cerca
58
+ upcoming: Properes
59
59
  filters_small_view:
60
60
  close_modal: Tancar finestra
61
61
  filter: Filtra
62
62
  filter_for: Filtra per
63
63
  unfold: Desplegar
64
64
  index:
65
- title: Llistat de trobades
66
65
  view_meeting: Veure trobada
67
66
  show:
68
67
  attendees: Nombre d'assistents
@@ -51,19 +51,18 @@ en:
51
51
  name: Meeting
52
52
  meetings:
53
53
  filters:
54
- ascendent: Ascendent
55
54
  category: Category
56
55
  date: Date
57
- descendent: Descendent
56
+ past: Past
58
57
  scopes: Scopes
59
58
  search: Search
59
+ upcoming: Upcoming
60
60
  filters_small_view:
61
61
  close_modal: Close modal
62
62
  filter: Filter
63
63
  filter_for: Filter by
64
64
  unfold: Unfold
65
65
  index:
66
- title: Meetings
67
66
  view_meeting: View meeting
68
67
  show:
69
68
  attendees: Attendees count
@@ -50,19 +50,18 @@ es:
50
50
  name: Encuentro
51
51
  meetings:
52
52
  filters:
53
- ascendent: Ascendente
54
53
  category: Categoría
55
54
  date: Fecha
56
- descendent: Descendiente
55
+ past: Pasadas
57
56
  scopes: Ámbitos
58
57
  search: Buscar
58
+ upcoming: Próximas
59
59
  filters_small_view:
60
60
  close_modal: Cerrar ventana
61
61
  filter: Filtrar
62
62
  filter_for: Filtrar por
63
63
  unfold: Desplegar
64
64
  index:
65
- title: Lista de encuentros
66
65
  view_meeting: Ver encuentro
67
66
  show:
68
67
  attendees: Número de asistentes
@@ -0,0 +1,5 @@
1
+ eu:
2
+ decidim:
3
+ meetings:
4
+ actions:
5
+ close: Itxi
@@ -22,6 +22,7 @@ Decidim.register_feature(:meetings) do |feature|
22
22
 
23
23
  feature = Decidim::Feature.create!(
24
24
  name: Decidim::Features::Namer.new(process.organization.available_locales, :meetings).i18n_name,
25
+ published_at: Time.current,
25
26
  manifest_name: :meetings,
26
27
  participatory_process: process
27
28
  )
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: decidim-meetings
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Josep Jaume Rey Peroy
@@ -10,7 +10,7 @@ authors:
10
10
  autorequire:
11
11
  bindir: bin
12
12
  cert_chain: []
13
- date: 2017-02-01 00:00:00.000000000 Z
13
+ date: 2017-02-17 00:00:00.000000000 Z
14
14
  dependencies:
15
15
  - !ruby/object:Gem::Dependency
16
16
  name: decidim-core
@@ -18,14 +18,14 @@ dependencies:
18
18
  requirements:
19
19
  - - '='
20
20
  - !ruby/object:Gem::Version
21
- version: 0.0.3
21
+ version: 0.0.5
22
22
  type: :runtime
23
23
  prerelease: false
24
24
  version_requirements: !ruby/object:Gem::Requirement
25
25
  requirements:
26
26
  - - '='
27
27
  - !ruby/object:Gem::Version
28
- version: 0.0.3
28
+ version: 0.0.5
29
29
  - !ruby/object:Gem::Dependency
30
30
  name: rectify
31
31
  requirement: !ruby/object:Gem::Requirement
@@ -88,14 +88,14 @@ dependencies:
88
88
  requirements:
89
89
  - - "~>"
90
90
  - !ruby/object:Gem::Version
91
- version: 1.4.1
91
+ version: 1.4.2
92
92
  type: :runtime
93
93
  prerelease: false
94
94
  version_requirements: !ruby/object:Gem::Requirement
95
95
  requirements:
96
96
  - - "~>"
97
97
  - !ruby/object:Gem::Version
98
- version: 1.4.1
98
+ version: 1.4.2
99
99
  - !ruby/object:Gem::Dependency
100
100
  name: httparty
101
101
  requirement: !ruby/object:Gem::Requirement
@@ -130,42 +130,42 @@ dependencies:
130
130
  requirements:
131
131
  - - '='
132
132
  - !ruby/object:Gem::Version
133
- version: 0.0.3
133
+ version: 0.0.5
134
134
  type: :development
135
135
  prerelease: false
136
136
  version_requirements: !ruby/object:Gem::Requirement
137
137
  requirements:
138
138
  - - '='
139
139
  - !ruby/object:Gem::Version
140
- version: 0.0.3
140
+ version: 0.0.5
141
141
  - !ruby/object:Gem::Dependency
142
142
  name: decidim-proposals
143
143
  requirement: !ruby/object:Gem::Requirement
144
144
  requirements:
145
145
  - - '='
146
146
  - !ruby/object:Gem::Version
147
- version: 0.0.3
147
+ version: 0.0.5
148
148
  type: :development
149
149
  prerelease: false
150
150
  version_requirements: !ruby/object:Gem::Requirement
151
151
  requirements:
152
152
  - - '='
153
153
  - !ruby/object:Gem::Version
154
- version: 0.0.3
154
+ version: 0.0.5
155
155
  - !ruby/object:Gem::Dependency
156
156
  name: decidim-admin
157
157
  requirement: !ruby/object:Gem::Requirement
158
158
  requirements:
159
159
  - - '='
160
160
  - !ruby/object:Gem::Version
161
- version: 0.0.3
161
+ version: 0.0.5
162
162
  type: :development
163
163
  prerelease: false
164
164
  version_requirements: !ruby/object:Gem::Requirement
165
165
  requirements:
166
166
  - - '='
167
167
  - !ruby/object:Gem::Version
168
- version: 0.0.3
168
+ version: 0.0.5
169
169
  - !ruby/object:Gem::Dependency
170
170
  name: webmock
171
171
  requirement: !ruby/object:Gem::Requirement
@@ -186,14 +186,14 @@ dependencies:
186
186
  requirements:
187
187
  - - '='
188
188
  - !ruby/object:Gem::Version
189
- version: 0.0.3
189
+ version: 0.0.5
190
190
  type: :development
191
191
  prerelease: false
192
192
  version_requirements: !ruby/object:Gem::Requirement
193
193
  requirements:
194
194
  - - '='
195
195
  - !ruby/object:Gem::Version
196
- version: 0.0.3
196
+ version: 0.0.5
197
197
  description: ''
198
198
  email:
199
199
  - josepjaume@gmail.com
@@ -247,6 +247,7 @@ files:
247
247
  - config/locales/ca.yml
248
248
  - config/locales/en.yml
249
249
  - config/locales/es.yml
250
+ - config/locales/eu.yml
250
251
  - db/migrate/20161130121354_create_meetings.rb
251
252
  - db/migrate/20170110142105_close_a_meeting.rb
252
253
  - db/migrate/20170123151650_add_latitude_and_longitude_to_meetings.rb