aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/controllers/calendars_controller.rb4
-rw-r--r--app/models/chouette/vehicle_journey.rb9
-rw-r--r--app/views/calendars/_filters.html.slim2
3 files changed, 7 insertions, 8 deletions
diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb
index 5370d9cbb..86d567882 100644
--- a/app/controllers/calendars_controller.rb
+++ b/app/controllers/calendars_controller.rb
@@ -33,10 +33,8 @@ class CalendarsController < BreadcrumbController
def collection
return @calendars if @calendars
- scope = Calendar.where('organisation_id = ?', current_organisation.id)
-
+ scope = Calendar.where('organisation_id = ? OR shared = ?', current_organisation.id, true)
scope = shared_scope(scope)
-
@q = scope.ransack(params[:q])
calendars = @q.result
diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb
index 24de88015..44dd85864 100644
--- a/app/models/chouette/vehicle_journey.rb
+++ b/app/models/chouette/vehicle_journey.rb
@@ -36,13 +36,14 @@ module Chouette
:calculate_vehicle_journey_at_stop_day_offset
def vjas_departure_time_must_be_before_next_stop_arrival_time
+ notice = 'departure time must be before next stop arrival time'
vehicle_journey_at_stops.each_with_index do |current_stop, index|
next_stop = vehicle_journey_at_stops[index + 1]
- next unless next_stop
- if next_stop[:arrival_time] <= current_stop[:departure_time]
- current_stop.errors.add(:departure_time, 'departure time must be before next stop arrival time')
- end
+ next unless next_stop && (next_stop[:arrival_time] < current_stop[:departure_time])
+
+ current_stop.errors.add(:departure_time, notice)
+ self.errors.add(:vehicle_journey_at_stops, notice)
end
end
diff --git a/app/views/calendars/_filters.html.slim b/app/views/calendars/_filters.html.slim
index 4f625e4f0..6bcf25f99 100644
--- a/app/views/calendars/_filters.html.slim
+++ b/app/views/calendars/_filters.html.slim
@@ -1,7 +1,7 @@
= search_form_for @q, url: calendars_path, builder: SimpleForm::FormBuilder, html: { method: :get, class: 'form form-filter' } do |f|
.ffg-row
.input-group.search_bar
- = f.search_field :short_name_cont, class: 'form-control', placeholder: 'Indiquez un nom de calendrier...'
+ = f.search_field :name_or_short_name_cont, class: 'form-control', placeholder: 'Indiquez un nom/nom court de calendrier...'
span.input-group-btn
button.btn.btn-default#search_btn type='submit'
span.fa.fa-search