aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-rw-r--r--app/assets/javascripts/application.js4
-rw-r--r--app/assets/javascripts/es6_browserified/itineraries/components/App.js12
-rw-r--r--app/assets/javascripts/es6_browserified/itineraries/reducers/index.js8
-rw-r--r--app/assets/javascripts/es6_browserified/journey_patterns/components/App.js21
-rw-r--r--app/assets/javascripts/es6_browserified/journey_patterns/components/ConfirmModal.js48
-rw-r--r--app/assets/javascripts/es6_browserified/journey_patterns/reducers/index.js18
-rw-r--r--app/assets/javascripts/es6_browserified/journey_patterns/reducers/stopPointsList.js8
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/components/ConfirmModal.js51
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/components/ErrorModal.js43
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/components/PeriodForm.js149
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/reducers/index.js16
-rw-r--r--app/assets/javascripts/es6_browserified/time_tables/reducers/status.js17
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/batch.js26
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/components/App.js38
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/components/ConfirmModal.js42
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/index.js20
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/stopPointsList.js8
-rw-r--r--app/assets/javascripts/filters/calendar.js6
-rw-r--r--app/assets/javascripts/filters/import.js6
-rw-r--r--app/assets/javascripts/filters/time_table.js7
-rw-r--r--app/assets/javascripts/filters/workbench.js6
-rw-r--r--app/assets/javascripts/helpers/date_filters.js38
-rw-r--r--app/assets/stylesheets/components/_referential_suites.sass69
-rw-r--r--app/controllers/api_keys_controller.rb6
-rw-r--r--app/controllers/compliance_check_sets_controller.rb21
-rw-r--r--app/controllers/compliance_control_blocks_controller.rb12
-rw-r--r--app/controllers/compliance_control_sets_controller.rb33
-rw-r--r--app/controllers/compliance_controls_controller.rb49
-rw-r--r--app/controllers/concerns/ransack_date_filter.rb41
-rw-r--r--app/controllers/dashboards_controller.rb13
-rw-r--r--app/controllers/imports_controller.rb34
-rw-r--r--app/controllers/time_tables_controller.rb26
-rw-r--r--app/controllers/workbenches_controller.rb37
-rw-r--r--app/decorators/company_decorator.rb2
-rw-r--r--app/decorators/compliance_check_set_decorator.rb8
-rw-r--r--app/decorators/compliance_control_decorator.rb23
-rw-r--r--app/decorators/compliance_control_set_decorator.rb1
-rw-r--r--app/helpers/breadcrumb_helper.rb10
-rw-r--r--app/helpers/compliance_control_blocks_helper.rb10
-rw-r--r--app/helpers/lines_helper.rb8
-rw-r--r--app/helpers/referentials_helper.rb10
-rw-r--r--app/javascript/date_filters/calendar.js5
-rw-r--r--app/javascript/date_filters/compliance_check_set.js5
-rw-r--r--app/javascript/date_filters/compliance_control_set.js5
-rw-r--r--app/javascript/date_filters/import.js5
-rw-r--r--app/javascript/date_filters/index.js17
-rw-r--r--app/javascript/date_filters/time_table.js5
-rw-r--r--app/javascript/date_filters/workbench.js5
-rw-r--r--app/javascript/helpers/clone.js12
-rw-r--r--app/javascript/helpers/date_filters.js29
-rw-r--r--app/javascript/journey_patterns/actions/index.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js)4
-rw-r--r--app/javascript/journey_patterns/components/App.js21
-rw-r--r--app/javascript/journey_patterns/components/ConfirmModal.js46
-rw-r--r--app/javascript/journey_patterns/components/CreateModal.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/components/CreateModal.js)12
-rw-r--r--app/javascript/journey_patterns/components/EditModal.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/components/EditModal.js)12
-rw-r--r--app/javascript/journey_patterns/components/JourneyPattern.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js)23
-rw-r--r--app/javascript/journey_patterns/components/JourneyPatterns.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPatterns.js)15
-rw-r--r--app/javascript/journey_patterns/components/Navigate.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/components/Navigate.js)12
-rw-r--r--app/javascript/journey_patterns/components/SaveJourneyPattern.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/components/SaveJourneyPattern.js)12
-rw-r--r--app/javascript/journey_patterns/containers/AddJourneyPattern.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/containers/AddJourneyPattern.js)8
-rw-r--r--app/javascript/journey_patterns/containers/ConfirmModal.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/containers/ConfirmModal.js)8
-rw-r--r--app/javascript/journey_patterns/containers/JourneyPatternList.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/containers/JourneyPatternList.js)8
-rw-r--r--app/javascript/journey_patterns/containers/Modal.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/containers/Modal.js)10
-rw-r--r--app/javascript/journey_patterns/containers/Navigate.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/containers/Navigate.js)10
-rw-r--r--app/javascript/journey_patterns/containers/SaveJourneyPattern.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/containers/SaveJourneyPattern.js)9
-rw-r--r--app/javascript/journey_patterns/reducers/editMode.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/reducers/editMode.js)6
-rw-r--r--app/javascript/journey_patterns/reducers/index.js18
-rw-r--r--app/javascript/journey_patterns/reducers/journeyPatterns.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/reducers/journeyPatterns.js)12
-rw-r--r--app/javascript/journey_patterns/reducers/modal.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/reducers/modal.js)9
-rw-r--r--app/javascript/journey_patterns/reducers/pagination.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/reducers/pagination.js)9
-rw-r--r--app/javascript/journey_patterns/reducers/status.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/reducers/status.js)10
-rw-r--r--app/javascript/journey_patterns/reducers/stopPointsList.js6
-rw-r--r--app/javascript/packs/application.js11
-rw-r--r--app/javascript/packs/date_filters.js1
-rw-r--r--app/javascript/packs/journey_patterns/index.js (renamed from app/assets/javascripts/es6_browserified/journey_patterns/index.js)13
-rw-r--r--app/javascript/packs/routes/edit.js81
-rw-r--r--app/javascript/packs/routes/show.js102
-rw-r--r--app/javascript/packs/time_tables/edit.js (renamed from app/assets/javascripts/es6_browserified/time_tables/index.js)19
-rw-r--r--app/javascript/packs/vehicle_journeys/index.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/index.js)18
-rw-r--r--app/javascript/routes/actions/index.js (renamed from app/assets/javascripts/es6_browserified/itineraries/actions/index.js)0
-rw-r--r--app/javascript/routes/components/App.js25
-rw-r--r--app/javascript/routes/components/BSelect2.js (renamed from app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js)21
-rw-r--r--app/javascript/routes/components/OlMap.js (renamed from app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js)42
-rw-r--r--app/javascript/routes/components/StopPoint.js (renamed from app/assets/javascripts/es6_browserified/itineraries/components/StopPoint.js)23
-rw-r--r--app/javascript/routes/components/StopPointList.js (renamed from app/assets/javascripts/es6_browserified/itineraries/components/StopPointList.js)21
-rw-r--r--app/javascript/routes/containers/AddStopPoint.js (renamed from app/assets/javascripts/es6_browserified/itineraries/containers/AddStopPoint.js)10
-rw-r--r--app/javascript/routes/containers/VisibleStopPoints.js (renamed from app/assets/javascripts/es6_browserified/itineraries/containers/VisibleStopPoints.js)8
-rw-r--r--app/javascript/routes/form_helper.js (renamed from app/assets/javascripts/es6_browserified/itineraries/form_helper.js)2
-rw-r--r--app/javascript/routes/index.js (renamed from app/assets/javascripts/es6_browserified/itineraries/index.js)18
-rw-r--r--app/javascript/routes/reducers/index.js8
-rw-r--r--app/javascript/routes/reducers/stopPoints.js (renamed from app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js)10
-rw-r--r--app/javascript/routes/show.js (renamed from app/assets/javascripts/es6_browserified/itineraries/show.js)3
-rw-r--r--app/javascript/time_tables/actions/index.js (renamed from app/assets/javascripts/es6_browserified/time_tables/actions/index.js)31
-rw-r--r--app/javascript/time_tables/components/ConfirmModal.js50
-rw-r--r--app/javascript/time_tables/components/ErrorModal.js42
-rw-r--r--app/javascript/time_tables/components/ExceptionsInDay.js (renamed from app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js)10
-rw-r--r--app/javascript/time_tables/components/Metas.js (renamed from app/assets/javascripts/es6_browserified/time_tables/components/Metas.js)13
-rw-r--r--app/javascript/time_tables/components/Navigate.js (renamed from app/assets/javascripts/es6_browserified/time_tables/components/Navigate.js)16
-rw-r--r--app/javascript/time_tables/components/PeriodForm.js148
-rw-r--r--app/javascript/time_tables/components/PeriodManager.js (renamed from app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js)11
-rw-r--r--app/javascript/time_tables/components/PeriodsInDay.js (renamed from app/assets/javascripts/es6_browserified/time_tables/components/PeriodsInDay.js)10
-rw-r--r--app/javascript/time_tables/components/SaveTimetable.js (renamed from app/assets/javascripts/es6_browserified/time_tables/components/SaveTimetable.js)13
-rw-r--r--app/javascript/time_tables/components/TagsSelect2.js (renamed from app/assets/javascripts/es6_browserified/time_tables/components/TagsSelect2.js)29
-rw-r--r--app/javascript/time_tables/components/TimeTableDay.js (renamed from app/assets/javascripts/es6_browserified/time_tables/components/TimeTableDay.js)7
-rw-r--r--app/javascript/time_tables/components/Timetable.js (renamed from app/assets/javascripts/es6_browserified/time_tables/components/Timetable.js)16
-rw-r--r--app/javascript/time_tables/containers/App.js (renamed from app/assets/javascripts/es6_browserified/time_tables/containers/App.js)26
-rw-r--r--app/javascript/time_tables/containers/ConfirmModal.js (renamed from app/assets/javascripts/es6_browserified/time_tables/containers/ConfirmModal.js)8
-rw-r--r--app/javascript/time_tables/containers/ErrorModal.js (renamed from app/assets/javascripts/es6_browserified/time_tables/containers/ErrorModal.js)8
-rw-r--r--app/javascript/time_tables/containers/Metas.js (renamed from app/assets/javascripts/es6_browserified/time_tables/containers/Metas.js)8
-rw-r--r--app/javascript/time_tables/containers/Navigate.js (renamed from app/assets/javascripts/es6_browserified/time_tables/containers/Navigate.js)10
-rw-r--r--app/javascript/time_tables/containers/PeriodForm.js (renamed from app/assets/javascripts/es6_browserified/time_tables/containers/PeriodForm.js)14
-rw-r--r--app/javascript/time_tables/containers/SaveTimetable.js (renamed from app/assets/javascripts/es6_browserified/time_tables/containers/SaveTimetable.js)9
-rw-r--r--app/javascript/time_tables/containers/Timetable.js (renamed from app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js)8
-rw-r--r--app/javascript/time_tables/reducers/index.js16
-rw-r--r--app/javascript/time_tables/reducers/metas.js (renamed from app/assets/javascripts/es6_browserified/time_tables/reducers/metas.js)27
-rw-r--r--app/javascript/time_tables/reducers/modal.js (renamed from app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js)34
-rw-r--r--app/javascript/time_tables/reducers/pagination.js (renamed from app/assets/javascripts/es6_browserified/time_tables/reducers/pagination.js)18
-rw-r--r--app/javascript/time_tables/reducers/status.js15
-rw-r--r--app/javascript/time_tables/reducers/timetable.js (renamed from app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js)59
-rw-r--r--app/javascript/vehicle_journeys/actions/index.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js)6
-rw-r--r--app/javascript/vehicle_journeys/batch.js26
-rw-r--r--app/javascript/vehicle_journeys/components/App.js38
-rw-r--r--app/javascript/vehicle_journeys/components/ConfirmModal.js40
-rw-r--r--app/javascript/vehicle_journeys/components/Filters.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/Filters.js)15
-rw-r--r--app/javascript/vehicle_journeys/components/Navigate.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/Navigate.js)12
-rw-r--r--app/javascript/vehicle_journeys/components/SaveVehicleJourneys.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/SaveVehicleJourneys.js)12
-rw-r--r--app/javascript/vehicle_journeys/components/ToggleArrivals.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/ToggleArrivals.js)9
-rw-r--r--app/javascript/vehicle_journeys/components/Tools.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/Tools.js)25
-rw-r--r--app/javascript/vehicle_journeys/components/VehicleJourney.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js)12
-rw-r--r--app/javascript/vehicle_journeys/components/VehicleJourneys.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourneys.js)15
-rw-r--r--app/javascript/vehicle_journeys/components/tools/CreateModal.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/CreateModal.js)16
-rw-r--r--app/javascript/vehicle_journeys/components/tools/DeleteVehicleJourneys.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/DeleteVehicleJourneys.js)11
-rw-r--r--app/javascript/vehicle_journeys/components/tools/DuplicateVehicleJourney.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/DuplicateVehicleJourney.js)14
-rw-r--r--app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/EditVehicleJourney.js)18
-rw-r--r--app/javascript/vehicle_journeys/components/tools/NotesEditVehicleJourney.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/NotesEditVehicleJourney.js)14
-rw-r--r--app/javascript/vehicle_journeys/components/tools/ShiftVehicleJourney.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/ShiftVehicleJourney.js)12
-rw-r--r--app/javascript/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js)14
-rw-r--r--app/javascript/vehicle_journeys/components/tools/select2s/CompanySelect2.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js)19
-rw-r--r--app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js)22
-rw-r--r--app/javascript/vehicle_journeys/components/tools/select2s/TimetableSelect2.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js)17
-rw-r--r--app/javascript/vehicle_journeys/components/tools/select2s/VJSelect2.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/VJSelect2.js)21
-rw-r--r--app/javascript/vehicle_journeys/components/tools/select2s/fr.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/fr.js)0
-rw-r--r--app/javascript/vehicle_journeys/containers/ConfirmModal.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/ConfirmModal.js)8
-rw-r--r--app/javascript/vehicle_journeys/containers/Filters.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/Filters.js)8
-rw-r--r--app/javascript/vehicle_journeys/containers/Navigate.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/Navigate.js)9
-rw-r--r--app/javascript/vehicle_journeys/containers/SaveVehicleJourneys.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/SaveVehicleJourneys.js)9
-rw-r--r--app/javascript/vehicle_journeys/containers/ToggleArrivals.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/ToggleArrivals.js)8
-rw-r--r--app/javascript/vehicle_journeys/containers/Tools.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/Tools.js)8
-rw-r--r--app/javascript/vehicle_journeys/containers/VehicleJourneysList.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/VehicleJourneysList.js)8
-rw-r--r--app/javascript/vehicle_journeys/containers/tools/AddVehicleJourney.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/AddVehicleJourney.js)8
-rw-r--r--app/javascript/vehicle_journeys/containers/tools/DeleteVehicleJourneys.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/DeleteVehicleJourneys.js)8
-rw-r--r--app/javascript/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js)8
-rw-r--r--app/javascript/vehicle_journeys/containers/tools/EditVehicleJourney.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/EditVehicleJourney.js)8
-rw-r--r--app/javascript/vehicle_journeys/containers/tools/NotesEditVehicleJourney.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/NotesEditVehicleJourney.js)8
-rw-r--r--app/javascript/vehicle_journeys/containers/tools/ShiftVehicleJourney.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/ShiftVehicleJourney.js)8
-rw-r--r--app/javascript/vehicle_journeys/containers/tools/TimetablesEditVehicleJourney.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/TimetablesEditVehicleJourney.js)8
-rw-r--r--app/javascript/vehicle_journeys/reducers/editMode.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/editMode.js)6
-rw-r--r--app/javascript/vehicle_journeys/reducers/filters.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/filters.js)10
-rw-r--r--app/javascript/vehicle_journeys/reducers/index.js20
-rw-r--r--app/javascript/vehicle_journeys/reducers/modal.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/modal.js)10
-rw-r--r--app/javascript/vehicle_journeys/reducers/pagination.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/pagination.js)9
-rw-r--r--app/javascript/vehicle_journeys/reducers/status.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/status.js)10
-rw-r--r--app/javascript/vehicle_journeys/reducers/stopPointsList.js6
-rw-r--r--app/javascript/vehicle_journeys/reducers/vehicleJourneys.js (renamed from app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/vehicleJourneys.js)10
-rw-r--r--app/models/chouette/line.rb6
-rw-r--r--app/models/chouette/time_table.rb4
-rw-r--r--app/models/chouette/transport_mode.rb71
-rw-r--r--app/models/chouette/vehicle_journey.rb2
-rw-r--r--app/models/compliance_check.rb9
-rw-r--r--app/models/compliance_check_block.rb2
-rw-r--r--app/models/compliance_check_message.rb7
-rw-r--r--app/models/compliance_check_resource.rb6
-rw-r--r--app/models/compliance_check_set.rb11
-rw-r--r--app/models/compliance_control.rb74
-rw-r--r--app/models/compliance_control_block.rb12
-rw-r--r--app/models/compliance_control_set.rb7
-rw-r--r--app/models/concerns/min_max_values_validation.rb13
-rw-r--r--app/models/concerns/stif_netex_attributes_support.rb2
-rw-r--r--app/models/concerns/stif_transport_mode_enumerations.rb18
-rw-r--r--app/models/concerns/stif_transport_submode_enumerations.rb24
-rw-r--r--app/models/dashboard.rb27
-rw-r--r--app/models/generic_attribute_control/min_max.rb16
-rw-r--r--app/models/generic_attribute_control/pattern.rb14
-rw-r--r--app/models/generic_attribute_control/uniqueness.rb13
-rw-r--r--app/models/generic_attribute_min_max.rb27
-rw-r--r--app/models/generic_attribute_pattern.rb23
-rw-r--r--app/models/generic_attribute_uniqueness.rb23
-rw-r--r--app/models/import.rb4
-rw-r--r--app/models/journey_pattern_control/duplicates.rb9
-rw-r--r--app/models/journey_pattern_control/vehicle_journey.rb11
-rw-r--r--app/models/line_control/route.rb11
-rw-r--r--app/models/line_referential.rb6
-rw-r--r--app/models/organisation.rb10
-rw-r--r--app/models/route_control/duplicates.rb9
-rw-r--r--app/models/route_control/journey_pattern.rb11
-rw-r--r--app/models/route_control/minimum_length.rb9
-rw-r--r--app/models/route_control/omnibus_journey_pattern.rb9
-rw-r--r--app/models/route_control/opposite_route.rb10
-rw-r--r--app/models/route_control/opposite_route_terminus.rb11
-rw-r--r--app/models/route_control/speed.rb15
-rw-r--r--app/models/route_control/stop_points_in_journey_pattern.rb11
-rw-r--r--app/models/route_control/time_table.rb13
-rw-r--r--app/models/route_control/unactivated_stop_points.rb11
-rw-r--r--app/models/route_control/vehicle_journey_at_stops.rb13
-rw-r--r--app/models/route_control/zdl_stop_area.rb9
-rw-r--r--app/models/routing_constaint_zone_control/maximum_length.rb13
-rw-r--r--app/models/routing_constaint_zone_control/minimum_length.rb13
-rw-r--r--app/models/routing_constaint_zone_control/unactivated_stop_point.rb13
-rw-r--r--app/models/routing_constraint_zone_control/maximum_length.rb6
-rw-r--r--app/models/routing_constraint_zone_control/minimum_length.rb6
-rw-r--r--app/models/routing_constraint_zone_control/unactivated_stop_point.rb6
-rw-r--r--app/models/rule_parameter_set.rb21
-rw-r--r--app/models/stif_transport_mode_enumerations.rb5
-rw-r--r--app/models/vechicle_journey_control/delta.rb15
-rw-r--r--app/models/vechicle_journey_control/waiting_time.rb13
-rw-r--r--app/models/vehicle_journey_control/delta.rb10
-rw-r--r--app/models/vehicle_journey_control/speed.rb11
-rw-r--r--app/models/vehicle_journey_control/time_table.rb6
-rw-r--r--app/models/vehicle_journey_control/vehicle_journey_at_stops.rb6
-rw-r--r--app/models/vehicle_journey_control/waiting_time.rb9
-rw-r--r--app/models/vehicle_journey_import.rb2
-rw-r--r--app/models/workbench.rb14
-rw-r--r--app/policies/compliance_check_set_policy.rb7
-rw-r--r--app/policies/compliance_control_policy.rb9
-rw-r--r--app/policies/import_policy.rb12
-rw-r--r--app/views/calendars/index.html.slim2
-rw-r--r--app/views/compliance_check_sets/_filters.html.slim23
-rw-r--r--app/views/compliance_check_sets/index.html.slim54
-rw-r--r--app/views/compliance_check_sets/show.html.slim11
-rw-r--r--app/views/compliance_control_blocks/_form.html.slim10
-rw-r--r--app/views/compliance_control_blocks/edit.html.slim11
-rw-r--r--app/views/compliance_control_blocks/new.html.slim11
-rw-r--r--app/views/compliance_control_sets/_filters.html.slim9
-rw-r--r--app/views/compliance_control_sets/edit.html.slim2
-rw-r--r--app/views/compliance_control_sets/index.html.slim11
-rw-r--r--app/views/compliance_control_sets/show.html.slim85
-rw-r--r--app/views/compliance_controls/_form.html.slim11
-rw-r--r--app/views/compliance_controls/edit.html.slim9
-rw-r--r--app/views/compliance_controls/index.html.slim44
-rw-r--r--app/views/compliance_controls/new.html.slim7
-rw-r--r--app/views/compliance_controls/select_type.html.slim18
-rw-r--r--app/views/compliance_controls/show.html.slim32
-rw-r--r--app/views/dashboards/show.html.slim15
-rw-r--r--app/views/imports/_filters.html.slim4
-rw-r--r--app/views/imports/index.html.slim2
-rw-r--r--app/views/journey_patterns_collections/show.html.slim2
-rw-r--r--app/views/layouts/application.html.slim2
-rw-r--r--app/views/layouts/navigation/_main_nav_left.html.slim2
-rw-r--r--app/views/lines/_filters.html.slim4
-rw-r--r--app/views/lines/index.html.slim6
-rw-r--r--app/views/lines/show.html.slim4
-rw-r--r--app/views/referential_lines/show.html.slim7
-rw-r--r--app/views/referentials/_filters.html.slim2
-rw-r--r--app/views/referentials/show.html.slim4
-rw-r--r--app/views/routes/_form.html.slim5
-rw-r--r--app/views/routes/show.html.slim8
-rw-r--r--app/views/rule_parameter_sets/_mode_selection.html.slim8
-rw-r--r--app/views/shared/_lines_search_form.html.slim4
-rw-r--r--app/views/stif/dashboards/_dashboard.html.slim73
-rw-r--r--app/views/stop_areas/index.html.slim2
-rw-r--r--app/views/time_tables/_filter.html.slim5
-rw-r--r--app/views/time_tables/edit.html.slim2
-rw-r--r--app/views/time_tables/index.html.slim2
-rw-r--r--app/views/vehicle_journeys/index.html.slim2
-rw-r--r--app/views/workbenches/_filters.html.slim4
-rw-r--r--app/views/workbenches/show.html.slim2
266 files changed, 2463 insertions, 1896 deletions
diff --git a/app/assets/javascripts/application.js b/app/assets/javascripts/application.js
index 0024b62b5..4c5aff22f 100644
--- a/app/assets/javascripts/application.js
+++ b/app/assets/javascripts/application.js
@@ -20,5 +20,5 @@
//= require footable/footable.sort
//= require_directory ./plugins
//= require_directory .
-require('whatwg-fetch')
-require('babel-polyfill')
+// require('whatwg-fetch')
+// require('babel-polyfill')
diff --git a/app/assets/javascripts/es6_browserified/itineraries/components/App.js b/app/assets/javascripts/es6_browserified/itineraries/components/App.js
deleted file mode 100644
index e662d140c..000000000
--- a/app/assets/javascripts/es6_browserified/itineraries/components/App.js
+++ /dev/null
@@ -1,12 +0,0 @@
-var React = require('react')
-var AddStopPoint = require('../containers/AddStopPoint')
-var VisibleStopPoints = require('../containers/VisibleStopPoints')
-
-const App = () => (
- <div>
- <VisibleStopPoints />
- <AddStopPoint />
- </div>
-)
-
-module.exports = App
diff --git a/app/assets/javascripts/es6_browserified/itineraries/reducers/index.js b/app/assets/javascripts/es6_browserified/itineraries/reducers/index.js
deleted file mode 100644
index 446c9ed36..000000000
--- a/app/assets/javascripts/es6_browserified/itineraries/reducers/index.js
+++ /dev/null
@@ -1,8 +0,0 @@
-var combineReducers = require('redux').combineReducers
-var stopPoints = require('./stopPoints')
-
-const stopPointsApp = combineReducers({
- stopPoints
-})
-
-module.exports = stopPointsApp
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/App.js b/app/assets/javascripts/es6_browserified/journey_patterns/components/App.js
deleted file mode 100644
index 7513fc506..000000000
--- a/app/assets/javascripts/es6_browserified/journey_patterns/components/App.js
+++ /dev/null
@@ -1,21 +0,0 @@
-var React = require('react')
-var AddJourneyPattern = require('../containers/AddJourneyPattern')
-var Navigate = require('../containers/Navigate')
-var Modal = require('../containers/Modal')
-var ConfirmModal = require('../containers/ConfirmModal')
-var SaveJourneyPattern = require('../containers/SaveJourneyPattern')
-var JourneyPatternList = require('../containers/JourneyPatternList')
-
-const App = () => (
- <div>
- <Navigate />
- <JourneyPatternList />
- <Navigate />
- <AddJourneyPattern />
- <SaveJourneyPattern />
- <ConfirmModal />
- <Modal/>
- </div>
-)
-
-module.exports = App
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/ConfirmModal.js b/app/assets/javascripts/es6_browserified/journey_patterns/components/ConfirmModal.js
deleted file mode 100644
index c2229d991..000000000
--- a/app/assets/javascripts/es6_browserified/journey_patterns/components/ConfirmModal.js
+++ /dev/null
@@ -1,48 +0,0 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-
-const ConfirmModal = ({dispatch, modal, onModalAccept, onModalCancel, journeyPatterns}) => (
- <div className={ 'modal fade ' + ((modal.type == 'confirm') ? 'in' : '') } id='ConfirmModal'>
- <div className='modal-container'>
- <div className='modal-dialog'>
- <div className='modal-content'>
- <div className='modal-header'>
- <h4 className='modal-title'>Confirmation</h4>
- </div>
- <div className='modal-body'>
- <div className='mt-md mb-md'>
- <p>Vous vous apprêtez à changer de page. Voulez-vous valider vos modifications avant cela ?</p>
- </div>
- </div>
- <div className='modal-footer'>
- <button
- className='btn btn-link'
- data-dismiss='modal'
- type='button'
- onClick= {() => {onModalCancel(modal.confirmModal.callback)}}
- >
- Ne pas valider
- </button>
- <button
- className='btn btn-primary'
- data-dismiss='modal'
- type='button'
- onClick = {() => {onModalAccept(modal.confirmModal.callback, journeyPatterns)}}
- >
- Valider
- </button>
- </div>
- </div>
- </div>
- </div>
- </div>
-)
-
-ConfirmModal.propTypes = {
- modal: PropTypes.object.isRequired,
- onModalAccept: PropTypes.func.isRequired,
- onModalCancel: PropTypes.func.isRequired
-}
-
-module.exports = ConfirmModal
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/index.js b/app/assets/javascripts/es6_browserified/journey_patterns/reducers/index.js
deleted file mode 100644
index a9c28b83e..000000000
--- a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/index.js
+++ /dev/null
@@ -1,18 +0,0 @@
-var combineReducers = require('redux').combineReducers
-var editMode = require('./editMode')
-var status = require('./status')
-var journeyPatterns = require('./journeyPatterns')
-var pagination = require('./pagination')
-var modal = require('./modal')
-var stopPointsList = require('./stopPointsList')
-
-const journeyPatternsApp = combineReducers({
- editMode,
- status,
- journeyPatterns,
- pagination,
- stopPointsList,
- modal
-})
-
-module.exports = journeyPatternsApp
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/stopPointsList.js b/app/assets/javascripts/es6_browserified/journey_patterns/reducers/stopPointsList.js
deleted file mode 100644
index 9abacc8c8..000000000
--- a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/stopPointsList.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const stopPointsList = (state = [], action) => {
- switch (action.type) {
- default:
- return state
- }
-}
-
-module.exports = stopPointsList
diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/ConfirmModal.js b/app/assets/javascripts/es6_browserified/time_tables/components/ConfirmModal.js
deleted file mode 100644
index 674a03296..000000000
--- a/app/assets/javascripts/es6_browserified/time_tables/components/ConfirmModal.js
+++ /dev/null
@@ -1,51 +0,0 @@
-var React = require('react')
-var { PropTypes } = require('react')
-
-const ConfirmModal = ({dispatch, modal, onModalAccept, onModalCancel, timetable, metas}, {I18n}) => (
- <div className={ 'modal fade ' + ((modal.type == 'confirm') ? 'in' : '') } id='ConfirmModal'>
- <div className='modal-container'>
- <div className='modal-dialog'>
- <div className='modal-content'>
- <div className='modal-header'>
- <h4 className='modal-title'>{I18n.time_tables.edit.confirm_modal.title}</h4>
- </div>
- <div className='modal-body'>
- <div className='mt-md mb-md'>
- <p>{I18n.time_tables.edit.confirm_modal.message}</p>
- </div>
- </div>
- <div className='modal-footer'>
- <button
- className='btn btn-link'
- data-dismiss='modal'
- type='button'
- onClick= {() => {onModalCancel(modal.confirmModal.callback)}}
- >
- {I18n.cancel}
- </button>
- <button
- className='btn btn-primary'
- data-dismiss='modal'
- type='button'
- onClick = {() => {onModalAccept(modal.confirmModal.callback, timetable, metas)}}
- >
- {I18n.actions.submit}
- </button>
- </div>
- </div>
- </div>
- </div>
- </div>
-)
-
-ConfirmModal.propTypes = {
- modal: PropTypes.object.isRequired,
- onModalAccept: PropTypes.func.isRequired,
- onModalCancel: PropTypes.func.isRequired
-}
-
-ConfirmModal.contextTypes = {
- I18n: PropTypes.object
-}
-
-module.exports = ConfirmModal
diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/ErrorModal.js b/app/assets/javascripts/es6_browserified/time_tables/components/ErrorModal.js
deleted file mode 100644
index 2597a4870..000000000
--- a/app/assets/javascripts/es6_browserified/time_tables/components/ErrorModal.js
+++ /dev/null
@@ -1,43 +0,0 @@
-var React = require('react')
-var { PropTypes } = require('react')
-var { errorModalMessage } = require('../actions')
-
-const ErrorModal = ({dispatch, modal, onModalClose}, {I18n}) => (
- <div className={ 'modal fade ' + ((modal.type == 'error') ? 'in' : '') } id='ErrorModal'>
- <div className='modal-container'>
- <div className='modal-dialog'>
- <div className='modal-content'>
- <div className='modal-header'>
- <h4 className='modal-title'>{I18n.time_tables.edit.error_modal.title}</h4>
- </div>
- <div className='modal-body'>
- <div className='mt-md mb-md'>
- <p>{errorModalMessage(modal.modalProps.error)}</p>
- </div>
- </div>
- <div className='modal-footer'>
- <button
- className='btn btn-link'
- data-dismiss='modal'
- type='button'
- onClick= {() => {onModalClose()}}
- >
- {I18n.back}
- </button>
- </div>
- </div>
- </div>
- </div>
- </div>
-)
-
-ErrorModal.propTypes = {
- modal: PropTypes.object.isRequired,
- onModalClose: PropTypes.func.isRequired
-}
-
-ErrorModal.contextTypes = {
- I18n: PropTypes.object
-}
-
-module.exports = ErrorModal
diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodForm.js b/app/assets/javascripts/es6_browserified/time_tables/components/PeriodForm.js
deleted file mode 100644
index d494109cc..000000000
--- a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodForm.js
+++ /dev/null
@@ -1,149 +0,0 @@
-var React = require('react')
-var { PropTypes } = require('react')
-var _ = require('lodash')
-let monthsArray = ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre']
-
-const formatNumber = (val) => {
- return ("0" + val).slice(-2)
-}
-
-const makeDaysOptions = (daySelected) => {
- let arr = []
- for(let i = 1; i < 32; i++) {
- arr.push(<option value={formatNumber(i)} key={i}>{formatNumber(i)}</option>)
- }
- return arr
-}
-
-const makeMonthsOptions = (monthSelected) => {
- let arr = []
- for(let i = 1; i < 13; i++) {
- arr.push(<option value={formatNumber(i)} key={i}>{monthsArray[i - 1]}</option>)
- }
- return arr
-}
-
-const makeYearsOptions = (yearSelected) => {
- let arr = []
- let startYear = new Date().getFullYear() - 3
- for(let i = startYear; i <= startYear + 6; i++) {
- arr.push(<option key={i}>{i}</option>)
- }
- return arr
-}
-
-const PeriodForm = ({modal, timetable, metas, onOpenAddPeriodForm, onClosePeriodForm, onUpdatePeriodForm, onValidatePeriodForm}, {I18n}) => (
- <div className="container-fluid">
- <div className="row">
- <div className="col lg-6 col-lg-offset-3">
- <div className='subform'>
- {modal.modalProps.active &&
- <div>
- <div className="nested-head">
- <div className="wrapper">
- <div>
- <div className="form-group">
- <label htmlFor="" className="control-label required">
- {I18n.time_tables.edit.period_form.begin}
- <abbr title="requis">*</abbr>
- </label>
- </div>
- </div>
- <div>
- <div className="form-group">
- <label htmlFor="" className="control-label required">
- {I18n.time_tables.edit.period_form.end}
- <abbr title="requis">*</abbr>
- </label>
- </div>
- </div>
- </div>
- </div>
- <div className="nested-fields">
- <div className="wrapper">
- <div>
- <div className={'form-group date ' + (modal.modalProps.error ? ' has-error' : '')}>
- <div className="form-inline">
- <select value={formatNumber(modal.modalProps.begin.day)} onChange={(e) => onUpdatePeriodForm(e, 'begin', 'day', modal.modalProps)} id="q_validity_period_begin_gteq_3i" className="date required form-control">
- {makeDaysOptions(modal.modalProps.begin.day)}
- </select>
- <select value={formatNumber(modal.modalProps.begin.month)} onChange={(e) => onUpdatePeriodForm(e, 'begin', 'month', modal.modalProps)} id="q_validity_period_begin_gteq_2i" className="date required form-control">
- {makeMonthsOptions(modal.modalProps.begin.month)}
- </select>
- <select value={modal.modalProps.begin.year} onChange={(e) => onUpdatePeriodForm(e, 'begin', 'year', modal.modalProps)} id="q_validity_period_begin_gteq_1i" className="date required form-control">
- {makeYearsOptions(modal.modalProps.begin.year)}
- </select>
- </div>
- </div>
- </div>
- <div>
- <div className={'form-group date ' + (modal.modalProps.error ? ' has-error' : '')}>
- <div className="form-inline">
- <select value={formatNumber(modal.modalProps.end.day)} onChange={(e) => onUpdatePeriodForm(e, 'end', 'day', modal.modalProps)} id="q_validity_period_end_gteq_3i" className="date required form-control">
- {makeDaysOptions(modal.modalProps.end.day)}
- </select>
- <select value={formatNumber(modal.modalProps.end.month)} onChange={(e) => onUpdatePeriodForm(e, 'end', 'month', modal.modalProps)} id="q_validity_period_end_gteq_2i" className="date required form-control">
- {makeMonthsOptions(modal.modalProps.end.month)}
- </select>
- <select value={modal.modalProps.end.year} onChange={(e) => onUpdatePeriodForm(e, 'end', 'year', modal.modalProps)} id="q_validity_period_end_gteq_1i" className="date required form-control">
- {makeYearsOptions(modal.modalProps.end.year)}
- </select>
- </div>
- </div>
- </div>
- </div>
- </div>
-
- <div className='links nested-linker'>
- <span className='help-block small text-danger pull-left mt-xs ml-sm'>
- {modal.modalProps.error}
- </span>
- <button
- type='button'
- className='btn btn-link'
- onClick={onClosePeriodForm}
- >
- {I18n.cancel}
- </button>
- <button
- type='button'
- className='btn btn-outline-primary mr-sm'
- onClick={() => onValidatePeriodForm(modal.modalProps, timetable.time_table_periods, metas, _.filter(timetable.time_table_dates, ['in_out', true]))}
- >
- {I18n.actions.submit}
- </button>
- </div>
- </div>
- }
- {!modal.modalProps.active &&
- <div className="text-right">
- <button
- type='button'
- className='btn btn-outline-primary'
- onClick={onOpenAddPeriodForm}
- >
- {I18n.time_tables.actions.add_period}
- </button>
- </div>
- }
- </div>
- </div>
- </div>
- </div>
-)
-
-PeriodForm.propTypes = {
- modal: PropTypes.object.isRequired,
- metas: PropTypes.object.isRequired,
- onOpenAddPeriodForm: PropTypes.func.isRequired,
- onClosePeriodForm: PropTypes.func.isRequired,
- onUpdatePeriodForm: PropTypes.func.isRequired,
- onValidatePeriodForm: PropTypes.func.isRequired,
- timetable: PropTypes.object.isRequired
-}
-
-PeriodForm.contextTypes = {
- I18n: PropTypes.object
-}
-
-module.exports = PeriodForm
diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/index.js b/app/assets/javascripts/es6_browserified/time_tables/reducers/index.js
deleted file mode 100644
index 5b05aadda..000000000
--- a/app/assets/javascripts/es6_browserified/time_tables/reducers/index.js
+++ /dev/null
@@ -1,16 +0,0 @@
-var combineReducers = require('redux').combineReducers
-var status = require('./status')
-var pagination = require('./pagination')
-var modal = require('./modal')
-var timetable = require('./timetable')
-var metas = require('./metas')
-
-const timeTablesApp = combineReducers({
- timetable,
- metas,
- status,
- pagination,
- modal
-})
-
-module.exports = timeTablesApp
diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/status.js b/app/assets/javascripts/es6_browserified/time_tables/reducers/status.js
deleted file mode 100644
index fc205d0ae..000000000
--- a/app/assets/javascripts/es6_browserified/time_tables/reducers/status.js
+++ /dev/null
@@ -1,17 +0,0 @@
-var _ = require('lodash')
-
-const status = (state = {}, action) => {
- switch (action.type) {
- case 'UNAVAILABLE_SERVER':
- return _.assign({}, state, {fetchSuccess: false})
- case 'FETCH_API':
- return _.assign({}, state, {isFetching: true})
- case 'RECEIVE_TIME_TABLES':
- case 'RECEIVE_MONTH':
- return _.assign({}, state, {fetchSuccess: true, isFetching: false})
- default:
- return state
- }
-}
-
-module.exports = status
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/batch.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/batch.js
deleted file mode 100644
index 284d7b268..000000000
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/batch.js
+++ /dev/null
@@ -1,26 +0,0 @@
-'use strict';
-
-Object.defineProperty(exports, "__esModule", {
- value: true
-});
-exports.batchActions = batchActions;
-exports.enableBatching = enableBatching;
-var BATCH = exports.BATCH = 'BATCH';
-
-function batchActions(actions) {
- return {
- type: BATCH,
- payload: actions
- };
-}
-
-function enableBatching(reduce) {
- return function batchingReducer(state, action) {
- switch (action.type) {
- case BATCH:
- return action.payload.reduce(batchingReducer, state);
- default:
- return reduce(state, action);
- }
- };
-}
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/App.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/App.js
deleted file mode 100644
index d5f419747..000000000
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/App.js
+++ /dev/null
@@ -1,38 +0,0 @@
-var React = require('react')
-var VehicleJourneysList = require('../containers/VehicleJourneysList')
-var Navigate = require('../containers/Navigate')
-var ToggleArrivals = require('../containers/ToggleArrivals')
-var Filters = require('../containers/Filters')
-var SaveVehicleJourneys = require('../containers/SaveVehicleJourneys')
-var ConfirmModal = require('../containers/ConfirmModal')
-var Tools = require('../containers/Tools')
-
-const App = () => (
- <div>
-
- <div className='row'>
- <div className='col-lg-6 col-md-6 col-sm-6 col-xs-6'>
- <ToggleArrivals />
- </div>
- <div className='col-lg-6 col-md-6 col-sm-6 col-xs-6 text-right'>
- <Navigate />
- </div>
- </div>
-
- <Filters />
- <VehicleJourneysList />
-
- <div className='row'>
- <div className='col-lg-12 text-right'>
- <Navigate />
- </div>
- </div>
-
- <SaveVehicleJourneys />
- <Tools />
-
- <ConfirmModal />
- </div>
-)
-
-module.exports = App
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/ConfirmModal.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/ConfirmModal.js
deleted file mode 100644
index 54f0287c6..000000000
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/ConfirmModal.js
+++ /dev/null
@@ -1,42 +0,0 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-
-const ConfirmModal = ({dispatch, modal, onModalAccept, onModalCancel, vehicleJourneys}) => (
- <div className={ 'modal fade ' + ((modal.type == 'confirm') ? 'in' : '') } id='ConfirmModal'>
- <div className='modal-dialog'>
- <div className='modal-content'>
- <div className='modal-body'>
- <p> Voulez-vous valider vos modifications avant de changer de page? </p>
- </div>
- <div className='modal-footer'>
- <button
- className='btn btn-default'
- data-dismiss='modal'
- type='button'
- onClick= {() => {onModalCancel(modal.confirmModal.callback)}}
- >
- Ne pas valider
- </button>
- <button
- className='btn btn-danger'
- data-dismiss='modal'
- type='button'
- onClick = {() => {onModalAccept(modal.confirmModal.callback, vehicleJourneys)}}
- >
- Valider
- </button>
- </div>
- </div>
- </div>
- </div>
-)
-
-ConfirmModal.propTypes = {
- vehicleJourneys: PropTypes.array.isRequired,
- modal: PropTypes.object.isRequired,
- onModalAccept: PropTypes.func.isRequired,
- onModalCancel: PropTypes.func.isRequired
-}
-
-module.exports = ConfirmModal
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/index.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/index.js
deleted file mode 100644
index 4e0839102..000000000
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/index.js
+++ /dev/null
@@ -1,20 +0,0 @@
-var combineReducers = require('redux').combineReducers
-var vehicleJourneys = require('./vehicleJourneys')
-var pagination = require('./pagination')
-var modal = require('./modal')
-var status = require('./status')
-var filters = require('./filters')
-var editMode = require('./editMode')
-var stopPointsList = require('./stopPointsList')
-
-const vehicleJourneysApp = combineReducers({
- vehicleJourneys,
- pagination,
- modal,
- status,
- filters,
- editMode,
- stopPointsList
-})
-
-module.exports = vehicleJourneysApp
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/stopPointsList.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/stopPointsList.js
deleted file mode 100644
index 9abacc8c8..000000000
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/stopPointsList.js
+++ /dev/null
@@ -1,8 +0,0 @@
-const stopPointsList = (state = [], action) => {
- switch (action.type) {
- default:
- return state
- }
-}
-
-module.exports = stopPointsList
diff --git a/app/assets/javascripts/filters/calendar.js b/app/assets/javascripts/filters/calendar.js
deleted file mode 100644
index a4e84777c..000000000
--- a/app/assets/javascripts/filters/calendar.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const DateFilter = require('../helpers/date_filters')
-
-$(document).ready(function(){
- const calendarDF = new DateFilter("#calendar_filter_btn", "Tous les champs du filtre de date doivent être remplis", "#q_contains_date_NUMi")
- calendarDF()
-})
diff --git a/app/assets/javascripts/filters/import.js b/app/assets/javascripts/filters/import.js
deleted file mode 100644
index bb665d5ad..000000000
--- a/app/assets/javascripts/filters/import.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const DateFilter = require('../helpers/date_filters')
-
-$(document).ready(function(){
- const importDF = new DateFilter("#import_filter_btn", "Tous les champs du filtre de date doivent être remplis", "#q_started_at_begin_NUMi", "#q_started_at_end_NUMi")
- importDF()
-})
diff --git a/app/assets/javascripts/filters/time_table.js b/app/assets/javascripts/filters/time_table.js
deleted file mode 100644
index 9e24d03fe..000000000
--- a/app/assets/javascripts/filters/time_table.js
+++ /dev/null
@@ -1,7 +0,0 @@
-$(document).ready(function(){
- const DateFilter = require('../helpers/date_filters')
-
- const timetableDF = new DateFilter("#time_table_filter_btn", window.I18n.fr.time_tables.error_period_filter, "#q_start_date_gteq_NUMi", "#q_end_date_lteq_NUMi")
-
- timetableDF()
-})
diff --git a/app/assets/javascripts/filters/workbench.js b/app/assets/javascripts/filters/workbench.js
deleted file mode 100644
index af3e13c59..000000000
--- a/app/assets/javascripts/filters/workbench.js
+++ /dev/null
@@ -1,6 +0,0 @@
-const DateFilter = require('../helpers/date_filters')
-
-$(document).ready(function(){
- const workbenchDF = new DateFilter("#referential_filter_btn", window.I18n.fr.referentials.error_period_filter, "#q_validity_period_begin_gteq_NUMi", "#q_validity_period_end_lteq_NUMi")
- workbenchDF()
-})
diff --git a/app/assets/javascripts/helpers/date_filters.js b/app/assets/javascripts/helpers/date_filters.js
deleted file mode 100644
index 1f48bb28f..000000000
--- a/app/assets/javascripts/helpers/date_filters.js
+++ /dev/null
@@ -1,38 +0,0 @@
-const DateFilter = function(buttonId, message, ...inputIds) {
- this.buttonId = buttonId
- this.inputIds = inputIds
- this.message = message
-
- const getVal = (str, key) => {
- let newStr = str.replace(/NUM/, key)
- return $(newStr).val()
- }
-
- const getDates = () => {
- return this.inputIds.reduce((arr, id) => {
- let newIds = [1, 2, 3].map(key => getVal(id, key))
- arr.push(...newIds)
- return arr
- },[])
- }
-
- const allInputFilled = () => {
- return getDates().every(date => !!date)
- }
-
- const noInputFilled = () => {
- return getDates().every(date => !date)
- }
-
- const execute = () => {
- $(this.buttonId).on("click", (e) => {
- if (allInputFilled() == false && noInputFilled() == false) {
- e.preventDefault()
- alert(this.message)
- }
- })
- }
- return execute
-}
-
-module.exports = DateFilter
diff --git a/app/assets/stylesheets/components/_referential_suites.sass b/app/assets/stylesheets/components/_referential_suites.sass
new file mode 100644
index 000000000..5e564ea8e
--- /dev/null
+++ b/app/assets/stylesheets/components/_referential_suites.sass
@@ -0,0 +1,69 @@
+table.calendar
+ display: table
+ width: 100%
+ table-layout: fixed
+ margin-bottom: 20px
+
+ th, td
+ border: 1px solid $darkgrey
+ text-align: center
+ padding: 0.35em 0.5em
+
+ th
+ padding: 0.5em
+
+ thead
+ tr
+ > th
+ border: none
+
+ &:first-child
+ text-transform: uppercase
+
+ tbody
+ tr > td
+ &.weekNumber
+ border: none
+ padding: 0.5em 0.5em 0.5em 0
+
+ &.outsideMonth
+ color: rgba($darkgrey, 0.35)
+
+ &.weekend
+ font-weight: bold
+
+ &.selected_period, &.selected_date, &.overlaped_date
+ > a
+ display: block
+ margin: 0 auto
+ width: 24px
+ height: 24px
+ line-height: 24px
+ color: $darkgrey
+ background-color: rgba($gold, 0.75)
+ border-radius: 50%
+
+ &:hover, &:focus
+ color: $darkgrey
+ text-decoration: none
+
+.col-xs-6
+ &:nth-child(2n +1)
+ clear: both
+
+.col-sm-4
+ @media (min-width: 768px)
+ &:nth-child(2n +1)
+ clear: none
+ &:nth-child(3n+1)
+ clear: both
+
+// .col-md-4
+// @media (min-width: 992px)
+
+.col-lg-3
+ @media (min-width: 1200px)
+ &:nth-child(2n +1), &:nth-child(3n+1)
+ clear: none
+ &:nth-child(4n+1)
+ clear: both
diff --git a/app/controllers/api_keys_controller.rb b/app/controllers/api_keys_controller.rb
index f8b96afdc..7ae8d4732 100644
--- a/app/controllers/api_keys_controller.rb
+++ b/app/controllers/api_keys_controller.rb
@@ -6,7 +6,7 @@ class ApiKeysController < BreadcrumbController
@api_key = Api::V1::ApiKey.new(api_key_params.merge(organisation: current_organisation))
create! do |format|
format.html {
- redirect_to workbenches_path
+ redirect_to dashboard_path
}
end
end
@@ -14,7 +14,7 @@ class ApiKeysController < BreadcrumbController
def update
update! do |format|
format.html {
- redirect_to workbenches_path
+ redirect_to dashboard_path
}
end
end
@@ -22,7 +22,7 @@ class ApiKeysController < BreadcrumbController
def destroy
destroy! do |format|
format.html {
- redirect_to workbenches_path
+ redirect_to dashboard_path
}
end
end
diff --git a/app/controllers/compliance_check_sets_controller.rb b/app/controllers/compliance_check_sets_controller.rb
new file mode 100644
index 000000000..fce8dcc56
--- /dev/null
+++ b/app/controllers/compliance_check_sets_controller.rb
@@ -0,0 +1,21 @@
+class ComplianceCheckSetsController < BreadcrumbController
+ defaults resource_class: ComplianceCheckSet
+ include RansackDateFilter
+ before_action only: [:index] { set_date_time_params("created_at", DateTime) }
+ respond_to :html
+
+ belongs_to :workbench
+
+ def index
+ index! do |format|
+ scope = self.ransack_period_range(scope: @compliance_check_sets, error_message: t('compliance_check_sets.filters.error_period_filter'), query: :where_created_at_between)
+ @q_for_form = scope.ransack(params[:q])
+ format.html {
+ @compliance_check_sets = ModelDecorator.decorate(
+ @q_for_form.result,
+ with: ComplianceCheckSetDecorator
+ )
+ }
+ end
+ end
+end \ No newline at end of file
diff --git a/app/controllers/compliance_control_blocks_controller.rb b/app/controllers/compliance_control_blocks_controller.rb
new file mode 100644
index 000000000..2dd69a865
--- /dev/null
+++ b/app/controllers/compliance_control_blocks_controller.rb
@@ -0,0 +1,12 @@
+class ComplianceControlBlocksController < BreadcrumbController
+ defaults resource_class: ComplianceControlBlock
+ belongs_to :compliance_control_set
+ actions :all, :except => [:show, :index]
+
+ private
+
+ def compliance_control_block_params
+ params.require(:compliance_control_block).permit(:transport_mode, :transport_submode)
+ end
+
+end \ No newline at end of file
diff --git a/app/controllers/compliance_control_sets_controller.rb b/app/controllers/compliance_control_sets_controller.rb
index c6f4288a9..9de90c21c 100644
--- a/app/controllers/compliance_control_sets_controller.rb
+++ b/app/controllers/compliance_control_sets_controller.rb
@@ -1,10 +1,13 @@
class ComplianceControlSetsController < BreadcrumbController
defaults resource_class: ComplianceControlSet
+ include RansackDateFilter
+ before_action only: [:index] { set_date_time_params("updated_at", DateTime) }
respond_to :html
def index
index! do |format|
- @q_for_form = @compliance_control_sets.ransack(params[:q])
+ scope = self.ransack_period_range(scope: @compliance_control_sets, error_message: t('imports.filters.error_period_filter'), query: :where_updated_at_between)
+ @q_for_form = scope.ransack(params[:q])
format.html {
@compliance_control_sets = decorate_compliance_control_sets(@q_for_form.result)
}
@@ -12,11 +15,22 @@ class ComplianceControlSetsController < BreadcrumbController
end
def show
- show! do
- @compliance_control_set = @compliance_control_set.decorate
+ show! do |format|
+ format.html {
+ @compliance_control_set = @compliance_control_set.decorate
+ @compliance_controls_without_block = decorate_compliance_controls(@compliance_control_set.compliance_controls.where(compliance_control_block_id: nil))
+ }
end
end
+ protected
+
+ def begin_of_association_chain
+ current_organisation
+ end
+
+ private
+
def decorate_compliance_control_sets(compliance_control_sets)
ModelDecorator.decorate(
compliance_control_sets,
@@ -24,13 +38,12 @@ class ComplianceControlSetsController < BreadcrumbController
)
end
- protected
-
- # def begin_of_association_chain
- # current_organisation
- # end
-
- private
+ def decorate_compliance_controls(compliance_controls)
+ ModelDecorator.decorate(
+ compliance_controls,
+ with: ComplianceControlDecorator,
+ )
+ end
def compliance_control_set_params
params.require(:compliance_control_set).permit(:name, :id)
diff --git a/app/controllers/compliance_controls_controller.rb b/app/controllers/compliance_controls_controller.rb
index dad9b935a..e51d1eb74 100644
--- a/app/controllers/compliance_controls_controller.rb
+++ b/app/controllers/compliance_controls_controller.rb
@@ -1,38 +1,49 @@
class ComplianceControlsController < BreadcrumbController
- include PolicyChecker
defaults resource_class: ComplianceControl
belongs_to :compliance_control_set
- def index
- index! do |format|
- format.html {
- @compliance_controls = decorate_compliance_controls(@compliance_controls)
- }
+ def select_type
+ @sti_subclasses = ComplianceControl.subclasses
+ end
+
+ def new
+ if params[:sti_class].blank?
+ flash[:notice] = I18n.t("compliance_controls.errors.mandatory_control_type")
+ redirect_to(action: :select_type)
end
+ new!
end
def create
- create!(notice: t('notice.compliance_control.created'))
+ puts build_resource.inspect
+ create! do |success, failure|
+ success.html { redirect_to compliance_control_set_path(parent) }
+ failure.html { render( :action => 'new' ) }
+ end
end
- def update
- path = compliance_control_set_compliance_control_path(parent, resource)
- update!(notice: t('notice.compliance_control.updated')) { path }
- end
+ protected
- def destroy
- destroy!(notice: t('notice.compliance_control.destroyed'))
+ alias_method :compliance_control_set, :parent
+ alias_method :compliance_control, :resource
+
+ def build_resource
+ get_resource_ivar || set_resource_ivar(compliance_control_class.send(:new, *resource_params))
end
private
- def decorate_compliance_controls(compliance_controls)
- ModelDecorator.decorate(
- compliance_controls,
- with: ComplianceControlDecorator,
- )
+
+ def compliance_control_class
+ (params[:sti_class] || params[:compliance_control][:type]).constantize
+ end
+
+ def dynamic_attributes_params
+ compliance_control_class.dynamic_attributes
end
def compliance_control_params
- params.require(:compliance_control).permit(:name, :code, :criticity, :comment, :control_attributes)
+ base = [:name, :code, :origin_code, :criticity, :comment, :control_attributes, :type, :compliance_control_block_id, :compliance_control_set_id]
+ permitted = base + dynamic_attributes_params
+ params.require(:compliance_control).permit(permitted)
end
end
diff --git a/app/controllers/concerns/ransack_date_filter.rb b/app/controllers/concerns/ransack_date_filter.rb
new file mode 100644
index 000000000..0fbde91d3
--- /dev/null
+++ b/app/controllers/concerns/ransack_date_filter.rb
@@ -0,0 +1,41 @@
+module RansackDateFilter
+ extend ActiveSupport::Concern
+
+ included do
+
+ def set_date_time_params(param_name, klass)
+ start_date = []
+ end_date = []
+
+ if params[:q] && params[:q][param_name] && !params[:q][param_name].has_value?(nil) && !params[:q][param_name].has_value?("")
+ [1, 2, 3].each do |key|
+ start_date << params[:q][param_name]["start_date(#{key}i)"].to_i
+ end_date << params[:q][param_name]["end_date(#{key}i)"].to_i
+ end
+
+ params[:q].delete([param_name])
+
+ if klass == DateTime
+ @begin_range = klass.new(*start_date,0,0,0) rescue nil
+ @end_range = klass.new(*end_date,23,59,59) rescue nil
+ else
+ @begin_range = klass.new(*start_date) rescue nil
+ @end_range = klass.new(*end_date) rescue nil
+ end
+ end
+ end
+
+ # Fake ransack filter
+ def ransack_period_range **options
+ return options[:scope] unless !!@begin_range && !!@end_range
+
+ if @begin_range > @end_range
+ flash.now[:error] = options[:error_message]
+ else
+ scope = options[:scope].send options[:query], @begin_range..@end_range
+ end
+ scope
+ end
+ end
+
+end \ No newline at end of file
diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb
new file mode 100644
index 000000000..2585dafca
--- /dev/null
+++ b/app/controllers/dashboards_controller.rb
@@ -0,0 +1,13 @@
+#
+# If you changed the default Dashboard implementation (see Dashboard),
+# this controller will use a custom partial like
+# custom/dashboards/_dashboard.html.slim for Custom::Dashboard
+#
+class DashboardsController < BreadcrumbController
+ respond_to :html, only: [:show]
+
+ def show
+ @dashboard = Dashboard.create self
+ end
+
+end
diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb
index 3333dc535..3c52dc935 100644
--- a/app/controllers/imports_controller.rb
+++ b/app/controllers/imports_controller.rb
@@ -1,7 +1,9 @@
class ImportsController < BreadcrumbController
+ include PolicyChecker
+ include RansackDateFilter
+ before_action only: [:index] { set_date_time_params("started_at", DateTime) }
skip_before_action :authenticate_user!, only: [:download]
defaults resource_class: Import, collection_name: 'imports', instance_name: 'import'
- before_action :ransack_started_at_params, only: [:index]
before_action :ransack_status_params, only: [:index]
respond_to :html
belongs_to :workbench
@@ -47,7 +49,8 @@ class ImportsController < BreadcrumbController
protected
def collection
scope = parent.imports.where(type: "WorkbenchImport")
- scope = ransack_period scope
+
+ scope = self.ransack_period_range(scope: scope, error_message: t('imports.filters.error_period_filter'), query: :where_started_at_in)
@q = scope.search(params[:q])
@@ -60,33 +63,6 @@ class ImportsController < BreadcrumbController
private
- def ransack_started_at_params
- start_date = []
- end_date = []
-
- if params[:q] && params[:q][:started_at] && !params[:q][:started_at].has_value?(nil) && !params[:q][:started_at].has_value?("")
- [1, 2, 3].each do |key|
- start_date << params[:q][:started_at]["begin(#{key}i)"].to_i
- end_date << params[:q][:started_at]["end(#{key}i)"].to_i
- end
- params[:q].delete([:started_at])
- @begin_range = DateTime.new(*start_date,0,0,0) rescue nil
- @end_range = DateTime.new(*end_date,23,59,59) rescue nil
- end
- end
-
- # Fake ransack filter
- def ransack_period scope
- return scope unless !!@begin_range && !!@end_range
-
- if @begin_range > @end_range
- flash.now[:error] = t('imports.filters.error_period_filter')
- else
- scope = scope.where_started_at_between(@begin_range, @end_range)
- end
- scope
- end
-
def ransack_status_params
if params[:q]
return params[:q].delete(:status_eq_any) if params[:q][:status_eq_any].empty? || ( (Import.status.values & params[:q][:status_eq_any]).length >= 4 )
diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb
index 0054963c9..2d24d5aa6 100644
--- a/app/controllers/time_tables_controller.rb
+++ b/app/controllers/time_tables_controller.rb
@@ -1,5 +1,7 @@
class TimeTablesController < ChouetteController
include TimeTablesHelper
+ include RansackDateFilter
+ before_action only: [:index] { set_date_time_params("bounding_dates", Date) }
defaults :resource_class => Chouette::TimeTable
respond_to :html
respond_to :xml
@@ -131,7 +133,7 @@ class TimeTablesController < ChouetteController
params[:q].delete("tag_search")
scope = select_time_tables.tagged_with(tags, :any => true) if tags.any?
end
- scope = ransack_periode(scope)
+ scope = self.ransack_period_range(scope: scope, error_message: t('referentials.errors.validity_period'), query: :overlapping)
@q = scope.search(params[:q])
if sort_column && sort_direction
@@ -159,28 +161,6 @@ class TimeTablesController < ChouetteController
end
private
- def ransack_periode scope
- return scope unless params[:q]
- return scope unless params[:q]['end_date_lteq(1i)'].present?
-
- begin_range = flatten_date('start_date_gteq')
- end_range = flatten_date('end_date_lteq')
-
- if begin_range > end_range
- flash.now[:error] = t('referentials.errors.validity_period')
- else
- scope = scope.overlapping(begin_range, end_range)
- params[:q] = params[:q].slice('comment_cont', 'color_cont_any')
- @begin_range = begin_range
- @end_range = end_range
- end
- scope
- end
-
- def flatten_date key
- date_int = %w(1 2 3).map {|e| params[:q]["#{key}(#{e}i)"].to_i }
- Date.new(*date_int)
- end
def sort_column
referential.time_tables.column_names.include?(params[:sort]) ? params[:sort] : 'comment'
diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb
index 54ddb8be1..e271007d6 100644
--- a/app/controllers/workbenches_controller.rb
+++ b/app/controllers/workbenches_controller.rb
@@ -1,20 +1,18 @@
class WorkbenchesController < BreadcrumbController
before_action :query_params, only: [:show]
-
+ include RansackDateFilter
+ before_action only: [:show] { set_date_time_params("validity_period", Date) }
defaults resource_class: Workbench
respond_to :html, only: [:show, :index]
def index
- # Only display Wb with selected name, according to #4108
- @workbench = current_organisation.workbenches.find_by(name: "Gestion de l'offre")
- @referentials = @workbench.all_referentials
- @calendars = Calendar.where('organisation_id = ? OR shared = ?', current_organisation.id, true)
+ redirect_to dashboard_path
end
def show
scope = resource.all_referentials
scope = ransack_associated_lines(scope)
- scope = ransack_period(scope)
+ scope = self.ransack_period_range(scope: scope, error_message: t('referentials.errors.validity_period'), query: :in_periode)
scope = ransack_status(scope)
@q_for_form = scope.ransack(params[:q])
@@ -72,33 +70,6 @@ class WorkbenchesController < BreadcrumbController
end
# Fake ransack filter
- def ransack_period scope
- period = params[:q]['validity_period']
- return scope unless period
-
- begin
- if period['begin_gteq'].kind_of?(Array)
- begin_range = Date.new(*period['begin_gteq'].map(&:to_i))
- end_range = Date.new(*period['end_lteq'].map(&:to_i))
- else
- begin_range = Date.new(period["begin_gteq(1i)"].to_i, period["begin_gteq(2i)"].to_i, period["begin_gteq(3i)"].to_i)
- end_range = Date.new(period["end_lteq(1i)"].to_i, period["end_lteq(2i)"].to_i, period["end_lteq(3i)"].to_i)
- end
- rescue Exception => e
- return scope
- end
-
- if begin_range > end_range
- flash.now[:error] = t('referentials.errors.validity_period')
- else
- scope = scope.in_periode(begin_range..end_range)
- @begin_range = begin_range
- @end_range = end_range
- end
- scope
- end
-
- # Fake ransack filter
def ransack_status scope
archived = !params[:q]['archived_at_not_null'].to_i.zero?
unarchived = !params[:q]['archived_at_null'].to_i.zero?
diff --git a/app/decorators/company_decorator.rb b/app/decorators/company_decorator.rb
index 402bd3ab6..764cce3a0 100644
--- a/app/decorators/company_decorator.rb
+++ b/app/decorators/company_decorator.rb
@@ -19,8 +19,6 @@ class CompanyDecorator < Draper::Decorator
links = []
if h.policy(Chouette::Company).create?
- require 'pry'
- binding.pry
links << Link.new(
content: h.t('companies.actions.new'),
href: h.new_line_referential_company_path(context[:referential])
diff --git a/app/decorators/compliance_check_set_decorator.rb b/app/decorators/compliance_check_set_decorator.rb
new file mode 100644
index 000000000..5f3821cbe
--- /dev/null
+++ b/app/decorators/compliance_check_set_decorator.rb
@@ -0,0 +1,8 @@
+class ComplianceCheckSetDecorator < Draper::Decorator
+ delegate_all
+
+ def action_links
+ links = []
+ end
+
+end
diff --git a/app/decorators/compliance_control_decorator.rb b/app/decorators/compliance_control_decorator.rb
index 38b968ad1..e70ff5350 100644
--- a/app/decorators/compliance_control_decorator.rb
+++ b/app/decorators/compliance_control_decorator.rb
@@ -4,21 +4,30 @@ class ComplianceControlDecorator < Draper::Decorator
def action_links
links = []
- if h.policy(object).destroy?
+ # if h.policy(object).destroy?
links << Link.new(
content: h.destroy_link_content,
href: h.compliance_control_set_compliance_control_path(object.compliance_control_set.id, object.id),
method: :delete,
- data: { confirm: h.t('compliance_controls.actions.destroy_confirm') }
+ data: { confirm: h.t('compliance_control_sets.actions.destroy_confirm') }
)
- end
+ # end
- if h.policy(object).edit?
+ # if h.policy(object).edit?
links << Link.new(
- content: h.t('compliance_controls.actions.edit'),
- href: h.edit_compliance_control_set_path(object.compliance_control_set.id, object.id)
+ content: h.t('compliance_control_sets.actions.edit'),
+ href: h.edit_compliance_control_set_compliance_control_path(object.compliance_control_set.id, object.id)
)
- end
+ # end
+
+
+ # if h.policy(object).show?
+ links << Link.new(
+ content: h.t('compliance_control_sets.actions.show'),
+ href: h.compliance_control_set_compliance_control_path(object.compliance_control_set.id, object.id)
+ )
+ # end
+
links
end
diff --git a/app/decorators/compliance_control_set_decorator.rb b/app/decorators/compliance_control_set_decorator.rb
index 876a54d09..f4aa607e1 100644
--- a/app/decorators/compliance_control_set_decorator.rb
+++ b/app/decorators/compliance_control_set_decorator.rb
@@ -19,6 +19,7 @@ class ComplianceControlSetDecorator < Draper::Decorator
href: h.edit_compliance_control_set_path(object.id)
)
# end
+
links
end
diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb
index a3ee9de72..da1f270ab 100644
--- a/app/helpers/breadcrumb_helper.rb
+++ b/app/helpers/breadcrumb_helper.rb
@@ -75,13 +75,13 @@ module BreadcrumbHelper
end
def calendar_breadcrumb(action)
- add_breadcrumb I18n.t('breadcrumbs.referentials'), workbenches_path
+ add_breadcrumb I18n.t('breadcrumbs.root'), root_path
add_breadcrumb I18n.t('calendars.index.title'), calendars_path
add_breadcrumb @calendar.name if %i(show edit).include? action
end
def workbench_breadcrumb(action)
- add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path
+ add_breadcrumb I18n.t("breadcrumbs.root"), root_path
add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench)
end
@@ -217,7 +217,7 @@ module BreadcrumbHelper
end
def import_breadcrumb (action)
- add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path
+ add_breadcrumb I18n.t("breadcrumbs.root"), root_path
add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench)
add_breadcrumb I18n.t("breadcrumbs.imports"), workbench_imports_path(@workbench)
@@ -242,7 +242,7 @@ module BreadcrumbHelper
end
def compliance_control_sets_breadcrumb (action)
- add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path
+ add_breadcrumb I18n.t("breadcrumbs.root"), root_path
#add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench)
end
@@ -264,7 +264,7 @@ module BreadcrumbHelper
end
def organisation_breadcrumb (action = :index)
- add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path
+ add_breadcrumb I18n.t("breadcrumbs.root"), root_path
add_breadcrumb breadcrumb_label(@organisation), organisation_path,:title => breadcrumb_tooltip(@organisation) unless action == :index
end
diff --git a/app/helpers/compliance_control_blocks_helper.rb b/app/helpers/compliance_control_blocks_helper.rb
new file mode 100644
index 000000000..09e22d6e9
--- /dev/null
+++ b/app/helpers/compliance_control_blocks_helper.rb
@@ -0,0 +1,10 @@
+module ComplianceControlBlocksHelper
+ def transport_mode(transport_mode, transport_submode)
+ if (transport_mode) && (transport_submode) != ""
+ transportMode = "[" + t("enumerize.transport_mode.#{transport_mode}") + "]" + "[" + t("enumerize.transport_submode.#{transport_submode}") + "]"
+ else
+ transportMode = "[Tous les modes de transport]"
+ end
+ transportMode
+ end
+end \ No newline at end of file
diff --git a/app/helpers/lines_helper.rb b/app/helpers/lines_helper.rb
index ccf3a12a2..e9a4bd3c5 100644
--- a/app/helpers/lines_helper.rb
+++ b/app/helpers/lines_helper.rb
@@ -5,14 +5,6 @@ module LinesHelper
line.number
end
- def sorted_transport_submode
- Chouette::Line.transport_submode.values.sort_by{|m| t("enumerize.line.transport_submode.#{m}").parameterize }
- end
-
- def sorted_transport_mode
- Chouette::Line.transport_mode.values.sort_by{|m| t("enumerize.line.transport_mode.#{m}").parameterize }
- end
-
def colors?(line)
line.text_color.present? || line.color.present?
end
diff --git a/app/helpers/referentials_helper.rb b/app/helpers/referentials_helper.rb
index 73384bef6..f3c18d9f8 100644
--- a/app/helpers/referentials_helper.rb
+++ b/app/helpers/referentials_helper.rb
@@ -1,2 +1,12 @@
module ReferentialsHelper
+ # Line statuses helper
+ def line_status(status)
+ if status
+ cls = 'danger'
+ content_tag :span, status ? " #{t('false')} " : " #{t('true')}", class: "fa fa-exclamation-circle fa-lg text-#{cls}"
+ else
+ cls = 'success'
+ content_tag :span, status ? " #{t('false')} " : " #{t('true')}", class: "fa fa-check-circle fa-lg text-#{cls}"
+ end
+ end
end
diff --git a/app/javascript/date_filters/calendar.js b/app/javascript/date_filters/calendar.js
new file mode 100644
index 000000000..7e5f678e2
--- /dev/null
+++ b/app/javascript/date_filters/calendar.js
@@ -0,0 +1,5 @@
+import DateFilter from '../helpers/date_filters'
+
+const calendarDF = new DateFilter("calendar_filter_btn", "Tous les champs du filtre de date doivent être remplis", "q_contains_date_NUMi")
+
+export default calendarDF \ No newline at end of file
diff --git a/app/javascript/date_filters/compliance_check_set.js b/app/javascript/date_filters/compliance_check_set.js
new file mode 100644
index 000000000..09544a3cd
--- /dev/null
+++ b/app/javascript/date_filters/compliance_check_set.js
@@ -0,0 +1,5 @@
+import DateFilter from '../helpers/date_filters'
+
+const complianceCheckSetDF = new DateFilter("compliance_check_set_filter_btn", "Tous les champs du filtre de date doivent être remplis", "q_created_at_start_date_NUMi", "q_created_at_end_date_NUMi")
+
+export default complianceCheckSetDF \ No newline at end of file
diff --git a/app/javascript/date_filters/compliance_control_set.js b/app/javascript/date_filters/compliance_control_set.js
new file mode 100644
index 000000000..60d8e3bfa
--- /dev/null
+++ b/app/javascript/date_filters/compliance_control_set.js
@@ -0,0 +1,5 @@
+import DateFilter from '../helpers/date_filters'
+
+const complianceControlSetDF = new DateFilter("compliance_control_set_filter_btn", "Tous les champs du filtre de date doivent être remplis", "q_updated_at_start_date_NUMi", "q_updated_at_end_date_NUMi")
+
+export default complianceControlSetDF \ No newline at end of file
diff --git a/app/javascript/date_filters/import.js b/app/javascript/date_filters/import.js
new file mode 100644
index 000000000..356371d30
--- /dev/null
+++ b/app/javascript/date_filters/import.js
@@ -0,0 +1,5 @@
+import DateFilter from '../helpers/date_filters'
+
+const importDF = new DateFilter("import_filter_btn", "Tous les champs du filtre de date doivent être remplis", "q_started_at_start_date_NUMi", "q_started_at_end_date_NUMi")
+
+export default importDF \ No newline at end of file
diff --git a/app/javascript/date_filters/index.js b/app/javascript/date_filters/index.js
new file mode 100644
index 000000000..ee892a7fe
--- /dev/null
+++ b/app/javascript/date_filters/index.js
@@ -0,0 +1,17 @@
+import calendarDF from './calendar'
+import complianceControlSetDF from './compliance_control_set'
+import complianceCheckSetDF from './compliance_check_set'
+import timetableDF from './time_table'
+import importDF from './import'
+import workbenchDF from './workbench'
+
+const DateFilters = {
+ calendarDF,
+ complianceCheckSetDF,
+ complianceControlSetDF,
+ importDF,
+ timetableDF,
+ workbenchDF
+}
+
+export default DateFilters \ No newline at end of file
diff --git a/app/javascript/date_filters/time_table.js b/app/javascript/date_filters/time_table.js
new file mode 100644
index 000000000..d26693993
--- /dev/null
+++ b/app/javascript/date_filters/time_table.js
@@ -0,0 +1,5 @@
+import DateFilter from '../helpers/date_filters'
+
+const timetableDF = new DateFilter("time_table_filter_btn", "Tous les champs du filtre de date doivent être remplis", "q_bounding_dates_start_date_NUMi", "q_bounding_dates_end_date_NUMi")
+
+export default timetableDF \ No newline at end of file
diff --git a/app/javascript/date_filters/workbench.js b/app/javascript/date_filters/workbench.js
new file mode 100644
index 000000000..cc4112d73
--- /dev/null
+++ b/app/javascript/date_filters/workbench.js
@@ -0,0 +1,5 @@
+import DateFilter from '../helpers/date_filters'
+
+const workbenchDF = new DateFilter("referential_filter_btn", "Tous les champs du filtre de date doivent être remplis", "q_validity_period_start_date_NUMi", "q_validity_period_end_date_NUMi")
+
+export default workbenchDF \ No newline at end of file
diff --git a/app/javascript/helpers/clone.js b/app/javascript/helpers/clone.js
new file mode 100644
index 000000000..00127e2b1
--- /dev/null
+++ b/app/javascript/helpers/clone.js
@@ -0,0 +1,12 @@
+import _ from 'lodash'
+
+/* This function helps having a bit more security when we pass data from the backend to the React parts
+ It clones the obj (window variable) and then conditionnaly delete the window variable
+*/
+
+export default function clone(window, key, deletable = false) {
+ let obj = _.cloneDeep(window[key])
+
+ if (deletable) delete window[key]
+ return obj
+} \ No newline at end of file
diff --git a/app/javascript/helpers/date_filters.js b/app/javascript/helpers/date_filters.js
new file mode 100644
index 000000000..53c9da641
--- /dev/null
+++ b/app/javascript/helpers/date_filters.js
@@ -0,0 +1,29 @@
+export default function DateFilter(buttonId, message, ...inputIds) {
+ this.button = document.getElementById(buttonId)
+ this.inputIds = inputIds
+ this.message = message
+
+ const getVal = (str, key) => {
+ let newStr = str.replace(/NUM/, key)
+ return document.getElementById(newStr).value
+ }
+
+ const getDates = () => {
+ return this.inputIds.reduce((arr, id) => {
+ let newIds = [1, 2, 3].map(key => getVal(id, key))
+ arr.push(...newIds)
+ return arr
+ }, [])
+ }
+
+ const allInputFilled = () => getDates().every(date => !!date)
+
+ const noInputFilled = () => getDates().every(date => !date)
+
+ this.button && this.button.addEventListener('click', (event) => {
+ if (!allInputFilled() && !noInputFilled()) {
+ event.preventDefault()
+ alert(this.message)
+ }
+ })
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js b/app/javascript/journey_patterns/actions/index.js
index 825e7bb7d..0c1cb5f5c 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/actions/index.js
+++ b/app/javascript/journey_patterns/actions/index.js
@@ -1,4 +1,4 @@
-var Promise = require('promise-polyfill')
+import Promise from 'promise-polyfill'
// To add to window
if (!window.Promise) {
@@ -217,4 +217,4 @@ const actions = {
}
}
-module.exports = actions
+export default actions \ No newline at end of file
diff --git a/app/javascript/journey_patterns/components/App.js b/app/javascript/journey_patterns/components/App.js
new file mode 100644
index 000000000..ac6214cc1
--- /dev/null
+++ b/app/javascript/journey_patterns/components/App.js
@@ -0,0 +1,21 @@
+import React from 'react'
+import AddJourneyPattern from '../containers/AddJourneyPattern'
+import Navigate from '../containers/Navigate'
+import Modal from '../containers/Modal'
+import ConfirmModal from '../containers/ConfirmModal'
+import SaveJourneyPattern from '../containers/SaveJourneyPattern'
+import JourneyPatternList from '../containers/JourneyPatternList'
+
+const App = () => (
+ <div>
+ <Navigate />
+ <JourneyPatternList />
+ <Navigate />
+ <AddJourneyPattern />
+ <SaveJourneyPattern />
+ <ConfirmModal />
+ <Modal/>
+ </div>
+)
+
+export default App
diff --git a/app/javascript/journey_patterns/components/ConfirmModal.js b/app/javascript/journey_patterns/components/ConfirmModal.js
new file mode 100644
index 000000000..2cc1bef44
--- /dev/null
+++ b/app/javascript/journey_patterns/components/ConfirmModal.js
@@ -0,0 +1,46 @@
+import React, { PropTypes } from 'react'
+
+export default function ConfirmModal({dispatch, modal, onModalAccept, onModalCancel, journeyPatterns}) {
+ return (
+ <div className={'modal fade ' + ((modal.type == 'confirm') ? 'in' : '')} id='ConfirmModal'>
+ <div className='modal-container'>
+ <div className='modal-dialog'>
+ <div className='modal-content'>
+ <div className='modal-header'>
+ <h4 className='modal-title'>Confirmation</h4>
+ </div>
+ <div className='modal-body'>
+ <div className='mt-md mb-md'>
+ <p>Vous vous apprêtez à changer de page. Voulez-vous valider vos modifications avant cela ?</p>
+ </div>
+ </div>
+ <div className='modal-footer'>
+ <button
+ className='btn btn-link'
+ data-dismiss='modal'
+ type='button'
+ onClick={() => { onModalCancel(modal.confirmModal.callback) }}
+ >
+ Ne pas valider
+ </button>
+ <button
+ className='btn btn-primary'
+ data-dismiss='modal'
+ type='button'
+ onClick={() => { onModalAccept(modal.confirmModal.callback, journeyPatterns) }}
+ >
+ Valider
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}
+
+ConfirmModal.propTypes = {
+ modal: PropTypes.object.isRequired,
+ onModalAccept: PropTypes.func.isRequired,
+ onModalCancel: PropTypes.func.isRequired
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/CreateModal.js b/app/javascript/journey_patterns/components/CreateModal.js
index 12871431a..d0eff6e57 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/components/CreateModal.js
+++ b/app/javascript/journey_patterns/components/CreateModal.js
@@ -1,9 +1,7 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../actions')
+import React, { PropTypes, Component } from 'react'
+import actions from '../actions'
-class CreateModal extends Component {
+export default class CreateModal extends Component {
constructor(props) {
super(props)
}
@@ -121,6 +119,4 @@ CreateModal.propTypes = {
onOpenCreateModal: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired,
onAddJourneyPattern: PropTypes.func.isRequired
-}
-
-module.exports = CreateModal
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/EditModal.js b/app/javascript/journey_patterns/components/EditModal.js
index 1fc935932..699f89b85 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/components/EditModal.js
+++ b/app/javascript/journey_patterns/components/EditModal.js
@@ -1,9 +1,7 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../actions')
+import React, { PropTypes, Component } from 'react'
+import actions from '../actions'
-class EditModal extends Component {
+export default class EditModal extends Component {
constructor(props) {
super(props)
}
@@ -109,6 +107,4 @@ EditModal.propTypes = {
modal: PropTypes.object,
onModalClose: PropTypes.func.isRequired,
saveModal: PropTypes.func.isRequired
-}
-
-module.exports = EditModal
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js b/app/javascript/journey_patterns/components/JourneyPattern.js
index 377fd0612..dde73a957 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPattern.js
+++ b/app/javascript/journey_patterns/components/JourneyPattern.js
@@ -1,9 +1,7 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../actions')
+import React, { PropTypes, Component } from 'react'
+import actions from '../actions'
-class JourneyPattern extends Component{
+export default class JourneyPattern extends Component{
constructor(props){
super(props)
this.previousCity = undefined
@@ -57,6 +55,10 @@ class JourneyPattern extends Component{
)
}
+ isDisabled(action) {
+ return !this.props.status.policy[`journey_patterns.${action}`] && !this.props.editMode
+ }
+
render() {
this.previousCity = undefined
@@ -78,9 +80,10 @@ class JourneyPattern extends Component{
<span className='fa fa-cog'></span>
</div>
<ul className='dropdown-menu'>
- <li className={(this.props.status.policy['journey_patterns.update'] == false || this.props.editMode == false) ? 'disabled' : ''}>
+ <li className={this.isDisabled('update') ? 'disabled' : ''}>
<button
type='button'
+ disabled={this.isDisabled('update')}
onClick={this.props.onOpenEditModal}
data-toggle='modal'
data-target='#JourneyPatternModal'
@@ -91,10 +94,10 @@ class JourneyPattern extends Component{
<li className={this.props.value.object_id ? '' : 'disabled'}>
{this.vehicleJourneyURL(this.props.value.object_id)}
</li>
- <li className={'delete-action' + ((this.props.status.policy['journey_patterns.destroy'] == false || this.props.editMode == false) ? ' disabled' : '')}>
+ <li className={'delete-action' + (this.isDisabled('destroy') ? ' disabled' : '')}>
<button
type='button'
- disabled={(this.props.status.policy['journey_patterns.destroy'] == false || this.props.editMode == false)? 'disabled' : ''}
+ disabled={this.isDisabled('destroy') ? 'disabled' : ''}
onClick={(e) => {
e.preventDefault()
this.props.onDeleteJourneyPattern(this.props.index)}
@@ -125,6 +128,4 @@ JourneyPattern.propTypes = {
onCheckboxChange: PropTypes.func.isRequired,
onOpenEditModal: PropTypes.func.isRequired,
onDeleteJourneyPattern: PropTypes.func.isRequired
-}
-
-module.exports = JourneyPattern
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPatterns.js b/app/javascript/journey_patterns/components/JourneyPatterns.js
index 6506b706c..4b2badabb 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/components/JourneyPatterns.js
+++ b/app/javascript/journey_patterns/components/JourneyPatterns.js
@@ -1,10 +1,9 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var JourneyPattern = require('./JourneyPattern')
-var _ = require('lodash')
+import React, { PropTypes, Component } from 'react'
+import _ from 'lodash'
+import JourneyPattern from './JourneyPattern'
-class JourneyPatterns extends Component{
+
+export default class JourneyPatterns extends Component {
constructor(props){
super(props)
this.previousCity = undefined
@@ -153,6 +152,4 @@ JourneyPatterns.propTypes = {
onCheckboxChange: PropTypes.func.isRequired,
onLoadFirstPage: PropTypes.func.isRequired,
onOpenEditModal: PropTypes.func.isRequired
-}
-
-module.exports = JourneyPatterns
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/Navigate.js b/app/javascript/journey_patterns/components/Navigate.js
index 5747aa5ce..f2fdd668f 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/components/Navigate.js
+++ b/app/javascript/journey_patterns/components/Navigate.js
@@ -1,9 +1,7 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../actions')
+import React, { PropTypes, Component } from 'react'
+import actions from '../actions'
-let Navigate = ({ dispatch, journeyPatterns, pagination, status }) => {
+export default function Navigate({ dispatch, journeyPatterns, pagination, status }) {
let firstPage = 1
let lastPage = Math.ceil(pagination.totalCount / window.journeyPatternsPerPage)
@@ -61,6 +59,4 @@ Navigate.propTypes = {
status: PropTypes.object.isRequired,
pagination: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired
-}
-
-module.exports = Navigate
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/components/SaveJourneyPattern.js b/app/javascript/journey_patterns/components/SaveJourneyPattern.js
index 767dab088..d071fa542 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/components/SaveJourneyPattern.js
+++ b/app/javascript/journey_patterns/components/SaveJourneyPattern.js
@@ -1,9 +1,7 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../actions')
+import React, { PropTypes, Component } from 'react'
+import actions from '../actions'
-class SaveJourneyPattern extends Component{
+export default class SaveJourneyPattern extends Component {
constructor(props){
super(props)
}
@@ -38,6 +36,4 @@ SaveJourneyPattern.propTypes = {
journeyPatterns: PropTypes.array.isRequired,
status: PropTypes.object.isRequired,
page: PropTypes.number.isRequired
-}
-
-module.exports = SaveJourneyPattern
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/containers/AddJourneyPattern.js b/app/javascript/journey_patterns/containers/AddJourneyPattern.js
index 7aa27754e..b093fd111 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/containers/AddJourneyPattern.js
+++ b/app/javascript/journey_patterns/containers/AddJourneyPattern.js
@@ -1,6 +1,6 @@
-var actions = require('../actions')
-var connect = require('react-redux').connect
-var CreateModal = require('../components/CreateModal')
+import { connect } from 'react-redux'
+import actions from '../actions'
+import CreateModal from '../components/CreateModal'
const mapStateToProps = (state) => {
return {
@@ -27,4 +27,4 @@ const mapDispatchToProps = (dispatch) => {
const AddJourneyPattern = connect(mapStateToProps, mapDispatchToProps)(CreateModal)
-module.exports = AddJourneyPattern
+export default AddJourneyPattern
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/containers/ConfirmModal.js b/app/javascript/journey_patterns/containers/ConfirmModal.js
index d66425a3a..92ce09f33 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/containers/ConfirmModal.js
+++ b/app/javascript/journey_patterns/containers/ConfirmModal.js
@@ -1,6 +1,6 @@
-var actions = require('../actions')
-var connect = require('react-redux').connect
-var ConfirmModal = require('../components/ConfirmModal')
+import { connect } from 'react-redux'
+import actions from '../actions'
+import ConfirmModal from '../components/ConfirmModal'
const mapStateToProps = (state) => {
return {
@@ -27,4 +27,4 @@ const mapDispatchToProps = (dispatch) => {
const ConfirmModalContainer = connect(mapStateToProps, mapDispatchToProps)(ConfirmModal)
-module.exports = ConfirmModalContainer
+export default ConfirmModalContainer
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/containers/JourneyPatternList.js b/app/javascript/journey_patterns/containers/JourneyPatternList.js
index 228df3ede..d98734407 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/containers/JourneyPatternList.js
+++ b/app/javascript/journey_patterns/containers/JourneyPatternList.js
@@ -1,6 +1,6 @@
-var actions = require('../actions')
-var connect = require('react-redux').connect
-var JourneyPatterns = require('../components/JourneyPatterns')
+import { connect } from 'react-redux'
+import actions from '../actions'
+import JourneyPatterns from '../components/JourneyPatterns'
const mapStateToProps = (state) => {
return {
@@ -31,4 +31,4 @@ const mapDispatchToProps = (dispatch) => {
const JourneyPatternList = connect(mapStateToProps, mapDispatchToProps)(JourneyPatterns)
-module.exports = JourneyPatternList
+export default JourneyPatternList
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/containers/Modal.js b/app/javascript/journey_patterns/containers/Modal.js
index ef6a4a6b1..ace71a857 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/containers/Modal.js
+++ b/app/javascript/journey_patterns/containers/Modal.js
@@ -1,7 +1,7 @@
-var connect = require('react-redux').connect
-var EditModal = require('../components/EditModal')
-var CreateModal = require('../components/CreateModal')
-var actions = require('../actions')
+import { connect } from 'react-redux'
+import actions from '../actions'
+import EditModal from '../components/EditModal'
+import CreateModal from '../components/CreateModal'
const mapStateToProps = (state) => {
return {
@@ -23,4 +23,4 @@ const mapDispatchToProps = (dispatch) => {
const ModalContainer = connect(mapStateToProps, mapDispatchToProps)(EditModal, CreateModal)
-module.exports = ModalContainer
+export default ModalContainer
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/containers/Navigate.js b/app/javascript/journey_patterns/containers/Navigate.js
index ef9f8859c..d34e0b4c5 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/containers/Navigate.js
+++ b/app/javascript/journey_patterns/containers/Navigate.js
@@ -1,7 +1,6 @@
-var React = require('react')
-var connect = require('react-redux').connect
-var actions = require('../actions')
-var NavigateComponent = require('../components/Navigate')
+import { connect } from 'react-redux'
+import actions from '../actions'
+import NavigateComponent from '../components/Navigate'
const mapStateToProps = (state) => {
return {
@@ -11,7 +10,6 @@ const mapStateToProps = (state) => {
}
}
-
const Navigate = connect(mapStateToProps)(NavigateComponent)
-module.exports = Navigate
+export default Navigate \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/containers/SaveJourneyPattern.js b/app/javascript/journey_patterns/containers/SaveJourneyPattern.js
index 434264fea..b630c121c 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/containers/SaveJourneyPattern.js
+++ b/app/javascript/journey_patterns/containers/SaveJourneyPattern.js
@@ -1,7 +1,6 @@
-var React = require('react')
-var connect = require('react-redux').connect
-var actions = require('../actions')
-var SaveJourneyPatternComponent = require('../components/SaveJourneyPattern')
+import { connect } from 'react-redux'
+import actions from '../actions'
+import SaveJourneyPatternComponent from '../components/SaveJourneyPattern'
const mapStateToProps = (state) => {
return {
@@ -25,4 +24,4 @@ const mapDispatchToProps = (dispatch) => {
const SaveJourneyPattern = connect(mapStateToProps, mapDispatchToProps)(SaveJourneyPatternComponent)
-module.exports = SaveJourneyPattern
+export default SaveJourneyPattern
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/editMode.js b/app/javascript/journey_patterns/reducers/editMode.js
index 2e8af1aa8..bff976804 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/editMode.js
+++ b/app/javascript/journey_patterns/reducers/editMode.js
@@ -1,4 +1,4 @@
-const editMode = (state = {}, action ) => {
+export default function editMode(state = {}, action ) {
switch (action.type) {
case "ENTER_EDIT_MODE":
return true
@@ -7,6 +7,4 @@ const editMode = (state = {}, action ) => {
default:
return state
}
-}
-
-module.exports = editMode
+} \ No newline at end of file
diff --git a/app/javascript/journey_patterns/reducers/index.js b/app/javascript/journey_patterns/reducers/index.js
new file mode 100644
index 000000000..2ffaf86d4
--- /dev/null
+++ b/app/javascript/journey_patterns/reducers/index.js
@@ -0,0 +1,18 @@
+import { combineReducers } from 'redux'
+import editMode from './editMode'
+import status from './status'
+import journeyPatterns from './journeyPatterns'
+import pagination from './pagination'
+import modal from './modal'
+import stopPointsList from './stopPointsList'
+
+const journeyPatternsApp = combineReducers({
+ editMode,
+ status,
+ journeyPatterns,
+ pagination,
+ stopPointsList,
+ modal
+})
+
+export default journeyPatternsApp
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/journeyPatterns.js b/app/javascript/journey_patterns/reducers/journeyPatterns.js
index d4f7257d7..0bbcba976 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/journeyPatterns.js
+++ b/app/javascript/journey_patterns/reducers/journeyPatterns.js
@@ -1,7 +1,7 @@
-var _ = require('lodash')
-var actions = require("../actions")
+import _ from 'lodash'
+import actions from "../actions"
-const journeyPattern = (state = {}, action) => {
+const journeyPattern = (state = {}, action) =>{
switch (action.type) {
case 'ADD_JOURNEYPATTERN':
let stopPoints = window.stopPoints
@@ -33,7 +33,7 @@ const journeyPattern = (state = {}, action) => {
}
}
-const journeyPatterns = (state = [], action) => {
+export default function journeyPatterns (state = [], action) {
switch (action.type) {
case 'RECEIVE_JOURNEY_PATTERNS':
return [...action.json]
@@ -87,6 +87,4 @@ const journeyPatterns = (state = [], action) => {
default:
return state
}
-}
-
-module.exports = journeyPatterns
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/modal.js b/app/javascript/journey_patterns/reducers/modal.js
index 86cfb5a25..0a96f1679 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/modal.js
+++ b/app/javascript/journey_patterns/reducers/modal.js
@@ -1,5 +1,6 @@
-var _ = require('lodash')
-const modal = (state = {}, action) => {
+import _ from 'lodash'
+
+export default function modal(state = {}, action) {
switch (action.type) {
case 'OPEN_CONFIRM_MODAL':
$('#ConfirmModal').modal('show')
@@ -37,6 +38,4 @@ const modal = (state = {}, action) => {
default:
return state
}
-}
-
-module.exports = modal
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/pagination.js b/app/javascript/journey_patterns/reducers/pagination.js
index 0714ca843..01fdf21d4 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/pagination.js
+++ b/app/javascript/journey_patterns/reducers/pagination.js
@@ -1,5 +1,6 @@
-var _ = require('lodash')
-const pagination = (state = {}, action) => {
+import _ from 'lodash'
+
+export default function pagination (state = {}, action) {
switch (action.type) {
case 'RECEIVE_JOURNEY_PATTERNS':
return _.assign({}, state, {stateChanged: false})
@@ -31,6 +32,4 @@ const toggleOnConfirmModal = (arg = '') =>{
$('.confirm').each(function(){
$(this).data('toggle','')
})
-}
-
-module.exports = pagination
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/status.js b/app/javascript/journey_patterns/reducers/status.js
index 07bbdc249..88c75966d 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/reducers/status.js
+++ b/app/javascript/journey_patterns/reducers/status.js
@@ -1,7 +1,7 @@
-var _ = require('lodash')
-var actions = require("../actions")
+import _ from 'lodash'
+import actions from '../actions'
-const status = (state = {}, action) => {
+export default function status (state = {}, action) {
switch (action.type) {
case 'UNAVAILABLE_SERVER':
return _.assign({}, state, {fetchSuccess: false})
@@ -18,6 +18,4 @@ const status = (state = {}, action) => {
default:
return state
}
-}
-
-module.exports = status
+} \ No newline at end of file
diff --git a/app/javascript/journey_patterns/reducers/stopPointsList.js b/app/javascript/journey_patterns/reducers/stopPointsList.js
new file mode 100644
index 000000000..ee5eb1a80
--- /dev/null
+++ b/app/javascript/journey_patterns/reducers/stopPointsList.js
@@ -0,0 +1,6 @@
+export default function stopPointsList (state = [], action) {
+ switch (action.type) {
+ default:
+ return state
+ }
+} \ No newline at end of file
diff --git a/app/javascript/packs/application.js b/app/javascript/packs/application.js
new file mode 100644
index 000000000..0b3711e53
--- /dev/null
+++ b/app/javascript/packs/application.js
@@ -0,0 +1,11 @@
+/* eslint no-console:0 */
+// This file is automatically compiled by Webpack, along with any other files
+// present in this directory. You're encouraged to place your actual application logic in
+// a relevant structure within app/javascript and only use these pack files to reference
+// that code so it'll be compiled.
+//
+// To reference this file, add <%= javascript_pack_tag 'application' %> to the appropriate
+// layout file, like app/views/layouts/application.html.erb
+
+// import jQuery from 'jquery'
+// import {} from 'jquery-ujs'
diff --git a/app/javascript/packs/date_filters.js b/app/javascript/packs/date_filters.js
new file mode 100644
index 000000000..88f508152
--- /dev/null
+++ b/app/javascript/packs/date_filters.js
@@ -0,0 +1 @@
+import DateFilter from '../date_filters' \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/journey_patterns/index.js b/app/javascript/packs/journey_patterns/index.js
index ca9efd2d0..fde28b45d 100644
--- a/app/assets/javascripts/es6_browserified/journey_patterns/index.js
+++ b/app/javascript/packs/journey_patterns/index.js
@@ -1,9 +1,10 @@
-var React = require('react')
-var render = require('react-dom').render
-var Provider = require('react-redux').Provider
-var createStore = require('redux').createStore
-var journeyPatternsApp = require('./reducers')
-var App = require('./components/App')
+import React from 'react'
+import { render } from 'react-dom'
+import { Provider } from 'react-redux'
+import { createStore } from 'redux'
+import journeyPatternsApp from '../../journey_patterns/reducers'
+import App from '../../journey_patterns/components/App'
+import clone from '../../helpers/clone'
// logger, DO NOT REMOVE
// var applyMiddleware = require('redux').applyMiddleware
diff --git a/app/javascript/packs/routes/edit.js b/app/javascript/packs/routes/edit.js
new file mode 100644
index 000000000..d6ceed60f
--- /dev/null
+++ b/app/javascript/packs/routes/edit.js
@@ -0,0 +1,81 @@
+import React, { PropTypes } from 'react'
+import { render } from 'react-dom'
+import { Provider } from 'react-redux'
+import { createStore } from 'redux'
+
+import reducers from '../../routes/reducers'
+import App from '../../routes/components/App'
+import formHelper from '../../routes/form_helper'
+import clone from '../../helpers/clone'
+let datas = clone(window, "itinerary_stop", true)
+datas = JSON.parse(decodeURIComponent(datas))
+
+// logger, DO NOT REMOVE
+var applyMiddleware = require('redux').applyMiddleware
+var createLogger = require('redux-logger')
+var thunkMiddleware = require('redux-thunk').default
+var promise = require('redux-promise')
+
+const getInitialState = () => {
+ let state = []
+
+ datas.map(function (v, i) {
+ let fancyText = v.name.replace("&#39;", "\'")
+ if (v.zip_code && v.city_name)
+ fancyText += ", " + v.zip_code + " " + v.city_name.replace("&#39;", "\'")
+
+ state.push({
+ stoppoint_id: v.stoppoint_id,
+ stoparea_id: v.stoparea_id,
+ user_objectid: v.user_objectid,
+ short_name: v.short_name ? v.short_name.replace("&#39;", "\'") : '',
+ area_type: v.area_type,
+ index: i,
+ edit: false,
+ city_name: v.city_name ? v.city_name.replace("&#39;", "\'") : '',
+ zip_code: v.zip_code,
+ name: v.name ? v.name.replace("&#39;", "\'") : '',
+ registration_number: v.registration_number,
+ text: fancyText,
+ for_boarding: v.for_boarding || "normal",
+ for_alighting: v.for_alighting || "normal",
+ longitude: v.longitude || 0,
+ latitude: v.latitude || 0,
+ comment: v.comment ? v.comment.replace("&#39;", "\'") : '',
+ olMap: {
+ isOpened: false,
+ json: {}
+ }
+ })
+ })
+
+ return state
+}
+
+var initialState = { stopPoints: getInitialState() }
+const loggerMiddleware = createLogger()
+let store = createStore(
+ reducers,
+ initialState,
+ applyMiddleware(thunkMiddleware, promise, loggerMiddleware)
+)
+
+render(
+ <Provider store={store}>
+ <App />
+ </Provider>,
+ document.getElementById('stop_points')
+)
+
+document.querySelector('input[name=commit]').addEventListener('click', (event) => {
+ let state = store.getState()
+
+ let name = $("#route_name").val()
+ let publicName = $("#route_published_name").val()
+ if (name == "" || publicName == "") {
+ event.preventDefault()
+ formHelper.handleForm("#route_name", "#route_published_name")
+ }
+
+ formHelper.handleStopPoints(event, state)
+})
diff --git a/app/javascript/packs/routes/show.js b/app/javascript/packs/routes/show.js
new file mode 100644
index 000000000..7f14a6f11
--- /dev/null
+++ b/app/javascript/packs/routes/show.js
@@ -0,0 +1,102 @@
+import clone from '../../helpers/clone'
+let route = clone(window, "route", true)
+route = JSON.parse(decodeURIComponent(route))
+
+const geoColPts = []
+const geoColLns = []
+const geoColEdges = [
+ new ol.Feature({
+ geometry: new ol.geom.Point(ol.proj.fromLonLat([parseFloat(route[0].longitude), parseFloat(route[0].latitude)]))
+ }),
+ new ol.Feature({
+ geometry: new ol.geom.Point(ol.proj.fromLonLat([parseFloat(route[route.length - 1].longitude), parseFloat(route[route.length - 1].latitude)]))
+ })
+]
+route.forEach(function (stop, i) {
+ if (i < route.length - 1) {
+ geoColLns.push(new ol.Feature({
+ geometry: new ol.geom.LineString([
+ ol.proj.fromLonLat([parseFloat(route[i].longitude), parseFloat(route[i].latitude)]),
+ ol.proj.fromLonLat([parseFloat(route[i + 1].longitude), parseFloat(route[i + 1].latitude)])
+ ])
+ }))
+ }
+ geoColPts.push(new ol.Feature({
+ geometry: new ol.geom.Point(ol.proj.fromLonLat([parseFloat(stop.longitude), parseFloat(stop.latitude)]))
+ })
+ )
+})
+var edgeStyles = new ol.style.Style({
+ image: new ol.style.Circle(({
+ radius: 5,
+ stroke: new ol.style.Stroke({
+ color: '#007fbb',
+ width: 2
+ }),
+ fill: new ol.style.Fill({
+ color: '#007fbb',
+ width: 2
+ })
+ }))
+})
+var defaultStyles = new ol.style.Style({
+ image: new ol.style.Circle(({
+ radius: 4,
+ stroke: new ol.style.Stroke({
+ color: '#007fbb',
+ width: 2
+ }),
+ fill: new ol.style.Fill({
+ color: '#ffffff',
+ width: 2
+ })
+ }))
+})
+var lineStyle = new ol.style.Style({
+ stroke: new ol.style.Stroke({
+ color: '#007fbb',
+ width: 3
+ })
+})
+
+var vectorPtsLayer = new ol.layer.Vector({
+ source: new ol.source.Vector({
+ features: geoColPts
+ }),
+ style: defaultStyles,
+ zIndex: 2
+})
+var vectorEdgesLayer = new ol.layer.Vector({
+ source: new ol.source.Vector({
+ features: geoColEdges
+ }),
+ style: edgeStyles,
+ zIndex: 3
+})
+var vectorLnsLayer = new ol.layer.Vector({
+ source: new ol.source.Vector({
+ features: geoColLns
+ }),
+ style: [lineStyle],
+ zIndex: 1
+})
+
+var map = new ol.Map({
+ target: 'route_map',
+ layers: [
+ new ol.layer.Tile({
+ source: new ol.source.OSM()
+ }),
+ vectorPtsLayer,
+ vectorEdgesLayer,
+ vectorLnsLayer
+ ],
+ controls: [new ol.control.ScaleLine(), new ol.control.Zoom(), new ol.control.ZoomSlider()],
+ interactions: ol.interaction.defaults({
+ zoom: true
+ }),
+ view: new ol.View({
+ center: ol.proj.fromLonLat([parseFloat(route[0].longitude), parseFloat(route[0].latitude)]),
+ zoom: 13
+ })
+});
diff --git a/app/assets/javascripts/es6_browserified/time_tables/index.js b/app/javascript/packs/time_tables/edit.js
index a91747991..cf058d501 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/index.js
+++ b/app/javascript/packs/time_tables/edit.js
@@ -1,9 +1,12 @@
-var React = require('react')
-var render = require('react-dom').render
-var Provider = require('react-redux').Provider
-var createStore = require('redux').createStore
-var timeTablesApp = require('./reducers')
-var App = require('./containers/App')
+import React from 'react'
+import { render } from 'react-dom'
+import { Provider } from 'react-redux'
+import { createStore } from 'redux'
+import timeTablesApp from '../../time_tables/reducers'
+import App from '../../time_tables/containers/App'
+import clone from '../../helpers/clone'
+
+const actionType = clone(window, "actionType", true)
// logger, DO NOT REMOVE
// var applyMiddleware = require('redux').applyMiddleware
@@ -11,9 +14,9 @@ var App = require('./containers/App')
// var thunkMiddleware = require('redux-thunk').default
// var promise = require('redux-promise')
-var initialState = {
+let initialState = {
status: {
- actionType: window.actionType,
+ actionType: actionType,
policy: window.perms,
fetchSuccess: true,
isFetching: false
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/index.js b/app/javascript/packs/vehicle_journeys/index.js
index 53bbcf952..38431af1d 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/index.js
+++ b/app/javascript/packs/vehicle_journeys/index.js
@@ -1,11 +1,11 @@
-var React = require('react')
-var render = require('react-dom').render
-var Provider = require('react-redux').Provider
-var createStore = require('redux').createStore
-var vehicleJourneysApp = require('./reducers')
-var App = require('./components/App')
-var actions = require("./actions")
-var enableBatching = require('./batch').enableBatching
+import React from 'react'
+import { render } from 'react-dom'
+import { Provider } from 'react-redux'
+import { createStore } from 'redux'
+import vehicleJourneysApp from '../../vehicle_journeys/reducers'
+import App from '../../vehicle_journeys/components/App'
+import actions from "../../vehicle_journeys/actions"
+import { enableBatching } from '../../vehicle_journeys/batch'
// logger, DO NOT REMOVE
// var applyMiddleware = require('redux').applyMiddleware
@@ -99,4 +99,4 @@ render(
<App />
</Provider>,
document.getElementById('vehicle_journeys_wip')
-)
+) \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/itineraries/actions/index.js b/app/javascript/routes/actions/index.js
index 13b2d60b2..13b2d60b2 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/actions/index.js
+++ b/app/javascript/routes/actions/index.js
diff --git a/app/javascript/routes/components/App.js b/app/javascript/routes/components/App.js
new file mode 100644
index 000000000..0f5786407
--- /dev/null
+++ b/app/javascript/routes/components/App.js
@@ -0,0 +1,25 @@
+import React, { Component, PropTypes } from 'react'
+import AddStopPoint from '../containers/AddStopPoint'
+import VisibleStopPoints from'../containers/VisibleStopPoints'
+import clone from '../../helpers/clone'
+const I18n = clone(window , "I18n", true)
+
+export default class App extends Component {
+
+ getChildContext() {
+ return { I18n }
+ }
+
+ render() {
+ return (
+ <div>
+ <VisibleStopPoints />
+ <AddStopPoint />
+ </div>
+ )
+ }
+}
+
+App.childContextTypes = {
+ I18n: PropTypes.object
+}
diff --git a/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js b/app/javascript/routes/components/BSelect2.js
index 64c6d3ac7..340d9df95 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/components/BSelect2.js
+++ b/app/javascript/routes/components/BSelect2.js
@@ -1,7 +1,6 @@
-var _ = require('lodash')
-var React = require('react')
-var PropTypes = require('react').PropTypes
-var Select2 = require('react-select2')
+import _ from'lodash'
+import React, { Component, PropTypes } from 'react'
+import Select2 from 'react-select2'
// get JSON full path
@@ -9,9 +8,9 @@ var origin = window.location.origin
var path = window.location.pathname.split('/', 3).join('/')
-class BSelect3 extends React.Component{
- constructor(props) {
- super(props)
+export default class BSelect3 extends Component {
+ constructor(props, context) {
+ super(props, context)
}
onChange(e) {
this.props.onChange(this.props.index, {
@@ -73,7 +72,7 @@ class BSelect3 extends React.Component{
}
}
-class BSelect2 extends React.Component{
+class BSelect2 extends Component{
componentDidMount() {
this.refs.newSelect.el.select2('open')
}
@@ -85,7 +84,7 @@ class BSelect2 extends React.Component{
onSelect={ this.props.onSelect }
ref='newSelect'
options={{
- placeholder: 'Sélectionnez un arrêt existant...',
+ placeholder: this.context.I18n.routes.edit.select2.placeholder,
allowClear: true,
language: 'fr', /* Doesn't seem to work... :( */
theme: 'bootstrap',
@@ -121,4 +120,6 @@ class BSelect2 extends React.Component{
}
}
-module.exports = BSelect3
+BSelect2.contextTypes = {
+ I18n: PropTypes.object
+}
diff --git a/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js b/app/javascript/routes/components/OlMap.js
index b9e106c1a..2c01dfa7f 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/components/OlMap.js
+++ b/app/javascript/routes/components/OlMap.js
@@ -1,11 +1,9 @@
-var _ = require('lodash')
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-
-class OlMap extends Component{
- constructor(props){
- super(props)
+import _ from 'lodash'
+import React, { Component, PropTypes } from 'react'
+
+export default class OlMap extends Component{
+ constructor(props, context){
+ super(props, context)
}
fetchApiURL(id){
@@ -116,40 +114,40 @@ class OlMap extends Component{
<strong>{this.props.value.olMap.json.name}</strong>
</p>
<p>
- <strong>Type d'arrêt : </strong>
+ <strong>{this.context.I18n.routes.edit.stop_point_type} : </strong>
{this.props.value.olMap.json.area_type}
</p>
<p>
- <strong>Nom court : </strong>
+ <strong>{this.context.I18n.routes.edit.short_name} : </strong>
{this.props.value.olMap.json.short_name}
</p>
<p>
- <strong>ID Reflex : </strong>
+ <strong>{this.context.I18n.id_reflex} : </strong>
{this.props.value.olMap.json.user_objectid}
</p>
- <p><strong>Coordonnées : </strong></p>
+ <p><strong>{this.context.I18n.routes.edit.map.coordinates} : </strong></p>
<p style={{paddingLeft: 10, marginTop: 0}}>
- <em>Proj.: </em>WSG84<br/>
- <em>Lat.: </em>{this.props.value.olMap.json.latitude} <br/>
- <em>Lon.: </em>{this.props.value.olMap.json.longitude}
+ <em>{this.context.I18n.routes.edit.map.proj}.: </em>WSG84<br/>
+ <em>{this.context.I18n.routes.edit.map.lat}.: </em>{this.props.value.olMap.json.latitude} <br/>
+ <em>{this.context.I18n.routes.edit.map.lon}.: </em>{this.props.value.olMap.json.longitude}
</p>
<p>
- <strong>Code Postal : </strong>
+ <strong>{this.context.I18n.routes.edit.map.postal_code} : </strong>
{this.props.value.olMap.json.zip_code}
</p>
<p>
- <strong>Commune : </strong>
+ <strong>{this.context.I18n.routes.edit.map.city} : </strong>
{this.props.value.olMap.json.city_name}
</p>
<p>
- <strong>Commentaire : </strong>
+ <strong>{this.context.I18n.routes.edit.map.comment} : </strong>
{this.props.value.olMap.json.comment}
</p>
{(this.props.value.stoparea_id != this.props.value.olMap.json.stoparea_id) &&(
<div className='btn btn-outline-primary btn-sm'
onClick= {() => {this.props.onUpdateViaOlMap(this.props.index, this.props.value.olMap.json)}}
- >Sélectionner</div>
+ >{this.context.I18n.actions.select}</div>
)}
</div>
<div className='map_content'>
@@ -163,7 +161,9 @@ class OlMap extends Component{
}
}
-OlMap.propTypes = {
+OlMap.PropTypes = {
}
-module.exports = OlMap
+OlMap.contextTypes = {
+ I18n: PropTypes.object
+}
diff --git a/app/assets/javascripts/es6_browserified/itineraries/components/StopPoint.js b/app/javascript/routes/components/StopPoint.js
index 48f77b8e9..606121f99 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/components/StopPoint.js
+++ b/app/javascript/routes/components/StopPoint.js
@@ -1,9 +1,8 @@
-var React = require('react')
-var PropTypes = require('react').PropTypes
-var BSelect2 = require('./BSelect2')
-var OlMap = require('./OlMap')
+import React, { PropTypes } from 'react'
+import BSelect2 from './BSelect2'
+import OlMap from './OlMap'
-const StopPoint = (props) => {
+export default function StopPoint(props, {I18n}) {
return (
<div className='nested-fields'>
<div className='wrapper'>
@@ -17,15 +16,15 @@ const StopPoint = (props) => {
<div>
<select className='form-control' value={props.value.for_boarding} id="for_boarding" onChange={props.onSelectChange}>
- <option value="normal">Montée autorisée</option>
- <option value="forbidden">Montée interdite</option>
+ <option value="normal">{I18n.routes.edit.stop_point.boarding.normal}</option>
+ <option value="forbidden">{I18n.routes.edit.stop_point.boarding.forbidden}</option>
</select>
</div>
<div>
<select className='form-control' value={props.value.for_alighting} id="for_alighting" onChange={props.onSelectChange}>
- <option value="normal">Descente autorisée</option>
- <option value="forbidden">Descente interdite</option>
+ <option value="normal">{I18n.routes.edit.stop_point.alighting.normal}</option>
+ <option value="forbidden">{I18n.routes.edit.stop_point.alighting.forbidden}</option>
</select>
</div>
@@ -76,7 +75,7 @@ const StopPoint = (props) => {
)
}
-StopPoint.propTypes = {
+StopPoint.PropTypes = {
onToggleMap: PropTypes.func.isRequired,
onToggleEdit: PropTypes.func.isRequired,
onDeleteClick: PropTypes.func.isRequired,
@@ -90,4 +89,6 @@ StopPoint.propTypes = {
value: PropTypes.object
}
-module.exports = StopPoint
+StopPoint.contextTypes = {
+ I18n: PropTypes.object
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/itineraries/components/StopPointList.js b/app/javascript/routes/components/StopPointList.js
index 77077dbd8..68af16f57 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/components/StopPointList.js
+++ b/app/javascript/routes/components/StopPointList.js
@@ -1,30 +1,29 @@
-var React = require('react')
-var PropTypes = require('react').PropTypes
-var StopPoint = require('./StopPoint')
+import React, { PropTypes } from 'react'
+import StopPoint from './StopPoint'
-const StopPointList = ({ stopPoints, onDeleteClick, onMoveUpClick, onMoveDownClick, onChange, onSelectChange, onToggleMap, onToggleEdit, onSelectMarker, onUnselectMarker, onUpdateViaOlMap }) => {
+export default function StopPointList({ stopPoints, onDeleteClick, onMoveUpClick, onMoveDownClick, onChange, onSelectChange, onToggleMap, onToggleEdit, onSelectMarker, onUnselectMarker, onUpdateViaOlMap }, {I18n}) {
return (
<div className='subform'>
<div className='nested-head'>
<div className="wrapper">
<div style={{width: 100}}>
<div className="form-group">
- <label className="control-label">ID Reflex</label>
+ <label className="control-label">{I18n.reflex_id}</label>
</div>
</div>
<div>
<div className="form-group">
- <label className="control-label">Arrêt</label>
+ <label className="control-label">{I18n.simple_form.labels.stop_point.name}</label>
</div>
</div>
<div>
<div className="form-group">
- <label className="control-label">Montée</label>
+ <label className="control-label">{I18n.simple_form.labels.stop_point.for_boarding}</label>
</div>
</div>
<div>
<div className="form-group">
- <label className="control-label">Descente</label>
+ <label className="control-label">{I18n.simple_form.labels.stop_point.for_alighting}</label>
</div>
</div>
<div className='actions-5'></div>
@@ -55,7 +54,7 @@ const StopPointList = ({ stopPoints, onDeleteClick, onMoveUpClick, onMoveDownCli
)
}
-StopPointList.propTypes = {
+StopPointList.PropTypes = {
stopPoints: PropTypes.array.isRequired,
onDeleteClick: PropTypes.func.isRequired,
onMoveUpClick: PropTypes.func.isRequired,
@@ -65,4 +64,6 @@ StopPointList.propTypes = {
onUnselectMarker : PropTypes.func.isRequired
}
-module.exports = StopPointList
+StopPointList.contextTypes = {
+ I18n: PropTypes.object
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/itineraries/containers/AddStopPoint.js b/app/javascript/routes/containers/AddStopPoint.js
index ea5ae90db..fd9227ff3 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/containers/AddStopPoint.js
+++ b/app/javascript/routes/containers/AddStopPoint.js
@@ -1,6 +1,6 @@
-var React = require('react')
-var connect = require('react-redux').connect
-var actions = require('../actions')
+import React from 'react'
+import { connect } from 'react-redux'
+import actions from '../actions'
let AddStopPoint = ({ dispatch }) => {
return (
@@ -17,6 +17,4 @@ let AddStopPoint = ({ dispatch }) => {
</div>
)
}
-AddStopPoint = connect()(AddStopPoint)
-
-module.exports = AddStopPoint
+export default AddStopPoint = connect()(AddStopPoint)
diff --git a/app/assets/javascripts/es6_browserified/itineraries/containers/VisibleStopPoints.js b/app/javascript/routes/containers/VisibleStopPoints.js
index 8b08a1e5f..67d77af50 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/containers/VisibleStopPoints.js
+++ b/app/javascript/routes/containers/VisibleStopPoints.js
@@ -1,6 +1,6 @@
-var actions = require('../actions')
-var connect = require('react-redux').connect
-var StopPointList = require('../components/StopPointList')
+import actions from '../actions'
+import { connect } from 'react-redux'
+import StopPointList from '../components/StopPointList'
const mapStateToProps = (state) => {
return {
@@ -55,4 +55,4 @@ const VisibleStopPoints = connect(
mapDispatchToProps
)(StopPointList)
-module.exports = VisibleStopPoints
+export default VisibleStopPoints
diff --git a/app/assets/javascripts/es6_browserified/itineraries/form_helper.js b/app/javascript/routes/form_helper.js
index f682e39c0..8a3277234 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/form_helper.js
+++ b/app/javascript/routes/form_helper.js
@@ -52,4 +52,4 @@ const formHelper = {
}
}
-module.exports = formHelper \ No newline at end of file
+export default formHelper \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/itineraries/index.js b/app/javascript/routes/index.js
index bb06126f7..febae7d54 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/index.js
+++ b/app/javascript/routes/index.js
@@ -1,11 +1,13 @@
-var React = require('react')
-var render = require('react-dom').render
-var Provider = require('react-redux').Provider
-var createStore = require('redux').createStore
-var reducers = require('./reducers')
-var App = require('./components/App')
-var { handleForm, handleStopPoints } = require('./form_helper')
-let datas = JSON.parse(decodeURIComponent(window.itinerary_stop))
+import React from 'react'
+import { render } from 'react-dom'
+import { Provider } from 'react-redux'
+import { createStore } from 'redux'
+import reducers from './reducers'
+import App from './components/App'
+import { handleForm, handleStopPoints } from './form_helper'
+import clone from '../helpers/clone'
+let datas = clone(window, "itinerary_stop", true)
+datas = JSON.parse(decodeURIComponent(datas))
// logger, DO NOT REMOVE
// var applyMiddleware = require('redux').applyMiddleware
diff --git a/app/javascript/routes/reducers/index.js b/app/javascript/routes/reducers/index.js
new file mode 100644
index 000000000..eb01ea9f7
--- /dev/null
+++ b/app/javascript/routes/reducers/index.js
@@ -0,0 +1,8 @@
+import { combineReducers } from 'redux'
+import stopPoints from './stopPoints'
+
+const stopPointsApp = combineReducers({
+ stopPoints
+})
+
+export default stopPointsApp
diff --git a/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js b/app/javascript/routes/reducers/stopPoints.js
index f3a26b8d7..eeec06327 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/reducers/stopPoints.js
+++ b/app/javascript/routes/reducers/stopPoints.js
@@ -1,5 +1,5 @@
-var _ = require('lodash')
-var { addInput } = require('../form_helper')
+import _ from 'lodash'
+import formHelper from '../form_helper'
const stopPoint = (state = {}, action, length) => {
switch (action.type) {
@@ -23,8 +23,8 @@ const stopPoint = (state = {}, action, length) => {
const updateFormForDeletion = (stop) =>{
if (stop.stoppoint_id !== undefined){
let now = Date.now()
- addInput('id', stop.stoppoint_id, now)
- addInput('_destroy', 'true', now)
+ formHelper.addInput('id', stop.stoppoint_id, now)
+ formHelper.addInput('_destroy', 'true', now)
}
}
@@ -141,4 +141,4 @@ const stopPoints = (state = [], action) => {
}
}
-module.exports = stopPoints
+export default stopPoints \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/itineraries/show.js b/app/javascript/routes/show.js
index 79a11701f..e88469900 100644
--- a/app/assets/javascripts/es6_browserified/itineraries/show.js
+++ b/app/javascript/routes/show.js
@@ -1,4 +1,7 @@
+const clone = require('../helpers/clone')
+let route = clone(window, "route", true)
route = JSON.parse(decodeURIComponent(route))
+
const geoColPts = []
const geoColLns= []
const geoColEdges = [
diff --git a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js b/app/javascript/time_tables/actions/index.js
index 361e89c36..13cb96b64 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/actions/index.js
+++ b/app/javascript/time_tables/actions/index.js
@@ -1,9 +1,14 @@
-const _ = require('lodash')
-const { I18n } = window
+import range from 'lodash/range'
+import assign from 'lodash/assign'
+import reject from 'lodash/reject'
+import some from 'lodash/some'
+import every from 'lodash/every'
+import clone from '../../helpers/clone'
+const I18n = clone(window, "I18n")
const actions = {
weekDays: (index) => {
- return _.range(1, 8).map(n => I18n.time_tables.edit.metas.days[n])
+ return range(1, 8).map(n => I18n.time_tables.edit.metas.days[n])
},
strToArrayDayTypes: (str) =>{
return actions.weekDays().map(day => str.indexOf(day) !== -1)
@@ -150,7 +155,7 @@ const actions = {
type : 'CLOSE_MODAL'
}),
monthName(strDate) {
- let monthList = _.range(1,13).map(n => I18n.calendars.months[n])
+ let monthList = range(1,13).map(n => I18n.calendars.months[n])
let date = new Date(strDate)
return monthList[date.getMonth()]
},
@@ -171,12 +176,12 @@ const actions = {
return date.toLocaleDateString()
},
updateSynthesis: ({current_month, time_table_dates: dates, time_table_periods: periods}) => {
- let newPeriods = _.reject(periods, 'deleted')
+ let newPeriods = reject(periods, 'deleted')
let improvedCM = current_month.map((d, i) => {
let isInPeriod = actions.isInPeriod(newPeriods, d.date)
- let isIncluded = _.some(dates, {'date': d.date, 'in_out': true})
+ let isIncluded = some(dates, {'date': d.date, 'in_out': true})
- return _.assign({}, current_month[i], {
+ return assign({}, current_month[i], {
in_periods: isInPeriod,
include_date: isIncluded,
excluded_date: !isInPeriod ? false : current_month[i].excluded_date
@@ -270,8 +275,8 @@ const actions = {
submitTimetable: (dispatch, timetable, metas, next) => {
dispatch(actions.fetchingApi())
let strDayTypes = actions.arrayToStrDayTypes(metas.day_types)
- metas.day_types= strDayTypes
- let sentState = _.assign({}, timetable, metas)
+ metas.day_types = strDayTypes
+ let sentState = assign({}, timetable, metas)
let urlJSON = window.location.pathname.split('/', 5).join('/')
let hasError = false
fetch(urlJSON + '.json', {
@@ -301,8 +306,8 @@ const actions = {
})
},
errorModalKey: (periods, dayTypes) => {
- const withoutPeriodsWithDaysTypes = _.reject(periods, 'deleted').length == 0 && _.some(dayTypes) && "withoutPeriodsWithDaysTypes"
- const withPeriodsWithoutDayTypes = _.reject(periods, 'deleted').length > 0 && _.every(dayTypes, dt => dt == false) && "withPeriodsWithoutDayTypes"
+ const withoutPeriodsWithDaysTypes = reject(periods, 'deleted').length == 0 && some(dayTypes) && "withoutPeriodsWithDaysTypes"
+ const withPeriodsWithoutDayTypes = reject(periods, 'deleted').length > 0 && every(dayTypes, dt => dt == false) && "withPeriodsWithoutDayTypes"
return (withoutPeriodsWithDaysTypes || withPeriodsWithoutDayTypes) && (withoutPeriodsWithDaysTypes ? "withoutPeriodsWithDaysTypes" : "withPeriodsWithoutDayTypes")
@@ -317,7 +322,7 @@ const actions = {
return errorKey
}
- },
+ }
}
-module.exports = actions
+export default actions \ No newline at end of file
diff --git a/app/javascript/time_tables/components/ConfirmModal.js b/app/javascript/time_tables/components/ConfirmModal.js
new file mode 100644
index 000000000..d89170ee7
--- /dev/null
+++ b/app/javascript/time_tables/components/ConfirmModal.js
@@ -0,0 +1,50 @@
+import React, { PropTypes } from 'react'
+
+export default function ConfirmModal({dispatch, modal, onModalAccept, onModalCancel, timetable, metas}, {I18n}) {
+ return (
+ <div className={'modal fade ' + ((modal.type == 'confirm') ? 'in' : '')} id='ConfirmModal'>
+ <div className='modal-container'>
+ <div className='modal-dialog'>
+ <div className='modal-content'>
+ <div className='modal-header'>
+ <h4 className='modal-title'>{I18n.time_tables.edit.confirm_modal.title}</h4>
+ </div>
+ <div className='modal-body'>
+ <div className='mt-md mb-md'>
+ <p>{I18n.time_tables.edit.confirm_modal.message}</p>
+ </div>
+ </div>
+ <div className='modal-footer'>
+ <button
+ className='btn btn-link'
+ data-dismiss='modal'
+ type='button'
+ onClick={() => { onModalCancel(modal.confirmModal.callback) }}
+ >
+ {I18n.cancel}
+ </button>
+ <button
+ className='btn btn-primary'
+ data-dismiss='modal'
+ type='button'
+ onClick={() => { onModalAccept(modal.confirmModal.callback, timetable, metas) }}
+ >
+ {I18n.actions.submit}
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}
+
+ConfirmModal.propTypes = {
+ modal: PropTypes.object.isRequired,
+ onModalAccept: PropTypes.func.isRequired,
+ onModalCancel: PropTypes.func.isRequired
+}
+
+ConfirmModal.contextTypes = {
+ I18n: PropTypes.object
+} \ No newline at end of file
diff --git a/app/javascript/time_tables/components/ErrorModal.js b/app/javascript/time_tables/components/ErrorModal.js
new file mode 100644
index 000000000..e810f49ab
--- /dev/null
+++ b/app/javascript/time_tables/components/ErrorModal.js
@@ -0,0 +1,42 @@
+import React, { PropTypes } from 'react'
+import actions from '../actions'
+
+export default function ErrorModal({dispatch, modal, onModalClose}, {I18n}) {
+ return (
+ <div className={'modal fade ' + ((modal.type == 'error') ? 'in' : '')} id='ErrorModal'>
+ <div className='modal-container'>
+ <div className='modal-dialog'>
+ <div className='modal-content'>
+ <div className='modal-header'>
+ <h4 className='modal-title'>{I18n.time_tables.edit.error_modal.title}</h4>
+ </div>
+ <div className='modal-body'>
+ <div className='mt-md mb-md'>
+ <p>{actions.errorModalMessage(modal.modalProps.error)}</p>
+ </div>
+ </div>
+ <div className='modal-footer'>
+ <button
+ className='btn btn-link'
+ data-dismiss='modal'
+ type='button'
+ onClick={() => { onModalClose() }}
+ >
+ {I18n.back}
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}
+
+ErrorModal.propTypes = {
+ modal: PropTypes.object.isRequired,
+ onModalClose: PropTypes.func.isRequired
+}
+
+ErrorModal.contextTypes = {
+ I18n: PropTypes.object
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js b/app/javascript/time_tables/components/ExceptionsInDay.js
index 80c2e4b7a..3335ee89d 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/components/ExceptionsInDay.js
+++ b/app/javascript/time_tables/components/ExceptionsInDay.js
@@ -1,9 +1,7 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../actions')
+import React, { PropTypes, Component } from 'react'
+import actions from '../actions'
-class ExceptionsInDay extends Component {
+export default class ExceptionsInDay extends Component {
constructor(props) {
super(props)
}
@@ -71,5 +69,3 @@ ExceptionsInDay.propTypes = {
onIncludeDateInPeriod: PropTypes.func.isRequired,
index: PropTypes.number.isRequired
}
-
-module.exports = ExceptionsInDay
diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/Metas.js b/app/javascript/time_tables/components/Metas.js
index 26a96e4a6..7098d2b82 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/components/Metas.js
+++ b/app/javascript/time_tables/components/Metas.js
@@ -1,9 +1,8 @@
-var React = require('react')
-var { PropTypes } = require('react')
-const { weekDays } = require('../actions')
-var TagsSelect2 = require('./TagsSelect2')
+import React, { PropTypes } from 'react'
+import actions from '../actions'
+import TagsSelect2 from './TagsSelect2'
-const Metas = ({metas, onUpdateDayTypes, onUpdateComment, onUpdateColor, onSelect2Tags, onUnselect2Tags}, {I18n}) => {
+export default function Metas({metas, onUpdateDayTypes, onUpdateComment, onUpdateColor, onSelect2Tags, onUnselect2Tags}, {I18n}) {
let colorList = ["", "#9B9B9B", "#FFA070", "#C67300", "#7F551B", "#41CCE3", "#09B09C", "#3655D7", "#6321A0", "#E796C6", "#DD2DAA"]
return (
<div className='form-horizontal'>
@@ -112,7 +111,7 @@ const Metas = ({metas, onUpdateDayTypes, onUpdateComment, onUpdateColor, onSelec
type="checkbox"
checked={day ? 'checked' : ''}
/>
- <span className='lcbx-group-item-label'>{weekDays()[i]}</span>
+ <span className='lcbx-group-item-label'>{actions.weekDays()[i]}</span>
</label>
</div>
</div>
@@ -138,5 +137,3 @@ Metas.propTypes = {
Metas.contextTypes = {
I18n: PropTypes.object
}
-
-module.exports = Metas
diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/Navigate.js b/app/javascript/time_tables/components/Navigate.js
index 6a3690cb0..7307d819b 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/components/Navigate.js
+++ b/app/javascript/time_tables/components/Navigate.js
@@ -1,10 +1,8 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../actions')
-var _ = require('lodash')
+import React, { PropTypes, Component } from 'react'
+import map from 'lodash/map'
+import actions from '../actions'
-let Navigate = ({ dispatch, metas, timetable, pagination, status, filters}) => {
+export default function Navigate({ dispatch, metas, timetable, pagination, status, filters}) {
if(status.isFetching == true) {
return false
}
@@ -32,7 +30,7 @@ let Navigate = ({ dispatch, metas, timetable, pagination, status, filters}) => {
className='dropdown-menu'
aria-labelledby='date_selector'
>
- {_.map(pagination.periode_range, (month, i) => (
+ {map(pagination.periode_range, (month, i) => (
<li key={i}>
<button
type='button'
@@ -87,6 +85,4 @@ Navigate.propTypes = {
status: PropTypes.object.isRequired,
pagination: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired
-}
-
-module.exports = Navigate
+} \ No newline at end of file
diff --git a/app/javascript/time_tables/components/PeriodForm.js b/app/javascript/time_tables/components/PeriodForm.js
new file mode 100644
index 000000000..d9f1d3437
--- /dev/null
+++ b/app/javascript/time_tables/components/PeriodForm.js
@@ -0,0 +1,148 @@
+import React, { PropTypes } from 'react'
+import filter from 'lodash/filter'
+let monthsArray = ['Janvier', 'Février', 'Mars', 'Avril', 'Mai', 'Juin', 'Juillet', 'Août', 'Septembre', 'Octobre', 'Novembre', 'Décembre']
+
+const formatNumber = (val) => {
+ return ("0" + val).slice(-2)
+}
+
+const makeDaysOptions = (daySelected) => {
+ let arr = []
+ for(let i = 1; i < 32; i++) {
+ arr.push(<option value={formatNumber(i)} key={i}>{formatNumber(i)}</option>)
+ }
+ return arr
+}
+
+const makeMonthsOptions = (monthSelected) => {
+ let arr = []
+ for(let i = 1; i < 13; i++) {
+ arr.push(<option value={formatNumber(i)} key={i}>{monthsArray[i - 1]}</option>)
+ }
+ return arr
+}
+
+const makeYearsOptions = (yearSelected) => {
+ let arr = []
+ let startYear = new Date().getFullYear() - 3
+ for(let i = startYear; i <= startYear + 6; i++) {
+ arr.push(<option key={i}>{i}</option>)
+ }
+ return arr
+}
+
+export default function PeriodForm({modal, timetable, metas, onOpenAddPeriodForm, onClosePeriodForm, onUpdatePeriodForm, onValidatePeriodForm}, {I18n}) {
+ return (
+ <div className="container-fluid">
+ <div className="row">
+ <div className="col lg-6 col-lg-offset-3">
+ <div className='subform'>
+ {modal.modalProps.active &&
+ <div>
+ <div className="nested-head">
+ <div className="wrapper">
+ <div>
+ <div className="form-group">
+ <label htmlFor="" className="control-label required">
+ {I18n.time_tables.edit.period_form.begin}
+ <abbr title="requis">*</abbr>
+ </label>
+ </div>
+ </div>
+ <div>
+ <div className="form-group">
+ <label htmlFor="" className="control-label required">
+ {I18n.time_tables.edit.period_form.end}
+ <abbr title="requis">*</abbr>
+ </label>
+ </div>
+ </div>
+ </div>
+ </div>
+ <div className="nested-fields">
+ <div className="wrapper">
+ <div>
+ <div className={'form-group date ' + (modal.modalProps.error ? ' has-error' : '')}>
+ <div className="form-inline">
+ <select value={formatNumber(modal.modalProps.begin.day)} onChange={(e) => onUpdatePeriodForm(e, 'begin', 'day', modal.modalProps)} id="q_validity_period_begin_gteq_3i" className="date required form-control">
+ {makeDaysOptions(modal.modalProps.begin.day)}
+ </select>
+ <select value={formatNumber(modal.modalProps.begin.month)} onChange={(e) => onUpdatePeriodForm(e, 'begin', 'month', modal.modalProps)} id="q_validity_period_begin_gteq_2i" className="date required form-control">
+ {makeMonthsOptions(modal.modalProps.begin.month)}
+ </select>
+ <select value={modal.modalProps.begin.year} onChange={(e) => onUpdatePeriodForm(e, 'begin', 'year', modal.modalProps)} id="q_validity_period_begin_gteq_1i" className="date required form-control">
+ {makeYearsOptions(modal.modalProps.begin.year)}
+ </select>
+ </div>
+ </div>
+ </div>
+ <div>
+ <div className={'form-group date ' + (modal.modalProps.error ? ' has-error' : '')}>
+ <div className="form-inline">
+ <select value={formatNumber(modal.modalProps.end.day)} onChange={(e) => onUpdatePeriodForm(e, 'end', 'day', modal.modalProps)} id="q_validity_period_end_gteq_3i" className="date required form-control">
+ {makeDaysOptions(modal.modalProps.end.day)}
+ </select>
+ <select value={formatNumber(modal.modalProps.end.month)} onChange={(e) => onUpdatePeriodForm(e, 'end', 'month', modal.modalProps)} id="q_validity_period_end_gteq_2i" className="date required form-control">
+ {makeMonthsOptions(modal.modalProps.end.month)}
+ </select>
+ <select value={modal.modalProps.end.year} onChange={(e) => onUpdatePeriodForm(e, 'end', 'year', modal.modalProps)} id="q_validity_period_end_gteq_1i" className="date required form-control">
+ {makeYearsOptions(modal.modalProps.end.year)}
+ </select>
+ </div>
+ </div>
+ </div>
+ </div>
+ </div>
+
+ <div className='links nested-linker'>
+ <span className='help-block small text-danger pull-left mt-xs ml-sm'>
+ {modal.modalProps.error}
+ </span>
+ <button
+ type='button'
+ className='btn btn-link'
+ onClick={onClosePeriodForm}
+ >
+ {I18n.cancel}
+ </button>
+ <button
+ type='button'
+ className='btn btn-outline-primary mr-sm'
+ onClick={() => onValidatePeriodForm(modal.modalProps, timetable.time_table_periods, metas, filter(timetable.time_table_dates, ['in_out', true]))}
+ >
+ {I18n.actions.submit}
+ </button>
+ </div>
+ </div>
+ }
+ {!modal.modalProps.active &&
+ <div className="text-right">
+ <button
+ type='button'
+ className='btn btn-outline-primary'
+ onClick={onOpenAddPeriodForm}
+ >
+ {I18n.time_tables.actions.add_period}
+ </button>
+ </div>
+ }
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}
+
+PeriodForm.propTypes = {
+ modal: PropTypes.object.isRequired,
+ metas: PropTypes.object.isRequired,
+ onOpenAddPeriodForm: PropTypes.func.isRequired,
+ onClosePeriodForm: PropTypes.func.isRequired,
+ onUpdatePeriodForm: PropTypes.func.isRequired,
+ onValidatePeriodForm: PropTypes.func.isRequired,
+ timetable: PropTypes.object.isRequired
+}
+
+PeriodForm.contextTypes = {
+ I18n: PropTypes.object
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js b/app/javascript/time_tables/components/PeriodManager.js
index 704e21331..9922ce2c4 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodManager.js
+++ b/app/javascript/time_tables/components/PeriodManager.js
@@ -1,8 +1,7 @@
-var React = require('react')
-var { Component, PropTypes } = require('react')
-var actions = require('../actions')
+import React, { PropTypes, Component } from 'react'
+import actions from '../actions'
-class PeriodManager extends Component {
+export default class PeriodManager extends Component {
constructor(props, context) {
super(props, context)
}
@@ -83,6 +82,4 @@ PeriodManager.propTypes = {
PeriodManager.contextTypes = {
I18n: PropTypes.object
-}
-
-module.exports = PeriodManager
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodsInDay.js b/app/javascript/time_tables/components/PeriodsInDay.js
index f56509b99..888537579 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/components/PeriodsInDay.js
+++ b/app/javascript/time_tables/components/PeriodsInDay.js
@@ -1,9 +1,7 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var PeriodManager = require('./PeriodManager')
+import React, { PropTypes, Component } from 'react'
+import PeriodManager from './PeriodManager'
-class PeriodsInDay extends Component {
+export default class PeriodsInDay extends Component {
constructor(props) {
super(props)
}
@@ -75,5 +73,3 @@ PeriodsInDay.propTypes = {
index: PropTypes.number.isRequired,
onDeletePeriod: PropTypes.func.isRequired
}
-
-module.exports = PeriodsInDay
diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/SaveTimetable.js b/app/javascript/time_tables/components/SaveTimetable.js
index 779fd8e25..d5a57bd1c 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/components/SaveTimetable.js
+++ b/app/javascript/time_tables/components/SaveTimetable.js
@@ -1,10 +1,7 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../actions')
-var _ = require('lodash')
+import React, { PropTypes, Component } from 'react'
+import actions from '../actions'
-class SaveTimetable extends Component{
+export default class SaveTimetable extends Component{
constructor(props){
super(props)
}
@@ -41,6 +38,4 @@ SaveTimetable.propTypes = {
timetable: PropTypes.object.isRequired,
status: PropTypes.object.isRequired,
metas: PropTypes.object.isRequired
-}
-
-module.exports = SaveTimetable
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/TagsSelect2.js b/app/javascript/time_tables/components/TagsSelect2.js
index 46188cdd1..70a748a04 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/components/TagsSelect2.js
+++ b/app/javascript/time_tables/components/TagsSelect2.js
@@ -1,21 +1,22 @@
-var _ = require('lodash')
-var React = require('react')
-var PropTypes = require('react').PropTypes
-var Select2 = require('react-select2')
+import React, { PropTypes, Component } from 'react'
+import mapKeys from 'lodash/mapKeys'
+import map from 'lodash/map'
+import filter from 'lodash/filter'
+import assign from 'lodash/assign'
+import Select2 from 'react-select2'
// get JSON full path
-var origin = window.location.origin
-var path = window.location.pathname.split('/', 4).join('/')
-var _ = require('lodash')
+let origin = window.location.origin
+let path = window.location.pathname.split('/', 4).join('/')
-class TagsSelect2 extends React.Component{
+export default class TagsSelect2 extends Component {
constructor(props, context) {
super(props, context)
}
mapKeys(array){
return array.map((item) =>
- _.mapKeys(item, (v, k) =>
+ mapKeys(item, (v, k) =>
((k == 'name') ? 'text' : k)
)
)
@@ -24,7 +25,7 @@ class TagsSelect2 extends React.Component{
render() {
return (
<Select2
- value={(this.props.tags.length) ? _.map(this.props.tags, 'id') : undefined}
+ value={(this.props.tags.length) ? map(this.props.tags, 'id') : undefined}
data={(this.props.initialTags.length) ? this.mapKeys(this.props.initialTags) : undefined}
onSelect={(e) => this.props.onSelect2Tags(e)}
onUnselect={(e) => setTimeout( () => this.props.onUnselect2Tags(e, 150))}
@@ -49,10 +50,10 @@ class TagsSelect2 extends React.Component{
};
},
processResults: function(data, params) {
- let items = _.filter(data, ({name}) => name.includes(params.term) )
+ let items = filter(data, ({name}) => name.includes(params.term) )
return {
results: items.map(
- item => _.assign(
+ item => assign(
{},
item,
{text: item.name}
@@ -76,6 +77,4 @@ const formatRepo = (props) => {
TagsSelect2.contextTypes = {
I18n: PropTypes.object
-}
-
-module.exports = TagsSelect2
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/TimeTableDay.js b/app/javascript/time_tables/components/TimeTableDay.js
index 93a0a90fe..165c7b848 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/components/TimeTableDay.js
+++ b/app/javascript/time_tables/components/TimeTableDay.js
@@ -1,7 +1,6 @@
-var React = require('react')
-var { Component, PropTypes } = require('react')
+import React, { PropTypes, Component } from 'react'
-class TimeTableDay extends Component {
+export default class TimeTableDay extends Component {
constructor(props) {
super(props)
}
@@ -30,5 +29,3 @@ TimeTableDay.propTypes = {
index: PropTypes.number.isRequired,
dayTypeActive: PropTypes.bool.isRequired
}
-
-module.exports = TimeTableDay
diff --git a/app/assets/javascripts/es6_browserified/time_tables/components/Timetable.js b/app/javascript/time_tables/components/Timetable.js
index 22e971c6b..df6e6016b 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/components/Timetable.js
+++ b/app/javascript/time_tables/components/Timetable.js
@@ -1,11 +1,11 @@
-var React = require('react')
-var { Component, PropTypes} = require('react')
-var TimeTableDay = require('./TimeTableDay')
-var PeriodsInDay = require('./PeriodsInDay')
-var ExceptionsInDay = require('./ExceptionsInDay')
-var actions = require('../actions')
+import React, { PropTypes, Component } from 'react'
+import actions from '../actions'
+import TimeTableDay from './TimeTableDay'
+import PeriodsInDay from './PeriodsInDay'
+import ExceptionsInDay from './ExceptionsInDay'
-class Timetable extends Component{
+
+export default class Timetable extends Component {
constructor(props, context){
super(props, context)
}
@@ -113,5 +113,3 @@ Timetable.propTypes = {
Timetable.contextTypes = {
I18n: PropTypes.object
}
-
-module.exports = Timetable
diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/App.js b/app/javascript/time_tables/containers/App.js
index 772747104..235dccb50 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/containers/App.js
+++ b/app/javascript/time_tables/containers/App.js
@@ -1,15 +1,15 @@
-var React = require('react')
-var connect = require('react-redux').connect
-var { Component, PropTypes} = require('react')
-var actions = require('../actions')
-var Metas = require('./Metas')
-var Timetable = require('./Timetable')
-var Navigate = require('./Navigate')
-var PeriodForm = require('./PeriodForm')
-var SaveTimetable = require('./SaveTimetable')
-var ConfirmModal = require('./ConfirmModal')
-var ErrorModal = require('./ErrorModal')
-const { I18n } = window
+import React, { PropTypes, Component } from 'react'
+import { connect } from'react-redux'
+import actions from '../actions'
+import Metas from './Metas'
+import Timetable from './Timetable'
+import Navigate from './Navigate'
+import PeriodForm from './PeriodForm'
+import SaveTimetable from './SaveTimetable'
+import ConfirmModal from './ConfirmModal'
+import ErrorModal from './ErrorModal'
+import clone from '../../helpers/clone'
+const I18n = clone(window, "I18n", true)
class App extends Component {
componentDidMount(){
@@ -52,4 +52,4 @@ App.childContextTypes = {
const timeTableApp = connect(null, mapDispatchToProps)(App)
-module.exports = timeTableApp
+export default timeTableApp
diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/ConfirmModal.js b/app/javascript/time_tables/containers/ConfirmModal.js
index 6282c1d1d..f3742b038 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/containers/ConfirmModal.js
+++ b/app/javascript/time_tables/containers/ConfirmModal.js
@@ -1,6 +1,6 @@
-var actions = require('../actions')
-var connect = require('react-redux').connect
-var ConfirmModal = require('../components/ConfirmModal')
+import { connect } from 'react-redux'
+import actions from '../actions'
+import ConfirmModal from '../components/ConfirmModal'
const mapStateToProps = (state) => {
return {
@@ -28,4 +28,4 @@ const mapDispatchToProps = (dispatch) => {
const ConfirmModalContainer = connect(mapStateToProps, mapDispatchToProps)(ConfirmModal)
-module.exports = ConfirmModalContainer
+export default ConfirmModalContainer
diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/ErrorModal.js b/app/javascript/time_tables/containers/ErrorModal.js
index e0b2c1240..37099073b 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/containers/ErrorModal.js
+++ b/app/javascript/time_tables/containers/ErrorModal.js
@@ -1,6 +1,6 @@
-var actions = require('../actions')
-var connect = require('react-redux').connect
-var ErrorModal = require('../components/ErrorModal')
+import { connect } from 'react-redux'
+import actions from '../actions'
+import ErrorModal from '../components/ErrorModal'
const mapStateToProps = (state) => {
return {
@@ -19,4 +19,4 @@ const mapDispatchToProps = (dispatch) => {
const ErrorModalContainer = connect(mapStateToProps, mapDispatchToProps)(ErrorModal)
-module.exports = ErrorModalContainer
+export default ErrorModalContainer
diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/Metas.js b/app/javascript/time_tables/containers/Metas.js
index c4ab2d5b3..ebccf556e 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/containers/Metas.js
+++ b/app/javascript/time_tables/containers/Metas.js
@@ -1,6 +1,6 @@
-var actions = require('../actions')
-var connect = require('react-redux').connect
-var MetasComponent = require('../components/Metas')
+import { connect } from 'react-redux'
+import actions from '../actions'
+import MetasComponent from '../components/Metas'
const mapStateToProps = (state) => {
return {
@@ -35,4 +35,4 @@ const mapDispatchToProps = (dispatch) => {
const Metas = connect(mapStateToProps, mapDispatchToProps)(MetasComponent)
-module.exports = Metas
+export default Metas
diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/Navigate.js b/app/javascript/time_tables/containers/Navigate.js
index c70583c25..8d163659c 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/containers/Navigate.js
+++ b/app/javascript/time_tables/containers/Navigate.js
@@ -1,7 +1,7 @@
-var React = require('react')
-var connect = require('react-redux').connect
-var actions = require('../actions')
-var NavigateComponent = require('../components/Navigate')
+import React from 'react'
+import { connect } from 'react-redux'
+import actions from '../actions'
+import NavigateComponent from '../components/Navigate'
const mapStateToProps = (state) => {
return {
@@ -15,4 +15,4 @@ const mapStateToProps = (state) => {
const Navigate = connect(mapStateToProps)(NavigateComponent)
-module.exports = Navigate
+export default Navigate
diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/PeriodForm.js b/app/javascript/time_tables/containers/PeriodForm.js
index 951a09741..1bde039e2 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/containers/PeriodForm.js
+++ b/app/javascript/time_tables/containers/PeriodForm.js
@@ -1,7 +1,9 @@
-var connect = require('react-redux').connect
-var PeriodFormComponent = require('../components/PeriodForm')
-var actions = require('../actions')
-var _ = require('lodash')
+import { connect } from 'react-redux'
+import assign from 'lodash/assign'
+import actions from '../actions'
+import PeriodFormComponent from '../components/PeriodForm'
+
+
const mapStateToProps = (state) => {
return {
@@ -21,7 +23,7 @@ const mapDispatchToProps = (dispatch) => {
},
onUpdatePeriodForm: (e, group, selectType, modalProps) => {
dispatch(actions.updatePeriodForm(e.currentTarget.value, group, selectType))
- let mProps = _.assign({}, modalProps)
+ let mProps = assign({}, modalProps)
mProps[group][selectType] = e.currentTarget.value
let val = window.correctDay([parseInt(mProps[group]['day']), parseInt(mProps[group]['month']), parseInt(mProps[group]['year'])])
val = (val < 10) ? '0' + String(val) : String(val)
@@ -41,4 +43,4 @@ const mapDispatchToProps = (dispatch) => {
const PeriodForm = connect(mapStateToProps, mapDispatchToProps)(PeriodFormComponent)
-module.exports = PeriodForm
+export default PeriodForm
diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/SaveTimetable.js b/app/javascript/time_tables/containers/SaveTimetable.js
index 6287da15b..7574dc5cc 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/containers/SaveTimetable.js
+++ b/app/javascript/time_tables/containers/SaveTimetable.js
@@ -1,7 +1,6 @@
-var React = require('react')
-var connect = require('react-redux').connect
-var actions = require('../actions')
-var SaveTimetableComponent = require('../components/SaveTimetable')
+import { connect } from 'react-redux'
+import actions from '../actions'
+import SaveTimetableComponent from '../components/SaveTimetable'
const mapStateToProps = (state) => {
return {
@@ -23,4 +22,4 @@ const mapDispatchToProps = (dispatch) => {
}
const SaveTimetable = connect(mapStateToProps, mapDispatchToProps)(SaveTimetableComponent)
-module.exports = SaveTimetable
+export default SaveTimetable
diff --git a/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js b/app/javascript/time_tables/containers/Timetable.js
index a37e99982..e78e8840a 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/containers/Timetable.js
+++ b/app/javascript/time_tables/containers/Timetable.js
@@ -1,6 +1,6 @@
-var connect = require('react-redux').connect
-var TimetableComponent = require('../components/Timetable')
-var actions = require('../actions')
+import { connect } from 'react-redux'
+import actions from '../actions'
+import TimetableComponent from '../components/Timetable'
const mapStateToProps = (state) => {
return {
@@ -41,4 +41,4 @@ const mapDispatchToProps = (dispatch) => {
const Timetable = connect(mapStateToProps, mapDispatchToProps)(TimetableComponent)
-module.exports = Timetable
+export default Timetable
diff --git a/app/javascript/time_tables/reducers/index.js b/app/javascript/time_tables/reducers/index.js
new file mode 100644
index 000000000..aed9035b5
--- /dev/null
+++ b/app/javascript/time_tables/reducers/index.js
@@ -0,0 +1,16 @@
+import { combineReducers } from 'redux'
+import status from './status'
+import pagination from './pagination'
+import modal from './modal'
+import timetable from './timetable'
+import metas from './metas'
+
+const timeTablesApp = combineReducers({
+ timetable,
+ metas,
+ status,
+ pagination,
+ modal
+})
+
+export default timeTablesApp
diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/metas.js b/app/javascript/time_tables/reducers/metas.js
index ab5ed3d91..51e1ec149 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/reducers/metas.js
+++ b/app/javascript/time_tables/reducers/metas.js
@@ -1,10 +1,11 @@
-const _ = require('lodash')
-const actions = require('../actions')
+import assign from 'lodash/assign'
+import filter from 'lodash/filter'
+import actions from '../actions'
-const metas = (state = {}, action) => {
+export default function metas(state = {}, action) {
switch (action.type) {
case 'RECEIVE_TIME_TABLES':
- return _.assign({}, state, {
+ return assign({}, state, {
comment: action.json.comment,
day_types: actions.strToArrayDayTypes(action.json.day_types),
tags: action.json.tags,
@@ -14,29 +15,27 @@ const metas = (state = {}, action) => {
})
case 'RECEIVE_MONTH':
let dt = (typeof state.day_types === 'string') ? actions.strToArrayDayTypes(state.day_types) : state.day_types
- return _.assign({}, state, {day_types: dt})
+ return assign({}, state, {day_types: dt})
case 'ADD_INCLUDED_DATE':
case 'REMOVE_INCLUDED_DATE':
case 'ADD_EXCLUDED_DATE':
case 'REMOVE_EXCLUDED_DATE':
case 'DELETE_PERIOD':
case 'VALIDATE_PERIOD_FORM':
- return _.assign({}, state, {calendar: null})
+ return assign({}, state, {calendar: null})
case 'UPDATE_DAY_TYPES':
- return _.assign({}, state, {day_types: action.dayTypes, calendar : null})
+ return assign({}, state, {day_types: action.dayTypes, calendar : null})
case 'UPDATE_COMMENT':
- return _.assign({}, state, {comment: action.comment})
+ return assign({}, state, {comment: action.comment})
case 'UPDATE_COLOR':
- return _.assign({}, state, {color: action.color})
+ return assign({}, state, {color: action.color})
case 'UPDATE_SELECT_TAG':
let tags = [...state.tags]
tags.push(action.selectedItem)
- return _.assign({}, state, {tags: tags})
+ return assign({}, state, {tags: tags})
case 'UPDATE_UNSELECT_TAG':
- return _.assign({}, state, {tags: _.filter(state.tags, (t) => (t.id != action.selectedItem.id))})
+ return assign({}, state, {tags: filter(state.tags, (t) => (t.id != action.selectedItem.id))})
default:
return state
}
-}
-
-module.exports = metas
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js b/app/javascript/time_tables/reducers/modal.js
index c61296f1c..5e870a6ef 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/reducers/modal.js
+++ b/app/javascript/time_tables/reducers/modal.js
@@ -1,5 +1,5 @@
-var _ = require('lodash')
-var actions = require('../actions')
+import assign from 'lodash/assign'
+import actions from '../actions'
let newModalProps = {}
let emptyDate = {
@@ -9,11 +9,11 @@ let emptyDate = {
}
let period_start = '', period_end = ''
-const modal = (state = {}, action) => {
+export default function modal(state = {}, action) {
switch (action.type) {
case 'OPEN_CONFIRM_MODAL':
$('#ConfirmModal').modal('show')
- return _.assign({}, state, {
+ return assign({}, state, {
type: 'confirm',
confirmModal: {
callback: action.callback,
@@ -21,14 +21,14 @@ const modal = (state = {}, action) => {
})
case 'OPEN_ERROR_MODAL':
$('#ErrorModal').modal('show')
- newModalProps = _.assign({}, state.modalProps, {error: action.error})
- return _.assign({}, state, {type: 'error'}, {modalProps: newModalProps})
+ newModalProps = assign({}, state.modalProps, {error: action.error})
+ return assign({}, state, {type: 'error'}, {modalProps: newModalProps})
case 'RESET_MODAL_ERRORS':
- newModalProps = _.assign({}, state.modalProps, {error: ''})
- return _.assign({}, state, {type: ''}, {modalProps: newModalProps})
+ newModalProps = assign({}, state.modalProps, {error: ''})
+ return assign({}, state, {type: ''}, {modalProps: newModalProps})
case 'CLOSE_PERIOD_FORM':
- newModalProps = _.assign({}, state.modalProps, {active: false, error: ""})
- return _.assign({}, state, {modalProps: newModalProps})
+ newModalProps = assign({}, state.modalProps, {active: false, error: ""})
+ return assign({}, state, {modalProps: newModalProps})
case 'OPEN_EDIT_PERIOD_FORM':
period_start = action.period.period_start.split('-')
period_end = action.period.period_end.split('-')
@@ -45,22 +45,20 @@ const modal = (state = {}, action) => {
newModalProps.active = true
newModalProps.index = action.index
newModalProps.error = ''
- return _.assign({}, state, {modalProps: newModalProps})
+ return assign({}, state, {modalProps: newModalProps})
case 'OPEN_ADD_PERIOD_FORM':
- newModalProps = _.assign({}, state.modalProps, {active: true, begin: emptyDate, end: emptyDate, index: false, error: ''})
- return _.assign({}, state, {modalProps: newModalProps})
+ newModalProps = assign({}, state.modalProps, {active: true, begin: emptyDate, end: emptyDate, index: false, error: ''})
+ return assign({}, state, {modalProps: newModalProps})
case 'UPDATE_PERIOD_FORM':
newModalProps = JSON.parse(JSON.stringify(state.modalProps))
newModalProps[action.group][action.selectType] = action.val
- return _.assign({}, state, {modalProps: newModalProps})
+ return assign({}, state, {modalProps: newModalProps})
case 'VALIDATE_PERIOD_FORM':
newModalProps = JSON.parse(JSON.stringify(state.modalProps))
newModalProps.error = action.error
newModalProps.active = (newModalProps.error == '') ? false : true
- return _.assign({}, state, {modalProps: newModalProps})
+ return assign({}, state, {modalProps: newModalProps})
default:
return state
}
-}
-
-module.exports = modal
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/pagination.js b/app/javascript/time_tables/reducers/pagination.js
index f38b124d9..53a753356 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/reducers/pagination.js
+++ b/app/javascript/time_tables/reducers/pagination.js
@@ -1,25 +1,25 @@
-var _ = require('lodash')
+import assign from 'lodash/assign'
-const pagination = (state = {}, action) => {
+export default function pagination(state = {}, action) {
switch (action.type) {
case 'RECEIVE_TIME_TABLES':
- return _.assign({}, state, {
+ return assign({}, state, {
currentPage: action.json.current_periode_range,
periode_range: action.json.periode_range,
stateChanged: false
})
case 'RECEIVE_MONTH':
case 'RECEIVE_ERRORS':
- return _.assign({}, state, {stateChanged: false})
+ return assign({}, state, {stateChanged: false})
case 'GO_TO_PREVIOUS_PAGE':
case 'GO_TO_NEXT_PAGE':
let nextPage = action.nextPage ? 1 : -1
let newPage = action.pagination.periode_range[action.pagination.periode_range.indexOf(action.pagination.currentPage) + nextPage]
toggleOnConfirmModal()
- return _.assign({}, state, {currentPage : newPage, stateChanged: false})
+ return assign({}, state, {currentPage : newPage, stateChanged: false})
case 'CHANGE_PAGE':
toggleOnConfirmModal()
- return _.assign({}, state, {currentPage : action.page, stateChanged: false})
+ return assign({}, state, {currentPage : action.page, stateChanged: false})
case 'ADD_INCLUDED_DATE':
case 'REMOVE_INCLUDED_DATE':
case 'ADD_EXCLUDED_DATE':
@@ -31,7 +31,7 @@ const pagination = (state = {}, action) => {
case 'UPDATE_DAY_TYPES':
case 'UPDATE_CURRENT_MONTH_FROM_DAYTYPES':
toggleOnConfirmModal('modal')
- return _.assign({}, state, {stateChanged: true})
+ return assign({}, state, {stateChanged: true})
default:
return state
}
@@ -41,6 +41,4 @@ const toggleOnConfirmModal = (arg = '') =>{
$('.confirm').each(function(){
$(this).data('toggle','')
})
-}
-
-module.exports = pagination
+} \ No newline at end of file
diff --git a/app/javascript/time_tables/reducers/status.js b/app/javascript/time_tables/reducers/status.js
new file mode 100644
index 000000000..256059191
--- /dev/null
+++ b/app/javascript/time_tables/reducers/status.js
@@ -0,0 +1,15 @@
+import assign from 'lodash/assign'
+
+export default function status(state = {}, action) {
+ switch (action.type) {
+ case 'UNAVAILABLE_SERVER':
+ return assign({}, state, {fetchSuccess: false})
+ case 'FETCH_API':
+ return assign({}, state, {isFetching: true})
+ case 'RECEIVE_TIME_TABLES':
+ case 'RECEIVE_MONTH':
+ return assign({}, state, {fetchSuccess: true, isFetching: false})
+ default:
+ return state
+ }
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js b/app/javascript/time_tables/reducers/timetable.js
index 712808abd..21ca1efed 100644
--- a/app/assets/javascripts/es6_browserified/time_tables/reducers/timetable.js
+++ b/app/javascript/time_tables/reducers/timetable.js
@@ -1,34 +1,37 @@
-const _ = require('lodash')
-var actions = require('../actions')
+import assign from 'lodash/assign'
+import reject from 'lodash/reject'
+import sortBy from 'lodash/sortBy'
+import reduce from 'lodash/reduce'
+import actions from '../actions'
let newState, newPeriods, newDates, newCM
-const timetable = (state = {}, action) => {
+export default function timetable(state = {}, action) {
switch (action.type) {
case 'RECEIVE_TIME_TABLES':
- let fetchedState = _.assign({}, state, {
+ let fetchedState = assign({}, state, {
current_month: action.json.current_month,
current_periode_range: action.json.current_periode_range,
periode_range: action.json.periode_range,
time_table_periods: action.json.time_table_periods,
- time_table_dates: _.sortBy(action.json.time_table_dates, ['date'])
+ time_table_dates: sortBy(action.json.time_table_dates, ['date'])
})
- return _.assign({}, fetchedState, {current_month: actions.updateSynthesis(fetchedState)})
+ return assign({}, fetchedState, {current_month: actions.updateSynthesis(fetchedState)})
case 'RECEIVE_MONTH':
- newState = _.assign({}, state, {
+ newState = assign({}, state, {
current_month: action.json.days
})
- return _.assign({}, newState, {current_month: actions.updateSynthesis(newState)})
+ return assign({}, newState, {current_month: actions.updateSynthesis(newState)})
case 'GO_TO_PREVIOUS_PAGE':
case 'GO_TO_NEXT_PAGE':
let nextPage = action.nextPage ? 1 : -1
let newPage = action.pagination.periode_range[action.pagination.periode_range.indexOf(action.pagination.currentPage) + nextPage]
$('#ConfirmModal').modal('hide')
actions.fetchTimeTables(action.dispatch, newPage)
- return _.assign({}, state, {current_periode_range: newPage})
+ return assign({}, state, {current_periode_range: newPage})
case 'CHANGE_PAGE':
$('#ConfirmModal').modal('hide')
actions.fetchTimeTables(action.dispatch, action.page)
- return _.assign({}, state, {current_periode_range: action.page})
+ return assign({}, state, {current_periode_range: action.page})
case 'DELETE_PERIOD':
newPeriods = state.time_table_periods.map((period, i) =>{
if(i == action.index){
@@ -37,45 +40,45 @@ const timetable = (state = {}, action) => {
return period
})
let deletedPeriod = Array.of(state.time_table_periods[action.index])
- newDates = _.reject(state.time_table_dates, d => actions.isInPeriod(deletedPeriod, d.date) && !d.in_out)
- newState = _.assign({}, state, {time_table_periods : newPeriods, time_table_dates: newDates})
- return _.assign({}, newState, { current_month: actions.updateSynthesis(newState)})
+ newDates = reject(state.time_table_dates, d => actions.isInPeriod(deletedPeriod, d.date) && !d.in_out)
+ newState = assign({}, state, {time_table_periods : newPeriods, time_table_dates: newDates})
+ return assign({}, newState, { current_month: actions.updateSynthesis(newState)})
case 'ADD_INCLUDED_DATE':
newDates = state.time_table_dates.concat({date: action.date, in_out: true})
newCM = state.current_month.map((d, i) => {
if (i == action.index) d.include_date = true
return d
})
- return _.assign({}, state, {current_month: newCM, time_table_dates: newDates})
+ return assign({}, state, {current_month: newCM, time_table_dates: newDates})
case 'REMOVE_INCLUDED_DATE':
- newDates = _.reject(state.time_table_dates, ['date', action.date])
+ newDates = reject(state.time_table_dates, ['date', action.date])
newCM = state.current_month.map((d, i) => {
if (i == action.index) d.include_date = false
return d
})
- return _.assign({}, state, {current_month: newCM, time_table_dates: newDates})
+ return assign({}, state, {current_month: newCM, time_table_dates: newDates})
case 'ADD_EXCLUDED_DATE':
newDates = state.time_table_dates.concat({date: action.date, in_out: false})
newCM = state.current_month.map((d, i) => {
if (i == action.index) d.excluded_date = true
return d
})
- return _.assign({}, state, {current_month: newCM, time_table_dates: newDates})
+ return assign({}, state, {current_month: newCM, time_table_dates: newDates})
case 'REMOVE_EXCLUDED_DATE':
- newDates = _.reject(state.time_table_dates, ['date', action.date])
+ newDates = reject(state.time_table_dates, ['date', action.date])
newCM = state.current_month.map((d, i) => {
if (i == action.index) d.excluded_date = false
return d
})
- return _.assign({}, state, {current_month: newCM, time_table_dates: newDates})
+ return assign({}, state, {current_month: newCM, time_table_dates: newDates})
case 'UPDATE_DAY_TYPES':
// We get the week days of the activated day types to reject the out_dates that that are out of newDayTypes
- let weekDays = _.reduce(action.dayTypes, (array, dt, i) => {
+ let weekDays = reduce(action.dayTypes, (array, dt, i) => {
if (dt) array.push(i)
return array
}, [])
- newDates = _.reject(state.time_table_dates, (d) => {
+ newDates = reject(state.time_table_dates, (d) => {
let weekDay = new Date(d.date).getDay()
if (d.in_out) {
@@ -84,9 +87,9 @@ const timetable = (state = {}, action) => {
return !weekDays.includes(weekDay)
}
})
- return _.assign({}, state, {time_table_dates: newDates})
+ return assign({}, state, {time_table_dates: newDates})
case 'UPDATE_CURRENT_MONTH_FROM_DAYTYPES':
- return _.assign({}, state, {current_month: actions.updateSynthesis(state)})
+ return assign({}, state, {current_month: actions.updateSynthesis(state)})
case 'VALIDATE_PERIOD_FORM':
if (action.error != '') return state
@@ -99,7 +102,7 @@ const timetable = (state = {}, action) => {
let updatedPeriod = newPeriods[action.modalProps.index]
updatedPeriod.period_start = period_start
updatedPeriod.period_end = period_end
- newDates = _.reject(state.time_table_dates, d => actions.isInPeriod(newPeriods, d.date) && !d.in_out)
+ newDates = reject(state.time_table_dates, d => actions.isInPeriod(newPeriods, d.date) && !d.in_out)
}else{
let newPeriod = {
period_start: period_start,
@@ -109,11 +112,9 @@ const timetable = (state = {}, action) => {
}
newDates = newDates || state.time_table_dates
- newState =_.assign({}, state, {time_table_periods: newPeriods, time_table_dates: newDates})
- return _.assign({}, newState, {current_month: actions.updateSynthesis(newState)})
+ newState =assign({}, state, {time_table_periods: newPeriods, time_table_dates: newDates})
+ return assign({}, newState, {current_month: actions.updateSynthesis(newState)})
default:
return state
}
-}
-
-module.exports = timetable
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js b/app/javascript/vehicle_journeys/actions/index.js
index 2e2e06514..4272c7915 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/actions/index.js
+++ b/app/javascript/vehicle_journeys/actions/index.js
@@ -1,10 +1,10 @@
-var Promise = require('promise-polyfill')
+import Promise from 'promise-polyfill'
// To add to window
if (!window.Promise) {
window.Promise = Promise;
}
-var batchActions = require('../batch').batchActions
+import { batchActions } from '../batch'
const actions = {
enterEditMode: () => ({
@@ -460,4 +460,4 @@ const actions = {
},
}
-module.exports = actions
+export default actions
diff --git a/app/javascript/vehicle_journeys/batch.js b/app/javascript/vehicle_journeys/batch.js
new file mode 100644
index 000000000..ea08572aa
--- /dev/null
+++ b/app/javascript/vehicle_journeys/batch.js
@@ -0,0 +1,26 @@
+// 'use strict';
+
+// Object.defineProperty(exports, "__esModule", {
+// value: true
+// });
+// exports.batchActions = batchActions;
+// exports.enableBatching = enableBatching;
+// var BATCH = exports.BATCH = 'BATCH';
+
+export function batchActions(actions) {
+ return {
+ type: 'BATCH',
+ payload: actions
+ };
+}
+
+export function enableBatching(reduce) {
+ return function batchingReducer(state, action) {
+ switch (action.type) {
+ case 'BATCH':
+ return action.payload.reduce(batchingReducer, state);
+ default:
+ return reduce(state, action);
+ }
+ }
+} \ No newline at end of file
diff --git a/app/javascript/vehicle_journeys/components/App.js b/app/javascript/vehicle_journeys/components/App.js
new file mode 100644
index 000000000..8e5f7aa9d
--- /dev/null
+++ b/app/javascript/vehicle_journeys/components/App.js
@@ -0,0 +1,38 @@
+import React from 'react'
+import VehicleJourneysList from '../containers/VehicleJourneysList'
+import Navigate from '../containers/Navigate'
+import ToggleArrivals from '../containers/ToggleArrivals'
+import Filters from '../containers/Filters'
+import SaveVehicleJourneys from '../containers/SaveVehicleJourneys'
+import ConfirmModal from '../containers/ConfirmModal'
+import Tools from '../containers/Tools'
+
+export default function App() {
+ return (
+ <div>
+
+ <div className='row'>
+ <div className='col-lg-6 col-md-6 col-sm-6 col-xs-6'>
+ <ToggleArrivals />
+ </div>
+ <div className='col-lg-6 col-md-6 col-sm-6 col-xs-6 text-right'>
+ <Navigate />
+ </div>
+ </div>
+
+ <Filters />
+ <VehicleJourneysList />
+
+ <div className='row'>
+ <div className='col-lg-12 text-right'>
+ <Navigate />
+ </div>
+ </div>
+
+ <SaveVehicleJourneys />
+ <Tools />
+
+ <ConfirmModal />
+ </div>
+ )
+} \ No newline at end of file
diff --git a/app/javascript/vehicle_journeys/components/ConfirmModal.js b/app/javascript/vehicle_journeys/components/ConfirmModal.js
new file mode 100644
index 000000000..df3c96c48
--- /dev/null
+++ b/app/javascript/vehicle_journeys/components/ConfirmModal.js
@@ -0,0 +1,40 @@
+import React, { PropTypes, Component } from 'react'
+
+export default function ConfirmModal({dispatch, modal, onModalAccept, onModalCancel, vehicleJourneys}) {
+ return (
+ <div className={'modal fade ' + ((modal.type == 'confirm') ? 'in' : '')} id='ConfirmModal'>
+ <div className='modal-dialog'>
+ <div className='modal-content'>
+ <div className='modal-body'>
+ <p> Voulez-vous valider vos modifications avant de changer de page? </p>
+ </div>
+ <div className='modal-footer'>
+ <button
+ className='btn btn-default'
+ data-dismiss='modal'
+ type='button'
+ onClick={() => { onModalCancel(modal.confirmModal.callback) }}
+ >
+ Ne pas valider
+ </button>
+ <button
+ className='btn btn-danger'
+ data-dismiss='modal'
+ type='button'
+ onClick={() => { onModalAccept(modal.confirmModal.callback, vehicleJourneys) }}
+ >
+ Valider
+ </button>
+ </div>
+ </div>
+ </div>
+ </div>
+ )
+}
+
+ConfirmModal.propTypes = {
+ vehicleJourneys: PropTypes.array.isRequired,
+ modal: PropTypes.object.isRequired,
+ onModalAccept: PropTypes.func.isRequired,
+ onModalCancel: PropTypes.func.isRequired
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/Filters.js b/app/javascript/vehicle_journeys/components/Filters.js
index f74bfa71d..db6707520 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/Filters.js
+++ b/app/javascript/vehicle_journeys/components/Filters.js
@@ -1,10 +1,9 @@
-var React = require('react')
-var PropTypes = require('react').PropTypes
-var MissionSelect2 = require('./tools/select2s/MissionSelect2')
-var VJSelect2 = require('./tools/select2s/VJSelect2')
-var TimetableSelect2 = require('./tools/select2s/TimetableSelect2')
+import React, { PropTypes } from 'react'
+import MissionSelect2 from'./tools/select2s/MissionSelect2'
+import VJSelect2 from'./tools/select2s/VJSelect2'
+import TimetableSelect2 from'./tools/select2s/TimetableSelect2'
-const Filters = ({filters, pagination, onFilter, onResetFilters, onUpdateStartTimeFilter, onUpdateEndTimeFilter, onToggleWithoutSchedule, onToggleWithoutTimeTable, onSelect2Timetable, onSelect2JourneyPattern, onSelect2VehicleJourney}) => {
+export default function Filters({filters, pagination, onFilter, onResetFilters, onUpdateStartTimeFilter, onUpdateEndTimeFilter, onToggleWithoutSchedule, onToggleWithoutTimeTable, onSelect2Timetable, onSelect2JourneyPattern, onSelect2VehicleJourney}) {
return (
<div className='row'>
<div className='col-lg-12'>
@@ -166,6 +165,4 @@ Filters.propTypes = {
onSelect2Timetable: PropTypes.func.isRequired,
onSelect2JourneyPattern: PropTypes.func.isRequired,
onSelect2VehicleJourney: PropTypes.func.isRequired
-}
-
-module.exports = Filters
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/Navigate.js b/app/javascript/vehicle_journeys/components/Navigate.js
index a62e034ae..7493b705b 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/Navigate.js
+++ b/app/javascript/vehicle_journeys/components/Navigate.js
@@ -1,9 +1,7 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../actions')
+import React, { PropTypes, Component } from 'react'
+import actions from'../actions'
-let Navigate = ({ dispatch, vehicleJourneys, pagination, status, filters}) => {
+export default function Navigate({ dispatch, vehicleJourneys, pagination, status, filters}) {
let firstPage = 1
let lastPage = Math.ceil(pagination.totalCount / pagination.perPage)
let minVJ = (pagination.page - 1) * pagination.perPage + 1
@@ -54,6 +52,4 @@ Navigate.propTypes = {
status: PropTypes.object.isRequired,
pagination: PropTypes.object.isRequired,
dispatch: PropTypes.func.isRequired
-}
-
-module.exports = Navigate
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/SaveVehicleJourneys.js b/app/javascript/vehicle_journeys/components/SaveVehicleJourneys.js
index 3c45e5758..e8c27f92e 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/SaveVehicleJourneys.js
+++ b/app/javascript/vehicle_journeys/components/SaveVehicleJourneys.js
@@ -1,9 +1,7 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../actions')
+import React, { PropTypes, Component } from 'react'
+import actions from '../actions'
-class SaveVehicleJourneys extends Component{
+export default class SaveVehicleJourneys extends Component{
constructor(props){
super(props)
}
@@ -41,6 +39,4 @@ SaveVehicleJourneys.propTypes = {
filters: PropTypes.object.isRequired,
onEnterEditMode: PropTypes.func.isRequired,
onSubmitVehicleJourneys: PropTypes.func.isRequired
-}
-
-module.exports = SaveVehicleJourneys
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/ToggleArrivals.js b/app/javascript/vehicle_journeys/components/ToggleArrivals.js
index 48fee683f..e26ceec3a 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/ToggleArrivals.js
+++ b/app/javascript/vehicle_journeys/components/ToggleArrivals.js
@@ -1,7 +1,6 @@
-var React = require('react')
-var PropTypes = require('react').PropTypes
+import React, { PropTypes } from 'react'
-const ToggleArrivals = ({filters, onToggleArrivals}) => {
+export default function ToggleArrivals({filters, onToggleArrivals}) {
return (
<div className='has_switch form-group inline'>
<label htmlFor='toggleArrivals' className='control-label'>Afficher et éditer les horaires d'arrivée</label>
@@ -25,6 +24,4 @@ const ToggleArrivals = ({filters, onToggleArrivals}) => {
ToggleArrivals.propTypes = {
filters : PropTypes.object.isRequired,
onToggleArrivals: PropTypes.func.isRequired
-}
-
-module.exports = ToggleArrivals
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/Tools.js b/app/javascript/vehicle_journeys/components/Tools.js
index 4948e6b1a..a717408b9 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/Tools.js
+++ b/app/javascript/vehicle_journeys/components/Tools.js
@@ -1,15 +1,14 @@
-var React = require('react')
-var PropTypes = require('react').PropTypes
-var AddVehicleJourney = require('../containers/tools/AddVehicleJourney')
-var DeleteVehicleJourneys = require('../containers/tools/DeleteVehicleJourneys')
-var ShiftVehicleJourney = require('../containers/tools/ShiftVehicleJourney')
-var DuplicateVehicleJourney = require('../containers/tools/DuplicateVehicleJourney')
-var EditVehicleJourney = require('../containers/tools/EditVehicleJourney')
-var NotesEditVehicleJourney = require('../containers/tools/NotesEditVehicleJourney')
-var TimetablesEditVehicleJourney = require('../containers/tools/TimetablesEditVehicleJourney')
-var actions = require('../actions')
+import React, { PropTypes } from 'react'
+import actions from '../actions'
+import AddVehicleJourney from '../containers/tools/AddVehicleJourney'
+import DeleteVehicleJourneys from '../containers/tools/DeleteVehicleJourneys'
+import ShiftVehicleJourney from '../containers/tools/ShiftVehicleJourney'
+import DuplicateVehicleJourney from '../containers/tools/DuplicateVehicleJourney'
+import EditVehicleJourney from '../containers/tools/EditVehicleJourney'
+import NotesEditVehicleJourney from '../containers/tools/NotesEditVehicleJourney'
+import TimetablesEditVehicleJourney from '../containers/tools/TimetablesEditVehicleJourney'
-const Tools = ({vehicleJourneys, onCancelSelection, filters: {policy}, editMode}) => {
+export default function Tools({vehicleJourneys, onCancelSelection, filters: {policy}, editMode}) {
return (
<div>
{
@@ -37,6 +36,4 @@ Tools.propTypes = {
vehicleJourneys : PropTypes.array.isRequired,
onCancelSelection: PropTypes.func.isRequired,
filters: PropTypes.object.isRequired
-}
-
-module.exports = Tools
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js b/app/javascript/vehicle_journeys/components/VehicleJourney.js
index ca6694f61..cb5407f81 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourney.js
+++ b/app/javascript/vehicle_journeys/components/VehicleJourney.js
@@ -1,9 +1,7 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../actions')
+import React, { PropTypes, Component } from 'react'
+import actions from '../actions'
-class VehicleJourney extends Component {
+export default class VehicleJourney extends Component {
constructor(props) {
super(props)
this.previousCity = undefined
@@ -144,6 +142,4 @@ VehicleJourney.propTypes = {
index: PropTypes.number.isRequired,
onUpdateTime: PropTypes.func.isRequired,
onSelectVehicleJourney: PropTypes.func.isRequired
-}
-
-module.exports = VehicleJourney
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourneys.js b/app/javascript/vehicle_journeys/components/VehicleJourneys.js
index 8f3f91b25..6bce9766b 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/VehicleJourneys.js
+++ b/app/javascript/vehicle_journeys/components/VehicleJourneys.js
@@ -1,10 +1,9 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var VehicleJourney = require('./VehicleJourney')
-var _ = require('lodash')
+import React, { PropTypes, Component } from 'react'
+import _ from 'lodash'
+import VehicleJourney from './VehicleJourney'
-class VehicleJourneys extends Component{
+
+export default class VehicleJourneys extends Component {
constructor(props){
super(props)
this.previousCity = undefined
@@ -154,6 +153,4 @@ VehicleJourneys.propTypes = {
onLoadFirstPage: PropTypes.func.isRequired,
onUpdateTime: PropTypes.func.isRequired,
onSelectVehicleJourney: PropTypes.func.isRequired
-}
-
-module.exports = VehicleJourneys
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/CreateModal.js b/app/javascript/vehicle_journeys/components/tools/CreateModal.js
index 6a1e8ffb9..5b5e2f849 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/CreateModal.js
+++ b/app/javascript/vehicle_journeys/components/tools/CreateModal.js
@@ -1,11 +1,9 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../../actions')
-var MissionSelect2 = require('./select2s/MissionSelect2')
-var CompanySelect2 = require('./select2s/CompanySelect2')
+import React, { PropTypes, Component } from 'react'
+import actions from '../../actions'
+import MissionSelect2 from './select2s/MissionSelect2'
+import CompanySelect2 from './select2s/CompanySelect2'
-class CreateModal extends Component {
+export default class CreateModal extends Component {
constructor(props) {
super(props)
}
@@ -130,6 +128,4 @@ CreateModal.propTypes = {
onModalClose: PropTypes.func.isRequired,
onAddVehicleJourney: PropTypes.func.isRequired,
onSelect2JourneyPattern: PropTypes.func.isRequired
-}
-
-module.exports = CreateModal
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/DeleteVehicleJourneys.js b/app/javascript/vehicle_journeys/components/tools/DeleteVehicleJourneys.js
index c98b794a8..0a1dedd3c 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/DeleteVehicleJourneys.js
+++ b/app/javascript/vehicle_journeys/components/tools/DeleteVehicleJourneys.js
@@ -1,8 +1,7 @@
-var React = require('react')
-var PropTypes = require('react').PropTypes
-var actions = require('../../actions')
+import React, { PropTypes } from 'react'
+import actions from '../../actions'
-const DeleteVehicleJourneys = ({onDeleteVehicleJourneys, vehicleJourneys, filters}) => {
+export default function DeleteVehicleJourneys({onDeleteVehicleJourneys, vehicleJourneys, filters}) {
return (
<li className='st_action'>
<button
@@ -24,6 +23,4 @@ DeleteVehicleJourneys.propTypes = {
onDeleteVehicleJourneys: PropTypes.func.isRequired,
vehicleJourneys: PropTypes.array.isRequired,
filters: PropTypes.object.isRequired
-}
-
-module.exports = DeleteVehicleJourneys
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/DuplicateVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/DuplicateVehicleJourney.js
index 9446b993a..0c1c81114 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/DuplicateVehicleJourney.js
+++ b/app/javascript/vehicle_journeys/components/tools/DuplicateVehicleJourney.js
@@ -1,10 +1,8 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../../actions')
-var _ = require('lodash')
+import React, { PropTypes, Component } from 'react'
+import actions from '../../actions'
+import _ from 'lodash'
-class DuplicateVehicleJourney extends Component {
+export default class DuplicateVehicleJourney extends Component {
constructor(props) {
super(props)
this.state = {}
@@ -195,6 +193,4 @@ DuplicateVehicleJourney.propTypes = {
onOpenDuplicateModal: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired,
filters: PropTypes.object.isRequired
-}
-
-module.exports = DuplicateVehicleJourney
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/EditVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js
index 2ff4999c6..3a4a57024 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/EditVehicleJourney.js
+++ b/app/javascript/vehicle_journeys/components/tools/EditVehicleJourney.js
@@ -1,10 +1,8 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../../actions')
-var CompanySelect2 = require('./select2s/CompanySelect2')
+import React, { PropTypes, Component } from 'react'
+import actions from '../../actions'
+import CompanySelect2 from './select2s/CompanySelect2'
-class EditVehicleJourney extends Component {
+export default class EditVehicleJourney extends Component {
constructor(props) {
super(props)
}
@@ -111,7 +109,7 @@ class EditVehicleJourney extends Component {
<input
type='text'
className='form-control'
- value={window.I18n.fr.enumerize.line.transport_mode[this.props.modal.modalProps.vehicleJourney.transport_mode]}
+ value={window.I18n.fr.enumerize.transport_mode[this.props.modal.modalProps.vehicleJourney.transport_mode]}
disabled={true}
/>
</div>
@@ -122,7 +120,7 @@ class EditVehicleJourney extends Component {
<input
type='text'
className='form-control'
- value={window.I18n.fr.enumerize.line.transport_submode[this.props.modal.modalProps.vehicleJourney.transport_submode]}
+ value={window.I18n.fr.enumerize.transport_submode[this.props.modal.modalProps.vehicleJourney.transport_submode]}
disabled={true}
/>
</div>
@@ -166,6 +164,4 @@ EditVehicleJourney.propTypes = {
onOpenEditModal: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired,
filters: PropTypes.object.isRequired
-}
-
-module.exports = EditVehicleJourney
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/NotesEditVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/NotesEditVehicleJourney.js
index df6c311e6..1958faf5f 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/NotesEditVehicleJourney.js
+++ b/app/javascript/vehicle_journeys/components/tools/NotesEditVehicleJourney.js
@@ -1,10 +1,8 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../../actions')
-var _ = require('lodash')
+import React, { PropTypes, Component } from 'react'
+import actions from '../../actions'
+import _ from 'lodash'
-class NotesEditVehicleJourney extends Component {
+export default class NotesEditVehicleJourney extends Component {
constructor(props) {
super(props)
}
@@ -149,6 +147,4 @@ NotesEditVehicleJourney.propTypes = {
onToggleFootnoteModal: PropTypes.func.isRequired,
onNotesEditVehicleJourney: PropTypes.func.isRequired,
filters: PropTypes.object.isRequired
-}
-
-module.exports = NotesEditVehicleJourney
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/ShiftVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/ShiftVehicleJourney.js
index dd0bade39..c1e2de779 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/ShiftVehicleJourney.js
+++ b/app/javascript/vehicle_journeys/components/tools/ShiftVehicleJourney.js
@@ -1,9 +1,7 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../../actions')
+import React, { PropTypes, Component } from 'react'
+import actions from '../../actions'
-class ShiftVehicleJourney extends Component {
+export default class ShiftVehicleJourney extends Component {
constructor(props) {
super(props)
this.state = {
@@ -113,6 +111,4 @@ ShiftVehicleJourney.propTypes = {
onOpenShiftModal: PropTypes.func.isRequired,
onModalClose: PropTypes.func.isRequired,
filters: PropTypes.object.isRequired
-}
-
-module.exports = ShiftVehicleJourney
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js b/app/javascript/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js
index a26a9b805..fd2304901 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js
+++ b/app/javascript/vehicle_journeys/components/tools/TimetablesEditVehicleJourney.js
@@ -1,10 +1,8 @@
-var React = require('react')
-var Component = require('react').Component
-var PropTypes = require('react').PropTypes
-var actions = require('../../actions')
-var TimetableSelect2 = require('./select2s/TimetableSelect2')
+import React, { PropTypes, Component } from 'react'
+import actions from '../../actions'
+import TimetableSelect2 from './select2s/TimetableSelect2'
-class TimetablesEditVehicleJourney extends Component {
+export default class TimetablesEditVehicleJourney extends Component {
constructor(props) {
super(props)
}
@@ -130,6 +128,4 @@ TimetablesEditVehicleJourney.propTypes = {
onDeleteCalendarModal: PropTypes.func.isRequired,
onSelect2Timetable: PropTypes.func.isRequired,
filters: PropTypes.object.isRequired
-}
-
-module.exports = TimetablesEditVehicleJourney
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js b/app/javascript/vehicle_journeys/components/tools/select2s/CompanySelect2.js
index c1ce0e92a..9c259630d 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/CompanySelect2.js
+++ b/app/javascript/vehicle_journeys/components/tools/select2s/CompanySelect2.js
@@ -1,15 +1,14 @@
-var _ = require('lodash')
-var React = require('react')
-var PropTypes = require('react').PropTypes
-var Select2 = require('react-select2')
+import _ from 'lodash'
+import React, { PropTypes, Component } from 'react'
+import Select2 from 'react-select2'
// get JSON full path
-var origin = window.location.origin
-var path = window.location.pathname.split('/', 3).join('/')
-var line = window.location.pathname.split('/')[4]
+let origin = window.location.origin
+let path = window.location.pathname.split('/', 3).join('/')
+let line = window.location.pathname.split('/')[4]
-class BSelect4 extends React.Component{
+export default class BSelect4 extends Component {
constructor(props) {
super(props)
}
@@ -62,6 +61,4 @@ class BSelect4 extends React.Component{
const formatRepo = (props) => {
if(props.text) return props.text
-}
-
-module.exports = BSelect4
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js b/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js
index 2f49e9980..e4abdd651 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/MissionSelect2.js
+++ b/app/javascript/vehicle_journeys/components/tools/select2s/MissionSelect2.js
@@ -1,20 +1,18 @@
-var _ = require('lodash')
-var React = require('react')
-var PropTypes = require('react').PropTypes
-var Select2 = require('react-select2')
-var humanOID = require('../../../actions').humanOID
+import _ from 'lodash'
+import React, { PropTypes, Component } from 'react'
+import Select2 from 'react-select2'
+import actions from '../../../actions'
// get JSON full path
-var origin = window.location.origin
-var path = window.location.pathname.split('/', 7).join('/')
+let origin = window.location.origin
+let path = window.location.pathname.split('/', 7).join('/')
-class BSelect4 extends React.Component{
+export default class BSelect4 extends Component {
constructor(props) {
super(props)
}
-
render() {
return (
<Select2
@@ -44,7 +42,7 @@ class BSelect4 extends React.Component{
item => _.assign(
{},
item,
- { text: "<strong>" + item.published_name + " - " + humanOID(item.object_id) + "</strong><br/><small>" + item.registration_number + "</small>" }
+ { text: "<strong>" + item.published_name + " - " + actions.humanOID(item.object_id) + "</strong><br/><small>" + item.registration_number + "</small>" }
)
)
};
@@ -62,6 +60,4 @@ class BSelect4 extends React.Component{
const formatRepo = (props) => {
if(props.text) return props.text
-}
-
-module.exports = BSelect4
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js b/app/javascript/vehicle_journeys/components/tools/select2s/TimetableSelect2.js
index 2248175ab..606bf8511 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/TimetableSelect2.js
+++ b/app/javascript/vehicle_journeys/components/tools/select2s/TimetableSelect2.js
@@ -1,15 +1,14 @@
-var _ = require('lodash')
-var React = require('react')
-var PropTypes = require('react').PropTypes
-var Select2 = require('react-select2')
-var humanOID = require('../../../actions').humanOID
+import _ from 'lodash'
+import React, { PropTypes, Component } from 'react'
+import Select2 from 'react-select2'
+import actions from '../../../actions'
// get JSON full path
var origin = window.location.origin
var path = window.location.pathname.split('/', 3).join('/')
-class BSelect4 extends React.Component{
+export default class BSelect4 extends Component {
constructor(props) {
super(props)
}
@@ -48,7 +47,7 @@ class BSelect4 extends React.Component{
item => _.assign(
{},
item,
- {text: '<strong>' + "<span class='fa fa-circle' style='color:" + (item.color ? item.color : '#4B4B4B') + "'></span> " + item.comment + ' - ' + humanOID(item.objectid) + '</strong><br/><small>' + (item.day_types ? item.day_types.match(/[A-Z]?[a-z]+/g).join(', ') : "") + '</small>'}
+ {text: '<strong>' + "<span class='fa fa-circle' style='color:" + (item.color ? item.color : '#4B4B4B') + "'></span> " + item.comment + ' - ' + actions.humanOID(item.objectid) + '</strong><br/><small>' + (item.day_types ? item.day_types.match(/[A-Z]?[a-z]+/g).join(', ') : "") + '</small>'}
)
)
};
@@ -66,6 +65,4 @@ class BSelect4 extends React.Component{
const formatRepo = (props) => {
if(props.text) return props.text
-}
-
-module.exports = BSelect4
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/VJSelect2.js b/app/javascript/vehicle_journeys/components/tools/select2s/VJSelect2.js
index b9678ea9a..e1af8816d 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/VJSelect2.js
+++ b/app/javascript/vehicle_journeys/components/tools/select2s/VJSelect2.js
@@ -1,15 +1,14 @@
-var _ = require('lodash')
-var React = require('react')
-var PropTypes = require('react').PropTypes
-var Select2 = require('react-select2')
-var humanOID = require('../../../actions').humanOID
+import _ from 'lodash'
+import React, { PropTypes, Component } from 'react'
+import Select2 from 'react-select2'
+import actions from '../../../actions'
// get JSON full path
-var origin = window.location.origin
-var path = window.location.pathname.split('/', 7).join('/')
+let origin = window.location.origin
+let path = window.location.pathname.split('/', 7).join('/')
-class BSelect4b extends React.Component{
+export default class BSelect4b extends Component {
constructor(props) {
super(props)
}
@@ -43,7 +42,7 @@ class BSelect4b extends React.Component{
item => _.assign(
{},
item,
- { id: item.objectid, text: humanOID(item.objectid) }
+ { id: item.objectid, text: actions.humanOID(item.objectid) }
)
)
};
@@ -60,6 +59,4 @@ class BSelect4b extends React.Component{
const formatRepo = (props) => {
if(props.text) return props.text
-}
-
-module.exports = BSelect4b
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/fr.js b/app/javascript/vehicle_journeys/components/tools/select2s/fr.js
index 20154d412..20154d412 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/select2s/fr.js
+++ b/app/javascript/vehicle_journeys/components/tools/select2s/fr.js
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/ConfirmModal.js b/app/javascript/vehicle_journeys/containers/ConfirmModal.js
index e91ba6bf0..e751a70f6 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/ConfirmModal.js
+++ b/app/javascript/vehicle_journeys/containers/ConfirmModal.js
@@ -1,6 +1,6 @@
-var actions = require('../actions')
-var connect = require('react-redux').connect
-var ConfirmModal = require('../components/ConfirmModal')
+import actions from '../actions'
+import { connect } from 'react-redux'
+import ConfirmModal from '../components/ConfirmModal'
const mapStateToProps = (state) => {
return {
@@ -27,4 +27,4 @@ const mapDispatchToProps = (dispatch) => {
const ConfirmModalContainer = connect(mapStateToProps, mapDispatchToProps)(ConfirmModal)
-module.exports = ConfirmModalContainer
+export default ConfirmModalContainer
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/Filters.js b/app/javascript/vehicle_journeys/containers/Filters.js
index 831b47ca1..bec3527f4 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/Filters.js
+++ b/app/javascript/vehicle_journeys/containers/Filters.js
@@ -1,6 +1,6 @@
-var actions = require('../actions')
-var connect = require('react-redux').connect
-var Filters = require('../components/Filters')
+import actions from '../actions'
+import { connect } from 'react-redux'
+import Filters from '../components/Filters'
const mapStateToProps = (state) => {
return {
@@ -45,4 +45,4 @@ const mapDispatchToProps = (dispatch) => {
const FiltersList = connect(mapStateToProps, mapDispatchToProps)(Filters)
-module.exports = FiltersList
+export default FiltersList
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/Navigate.js b/app/javascript/vehicle_journeys/containers/Navigate.js
index a3eca13c8..f6cd4e2a1 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/Navigate.js
+++ b/app/javascript/vehicle_journeys/containers/Navigate.js
@@ -1,7 +1,6 @@
-var React = require('react')
-var connect = require('react-redux').connect
-var actions = require('../actions')
-var NavigateComponent = require('../components/Navigate')
+import actions from '../actions'
+import { connect } from 'react-redux'
+import NavigateComponent from '../components/Navigate'
const mapStateToProps = (state) => {
return {
@@ -15,4 +14,4 @@ const mapStateToProps = (state) => {
const Navigate = connect(mapStateToProps)(NavigateComponent)
-module.exports = Navigate
+export default Navigate
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/SaveVehicleJourneys.js b/app/javascript/vehicle_journeys/containers/SaveVehicleJourneys.js
index c1ce90d38..18f9e994e 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/SaveVehicleJourneys.js
+++ b/app/javascript/vehicle_journeys/containers/SaveVehicleJourneys.js
@@ -1,7 +1,6 @@
-var React = require('react')
-var connect = require('react-redux').connect
-var actions = require('../actions')
-var SaveVehicleJourneysComponent = require('../components/SaveVehicleJourneys')
+import actions from '../actions'
+import { connect } from 'react-redux'
+import SaveVehicleJourneysComponent from '../components/SaveVehicleJourneys'
const mapStateToProps = (state) => {
return {
@@ -26,4 +25,4 @@ const mapDispatchToProps = (dispatch) => {
const SaveVehicleJourneys = connect(mapStateToProps, mapDispatchToProps)(SaveVehicleJourneysComponent)
-module.exports = SaveVehicleJourneys
+export default SaveVehicleJourneys
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/ToggleArrivals.js b/app/javascript/vehicle_journeys/containers/ToggleArrivals.js
index 716485dbf..f6e180f80 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/ToggleArrivals.js
+++ b/app/javascript/vehicle_journeys/containers/ToggleArrivals.js
@@ -1,6 +1,6 @@
-var actions = require('../actions')
-var connect = require('react-redux').connect
-var ToggleArrivals = require('../components/ToggleArrivals')
+import actions from '../actions'
+import { connect } from 'react-redux'
+import ToggleArrivals from '../components/ToggleArrivals'
const mapStateToProps = (state) => {
return {
@@ -18,4 +18,4 @@ const mapDispatchToProps = (dispatch) => {
const ToggleArrivalsList = connect(mapStateToProps, mapDispatchToProps)(ToggleArrivals)
-module.exports = ToggleArrivalsList
+export default ToggleArrivalsList
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/Tools.js b/app/javascript/vehicle_journeys/containers/Tools.js
index a4b3056ac..b760b52d6 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/Tools.js
+++ b/app/javascript/vehicle_journeys/containers/Tools.js
@@ -1,6 +1,6 @@
-var connect = require('react-redux').connect
-var ToolsComponent = require('../components/Tools')
-var actions = require('../actions')
+import actions from '../actions'
+import { connect } from 'react-redux'
+import ToolsComponent from '../components/Tools'
const mapStateToProps = (state) => {
return {
@@ -20,4 +20,4 @@ const mapDispatchToProps = (dispatch) => {
const Tools = connect(mapStateToProps, mapDispatchToProps)(ToolsComponent)
-module.exports = Tools
+export default Tools
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/VehicleJourneysList.js b/app/javascript/vehicle_journeys/containers/VehicleJourneysList.js
index f834e4457..38ab9f6d3 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/VehicleJourneysList.js
+++ b/app/javascript/vehicle_journeys/containers/VehicleJourneysList.js
@@ -1,6 +1,6 @@
-var actions = require('../actions')
-var connect = require('react-redux').connect
-var VehicleJourneys = require('../components/VehicleJourneys')
+import actions from '../actions'
+import { connect } from 'react-redux'
+import VehicleJourneys from '../components/VehicleJourneys'
const mapStateToProps = (state) => {
return {
@@ -29,4 +29,4 @@ const mapDispatchToProps = (dispatch) => {
const VehicleJourneysList = connect(mapStateToProps, mapDispatchToProps)(VehicleJourneys)
-module.exports = VehicleJourneysList
+export default VehicleJourneysList
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/AddVehicleJourney.js b/app/javascript/vehicle_journeys/containers/tools/AddVehicleJourney.js
index ffe080cdf..b3f777448 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/AddVehicleJourney.js
+++ b/app/javascript/vehicle_journeys/containers/tools/AddVehicleJourney.js
@@ -1,6 +1,6 @@
-var actions = require('../../actions')
-var connect = require('react-redux').connect
-var CreateModal = require('../../components/tools/CreateModal')
+import actions from '../../actions'
+import { connect } from 'react-redux'
+import CreateModal from '../../components/tools/CreateModal'
const mapStateToProps = (state) => {
return {
@@ -34,4 +34,4 @@ const mapDispatchToProps = (dispatch) => {
const AddVehicleJourney = connect(mapStateToProps, mapDispatchToProps)(CreateModal)
-module.exports = AddVehicleJourney
+export default AddVehicleJourney
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/DeleteVehicleJourneys.js b/app/javascript/vehicle_journeys/containers/tools/DeleteVehicleJourneys.js
index c012c9706..d7d315da4 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/DeleteVehicleJourneys.js
+++ b/app/javascript/vehicle_journeys/containers/tools/DeleteVehicleJourneys.js
@@ -1,6 +1,6 @@
-var actions = require('../../actions')
-var connect = require('react-redux').connect
-var DeleteVJComponent = require('../../components/tools/DeleteVehicleJourneys')
+import actions from '../../actions'
+import { connect } from 'react-redux'
+import DeleteVJComponent from '../../components/tools/DeleteVehicleJourneys'
const mapStateToProps = (state) => {
return {
@@ -19,4 +19,4 @@ const mapDispatchToProps = (dispatch) => {
const DeleteVehicleJourneys = connect(mapStateToProps, mapDispatchToProps)(DeleteVJComponent)
-module.exports = DeleteVehicleJourneys
+export default DeleteVehicleJourneys
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js b/app/javascript/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js
index 70e8fde4d..e9ca88040 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js
+++ b/app/javascript/vehicle_journeys/containers/tools/DuplicateVehicleJourney.js
@@ -1,6 +1,6 @@
-var actions = require('../../actions')
-var connect = require('react-redux').connect
-var DuplicateVJComponent = require('../../components/tools/DuplicateVehicleJourney')
+import actions from '../../actions'
+import { connect } from 'react-redux'
+import DuplicateVJComponent from '../../components/tools/DuplicateVehicleJourney'
const mapStateToProps = (state) => {
return {
@@ -27,4 +27,4 @@ const mapDispatchToProps = (dispatch) => {
const DuplicateVehicleJourney = connect(mapStateToProps, mapDispatchToProps)(DuplicateVJComponent)
-module.exports = DuplicateVehicleJourney
+export default DuplicateVehicleJourney
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/EditVehicleJourney.js b/app/javascript/vehicle_journeys/containers/tools/EditVehicleJourney.js
index ac9772b8a..2d480aa0c 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/EditVehicleJourney.js
+++ b/app/javascript/vehicle_journeys/containers/tools/EditVehicleJourney.js
@@ -1,6 +1,6 @@
-var connect = require('react-redux').connect
-var EditComponent = require('../../components/tools/EditVehicleJourney')
-var actions = require('../../actions')
+import actions from '../../actions'
+import { connect } from 'react-redux'
+import EditComponent from '../../components/tools/EditVehicleJourney'
const mapStateToProps = (state) => {
return {
@@ -33,4 +33,4 @@ const mapDispatchToProps = (dispatch) => {
const EditVehicleJourney = connect(mapStateToProps, mapDispatchToProps)(EditComponent)
-module.exports = EditVehicleJourney
+export default EditVehicleJourney
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/NotesEditVehicleJourney.js b/app/javascript/vehicle_journeys/containers/tools/NotesEditVehicleJourney.js
index 1619300d0..5a96ff273 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/NotesEditVehicleJourney.js
+++ b/app/javascript/vehicle_journeys/containers/tools/NotesEditVehicleJourney.js
@@ -1,6 +1,6 @@
-var connect = require('react-redux').connect
-var NotesEditComponent = require('../../components/tools/NotesEditVehicleJourney')
-var actions = require('../../actions')
+import actions from '../../actions'
+import { connect } from 'react-redux'
+import NotesEditComponent from '../../components/tools/NotesEditVehicleJourney'
const mapStateToProps = (state) => {
return {
@@ -30,4 +30,4 @@ const mapDispatchToProps = (dispatch) => {
const NotesEditVehicleJourney = connect(mapStateToProps, mapDispatchToProps)(NotesEditComponent)
-module.exports = NotesEditVehicleJourney
+export default NotesEditVehicleJourney
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/ShiftVehicleJourney.js b/app/javascript/vehicle_journeys/containers/tools/ShiftVehicleJourney.js
index 196f6722a..a4b4fbe39 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/ShiftVehicleJourney.js
+++ b/app/javascript/vehicle_journeys/containers/tools/ShiftVehicleJourney.js
@@ -1,6 +1,6 @@
-var actions = require('../../actions')
-var connect = require('react-redux').connect
-var ShiftVJComponent = require('../../components/tools/ShiftVehicleJourney')
+import actions from '../../actions'
+import { connect } from 'react-redux'
+import ShiftVJComponent from '../../components/tools/ShiftVehicleJourney'
const mapStateToProps = (state) => {
return {
@@ -27,4 +27,4 @@ const mapDispatchToProps = (dispatch) => {
const ShiftVehicleJourney = connect(mapStateToProps, mapDispatchToProps)(ShiftVJComponent)
-module.exports = ShiftVehicleJourney
+export default ShiftVehicleJourney
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/TimetablesEditVehicleJourney.js b/app/javascript/vehicle_journeys/containers/tools/TimetablesEditVehicleJourney.js
index 1cfff407c..62150a06e 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/containers/tools/TimetablesEditVehicleJourney.js
+++ b/app/javascript/vehicle_journeys/containers/tools/TimetablesEditVehicleJourney.js
@@ -1,6 +1,6 @@
-var connect = require('react-redux').connect
-var TimetablesEditComponent = require('../../components/tools/TimetablesEditVehicleJourney')
-var actions = require('../../actions')
+import actions from '../../actions'
+import { connect } from 'react-redux'
+import TimetablesEditComponent from '../../components/tools/TimetablesEditVehicleJourney'
const mapStateToProps = (state) => {
return {
@@ -34,4 +34,4 @@ const mapDispatchToProps = (dispatch) => {
const TimetablesEditVehicleJourney = connect(mapStateToProps, mapDispatchToProps)(TimetablesEditComponent)
-module.exports = TimetablesEditVehicleJourney
+export default TimetablesEditVehicleJourney
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/editMode.js b/app/javascript/vehicle_journeys/reducers/editMode.js
index 2e8af1aa8..bff976804 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/editMode.js
+++ b/app/javascript/vehicle_journeys/reducers/editMode.js
@@ -1,4 +1,4 @@
-const editMode = (state = {}, action ) => {
+export default function editMode(state = {}, action ) {
switch (action.type) {
case "ENTER_EDIT_MODE":
return true
@@ -7,6 +7,4 @@ const editMode = (state = {}, action ) => {
default:
return state
}
-}
-
-module.exports = editMode
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/filters.js b/app/javascript/vehicle_journeys/reducers/filters.js
index b4a70ec08..76fc98cc5 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/filters.js
+++ b/app/javascript/vehicle_journeys/reducers/filters.js
@@ -1,8 +1,8 @@
-var _ = require('lodash')
-var actions = require("../actions")
+import _ from 'lodash'
+import actions from '../actions'
let newQuery, newInterval
-const filters = (state = {}, action) => {
+export default function filters(state = {}, action) {
switch (action.type) {
case 'RESET_FILTERS':
let interval = {
@@ -70,6 +70,4 @@ const filters = (state = {}, action) => {
default:
return state
}
-}
-
-module.exports = filters
+} \ No newline at end of file
diff --git a/app/javascript/vehicle_journeys/reducers/index.js b/app/javascript/vehicle_journeys/reducers/index.js
new file mode 100644
index 000000000..bb24aa185
--- /dev/null
+++ b/app/javascript/vehicle_journeys/reducers/index.js
@@ -0,0 +1,20 @@
+import { combineReducers } from 'redux'
+import vehicleJourneys from './vehicleJourneys'
+import pagination from './pagination'
+import modal from './modal'
+import status from './status'
+import filters from './filters'
+import editMode from './editMode'
+import stopPointsList from './stopPointsList'
+
+const vehicleJourneysApp = combineReducers({
+ vehicleJourneys,
+ pagination,
+ modal,
+ status,
+ filters,
+ editMode,
+ stopPointsList
+})
+
+export default vehicleJourneysApp
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/modal.js b/app/javascript/vehicle_journeys/reducers/modal.js
index 1e5ff4294..57f54a144 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/modal.js
+++ b/app/javascript/vehicle_journeys/reducers/modal.js
@@ -1,6 +1,8 @@
-var _ = require('lodash')
+import _ from 'lodash'
+
let vehicleJourneysModal, newModalProps
-const modal = (state = {}, action) => {
+
+export default function modal(state = {}, action) {
switch (action.type) {
case 'OPEN_CONFIRM_MODAL':
$('#ConfirmModal').modal('show')
@@ -133,6 +135,4 @@ const modal = (state = {}, action) => {
default:
return state
}
-}
-
-module.exports = modal
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/pagination.js b/app/javascript/vehicle_journeys/reducers/pagination.js
index a8189fc97..45c40c4c4 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/pagination.js
+++ b/app/javascript/vehicle_journeys/reducers/pagination.js
@@ -1,5 +1,6 @@
-var _ = require('lodash')
-const pagination = (state = {}, action) => {
+import _ from 'lodash'
+
+export default function pagination(state = {}, action) {
switch (action.type) {
case 'RECEIVE_JOURNEY_PATTERNS':
case 'RECEIVE_VEHICLE_JOURNEYS':
@@ -33,6 +34,4 @@ const toggleOnConfirmModal = (arg = '') =>{
$('.confirm').each(function(){
$(this).data('toggle','')
})
-}
-
-module.exports = pagination
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/status.js b/app/javascript/vehicle_journeys/reducers/status.js
index e658e164e..0bbb05124 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/status.js
+++ b/app/javascript/vehicle_journeys/reducers/status.js
@@ -1,7 +1,7 @@
-var _ = require('lodash')
-var actions = require("../actions")
+import _ from 'lodash'
+import actions from '../actions'
-const status = (state = {}, action) => {
+export default function status(state = {}, action) {
switch (action.type) {
case 'UNAVAILABLE_SERVER':
return _.assign({}, state, {fetchSuccess: false})
@@ -14,6 +14,4 @@ const status = (state = {}, action) => {
default:
return state
}
-}
-
-module.exports = status
+} \ No newline at end of file
diff --git a/app/javascript/vehicle_journeys/reducers/stopPointsList.js b/app/javascript/vehicle_journeys/reducers/stopPointsList.js
new file mode 100644
index 000000000..9b22e08f2
--- /dev/null
+++ b/app/javascript/vehicle_journeys/reducers/stopPointsList.js
@@ -0,0 +1,6 @@
+export default function stopPointsList(state = [], action) {
+ switch (action.type) {
+ default:
+ return state
+ }
+} \ No newline at end of file
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/vehicleJourneys.js b/app/javascript/vehicle_journeys/reducers/vehicleJourneys.js
index 969b2ddd8..775fefdca 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/reducers/vehicleJourneys.js
+++ b/app/javascript/vehicle_journeys/reducers/vehicleJourneys.js
@@ -1,5 +1,5 @@
-var _ = require('lodash')
-var actions = require("../actions")
+import _ from 'lodash'
+import actions from '../actions'
const vehicleJourney= (state = {}, action, keep) => {
switch (action.type) {
@@ -102,7 +102,7 @@ const vehicleJourney= (state = {}, action, keep) => {
}
}
-const vehicleJourneys = (state = [], action) => {
+export default function vehicleJourneys(state = [], action) {
switch (action.type) {
case 'RECEIVE_VEHICLE_JOURNEYS':
return [...action.json]
@@ -224,6 +224,4 @@ const vehicleJourneys = (state = [], action) => {
default:
return state
}
-}
-
-module.exports = vehicleJourneys
+} \ No newline at end of file
diff --git a/app/models/chouette/line.rb b/app/models/chouette/line.rb
index 63d2d1606..0139bb6a4 100644
--- a/app/models/chouette/line.rb
+++ b/app/models/chouette/line.rb
@@ -2,13 +2,11 @@ class Chouette::Line < Chouette::ActiveRecord
include StifCodifligneAttributesSupport
include LineRestrictions
include LineReferentialSupport
- include StifTransportModeEnumerations
+ extend StifTransportModeEnumerations
+ extend StifTransportSubmodeEnumerations
- extend Enumerize
extend ActiveModel::Naming
- enumerize :transport_submode, in: %i(unknown undefined internationalFlight domesticFlight intercontinentalFlight domesticScheduledFlight shuttleFlight intercontinentalCharterFlight internationalCharterFlight roundTripCharterFlight sightseeingFlight helicopterService domesticCharterFlight SchengenAreaFlight airshipService shortHaulInternationalFlight canalBarge localBus regionalBus expressBus nightBus postBus specialNeedsBus mobilityBus mobilityBusForRegisteredDisabled sightseeingBus shuttleBus highFrequencyBus dedicatedLaneBus schoolBus schoolAndPublicServiceBus railReplacementBus demandAndResponseBus airportLinkBus internationalCoach nationalCoach shuttleCoach regionalCoach specialCoach schoolCoach sightseeingCoach touristCoach commuterCoach metro tube urbanRailway local highSpeedRail suburbanRailway regionalRail interregionalRail longDistance intermational sleeperRailService nightRail carTransportRailService touristRailway railShuttle replacementRailService specialTrain crossCountryRail rackAndPinionRailway cityTram localTram regionalTram sightseeingTram shuttleTram trainTram internationalCarFerry nationalCarFerry regionalCarFerry localCarFerry internationalPassengerFerry nationalPassengerFerry regionalPassengerFerry localPassengerFerry postBoat trainFerry roadFerryLink airportBoatLink highSpeedVehicleService highSpeedPassengerService sightseeingService schoolBoat cableFerry riverBus scheduledFerry shuttleFerryService telecabin cableCar lift chairLift dragLift telecabinLink funicular streetCableCar allFunicularServices undefinedFunicular)
-
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
diff --git a/app/models/chouette/time_table.rb b/app/models/chouette/time_table.rb
index 8821a5201..72496273e 100644
--- a/app/models/chouette/time_table.rb
+++ b/app/models/chouette/time_table.rb
@@ -21,12 +21,12 @@ class Chouette::TimeTable < Chouette::TridentActiveRecord
belongs_to :calendar
belongs_to :created_from, class_name: 'Chouette::TimeTable'
- scope :overlapping, -> (date_start, date_end) do
+ scope :overlapping, -> (period_range) do
joins("
LEFT JOIN time_table_periods ON time_tables.id = time_table_periods.time_table_id
LEFT JOIN time_table_dates ON time_tables.id = time_table_dates.time_table_id
")
- .where("(time_table_periods.period_start <= :end AND time_table_periods.period_end >= :start) OR (time_table_dates.date BETWEEN :start AND :end)", {start: date_start, end: date_end})
+ .where("(time_table_periods.period_start <= :end AND time_table_periods.period_end >= :begin) OR (time_table_dates.date BETWEEN :begin AND :end)", {begin: period_range.begin, end: period_range.end})
end
after_save :save_shortcuts
diff --git a/app/models/chouette/transport_mode.rb b/app/models/chouette/transport_mode.rb
deleted file mode 100644
index 825ef15b8..000000000
--- a/app/models/chouette/transport_mode.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-class Chouette::TransportMode < ActiveSupport::StringInquirer
-
- def initialize(text_code, numerical_code)
- super text_code.to_s
- @numerical_code = numerical_code
- end
-
- def self.new(text_code, numerical_code = nil)
- if text_code and numerical_code
- super
- elsif self === text_code
- text_code
- else
- if Fixnum === text_code
- text_code, numerical_code = definitions.rassoc(text_code)
- else
- text_code, numerical_code = definitions.assoc(text_code.to_s)
- end
-
- super text_code, numerical_code
- end
- end
-
- def to_i
- @numerical_code
- end
-
- def inspect
- "#{to_s}/#{to_i}"
- end
-
- def name
- camelize
- end
-
- @@definitions = [
- ["interchange", -1],
- ["unknown", 0],
- ["coach", 1],
- ["air", 2],
- ["waterborne", 3],
- ["bus", 4],
- ["ferry", 5],
- ["walk", 6],
- ["metro", 7],
- ["shuttle", 8],
- ["rapid_transit", 9],
- ["taxi", 10],
- ["local_train", 11],
- ["train", 12],
- ["long_distance_train", 13],
- ["tramway", 14],
- ["trolleybus", 15],
- ["private_vehicle", 16],
- ["bicycle", 17],
- ["other", 18]
- ]
- cattr_reader :definitions
-
- @@all = nil
- def self.all
- @@all ||= definitions.collect do |text_code, numerical_code|
- new(text_code, numerical_code)
- end
- end
-
- def public_transport?
- not interchange?
- end
-
-end
diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb
index f574afc93..e534d2bde 100644
--- a/app/models/chouette/vehicle_journey.rb
+++ b/app/models/chouette/vehicle_journey.rb
@@ -2,7 +2,7 @@ module Chouette
class VehicleJourney < TridentActiveRecord
include ChecksumSupport
include VehicleJourneyRestrictions
- include StifTransportModeEnumerations
+ extend StifTransportModeEnumerations
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
diff --git a/app/models/compliance_check.rb b/app/models/compliance_check.rb
index 85cf5e37e..55f2ae228 100644
--- a/app/models/compliance_check.rb
+++ b/app/models/compliance_check.rb
@@ -1,9 +1,14 @@
class ComplianceCheck < ActiveRecord::Base
+
+ self.inheritance_column = nil
+
+ extend Enumerize
belongs_to :compliance_check_set
belongs_to :compliance_check_block
-
- enum criticity: [:info, :warning, :error]
+
+ enumerize :criticity, in: %i(warning error), scope: true, default: :warning
validates :criticity, presence: true
validates :name, presence: true
validates :code, presence: true
+ validates :origin_code, presence: true
end
diff --git a/app/models/compliance_check_block.rb b/app/models/compliance_check_block.rb
index 035c03ed9..ee60a8bb1 100644
--- a/app/models/compliance_check_block.rb
+++ b/app/models/compliance_check_block.rb
@@ -1,3 +1,5 @@
class ComplianceCheckBlock < ActiveRecord::Base
belongs_to :compliance_check_set
+
+ has_many :compliance_checks
end
diff --git a/app/models/compliance_check_message.rb b/app/models/compliance_check_message.rb
index 86899eb15..738bd4a4b 100644
--- a/app/models/compliance_check_message.rb
+++ b/app/models/compliance_check_message.rb
@@ -1,4 +1,11 @@
class ComplianceCheckMessage < ActiveRecord::Base
+ extend Enumerize
+
+ belongs_to :compliance_check_set
belongs_to :compliance_check
belongs_to :compliance_check_resource
+
+ enumerize :status, in: %i(OK ERROR WARNING IGNORED), scope: true
+
+ validates_presence_of :compliance_check_set
end
diff --git a/app/models/compliance_check_resource.rb b/app/models/compliance_check_resource.rb
index 7826f00c3..2989bf3cf 100644
--- a/app/models/compliance_check_resource.rb
+++ b/app/models/compliance_check_resource.rb
@@ -1,5 +1,9 @@
class ComplianceCheckResource < ActiveRecord::Base
extend Enumerize
- enumerize :status, in: %w[new successful warning failed]
+ belongs_to :compliance_check_set
+
+ enumerize :status, in: %i(OK ERROR WARNING IGNORED), scope: true
+
+ validates_presence_of :compliance_check_set
end
diff --git a/app/models/compliance_check_set.rb b/app/models/compliance_check_set.rb
index 7b6400a21..536afc705 100644
--- a/app/models/compliance_check_set.rb
+++ b/app/models/compliance_check_set.rb
@@ -6,5 +6,16 @@ class ComplianceCheckSet < ActiveRecord::Base
belongs_to :workbench
belongs_to :parent, polymorphic: true
+ has_many :compliance_check_blocks
+ has_many :compliance_checks
+
+ has_many :compliance_check_resources
+ has_many :compliance_check_messages
+
enumerize :status, in: %w[new pending successful warning failed running aborted canceled]
+
+ scope :where_created_at_between, ->(period_range) do
+ where('created_at BETWEEN :begin AND :end', begin: period_range.begin, end: period_range.end)
+ end
+
end
diff --git a/app/models/compliance_control.rb b/app/models/compliance_control.rb
index 12ff4737a..baf491e8a 100644
--- a/app/models/compliance_control.rb
+++ b/app/models/compliance_control.rb
@@ -1,12 +1,80 @@
class ComplianceControl < ActiveRecord::Base
+ extend Enumerize
belongs_to :compliance_control_set
belongs_to :compliance_control_block
- extend Enumerize
- enumerize :criticity, in: %i(info warning error), scope: true, default: :info
+ enumerize :criticity, in: %i(warning error), scope: true, default: :warning
+ hstore_accessor :control_attributes, {}
validates :criticity, presence: true
validates :name, presence: true
- validates :code, presence: true
+ validates :code, presence: true, uniqueness: { scope: :compliance_control_set }
+ validates :origin_code, presence: true
validates :compliance_control_set, presence: true
+
+ validate def coherent_control_set
+ return true if compliance_control_block_id.nil?
+ ids = [compliance_control_block.compliance_control_set_id, compliance_control_set_id]
+ return true if ids.first == ids.last
+ names = ids.map{|id| ComplianceControlSet.find(id).name}
+ errors.add(:coherent_control_set,
+ I18n.t('compliance_controls.errors.incoherent_control_sets',
+ indirect_set_name: names.first,
+ direct_set_name: names.last))
+ end
+
+ class << self
+ def default_criticity; :warning end
+ def default_code; "" end
+ def dynamic_attributes
+ hstore_metadata_for_control_attributes.keys
+ end
+
+ def policy_class
+ ComplianceControlPolicy
+ end
+
+ def inherited(child)
+ child.instance_eval do
+ def model_name
+ ComplianceControl.model_name
+ end
+ end
+ super
+ end
+ end
+
+ def initialize(attributes = {})
+ super
+ self.name ||= I18n.t("activerecord.models.#{self.class.name.underscore}.one")
+ self.code ||= self.class.default_code
+ self.origin_code ||= self.class.default_code
+ end
+
end
+
+# Ensure STI subclasses are loaded
+# http://guides.rubyonrails.org/autoloading_and_reloading_constants.html#autoloading-and-sti
+require_dependency 'generic_attribute_control/min_max'
+require_dependency 'generic_attribute_control/pattern'
+require_dependency 'generic_attribute_control/uniqueness'
+require_dependency 'journey_pattern_control/duplicates'
+require_dependency 'journey_pattern_control/vehicle_journey'
+require_dependency 'line_control/route'
+require_dependency 'route_control/duplicates'
+require_dependency 'route_control/journey_pattern'
+require_dependency 'route_control/minimum_length'
+require_dependency 'route_control/omnibus_journey_pattern'
+require_dependency 'route_control/opposite_route_terminus'
+require_dependency 'route_control/opposite_route'
+require_dependency 'route_control/stop_points_in_journey_pattern'
+require_dependency 'route_control/unactivated_stop_points'
+require_dependency 'route_control/zdl_stop_area'
+require_dependency 'routing_constraint_zone_control/maximum_length'
+require_dependency 'routing_constraint_zone_control/minimum_length'
+require_dependency 'routing_constraint_zone_control/unactivated_stop_point'
+require_dependency 'vehicle_journey_control/delta'
+require_dependency 'vehicle_journey_control/waiting_time'
+require_dependency 'vehicle_journey_control/speed'
+require_dependency 'vehicle_journey_control/time_table'
+require_dependency 'vehicle_journey_control/vehicle_journey_at_stops'
diff --git a/app/models/compliance_control_block.rb b/app/models/compliance_control_block.rb
index cf5a9d72b..5721c00f4 100644
--- a/app/models/compliance_control_block.rb
+++ b/app/models/compliance_control_block.rb
@@ -1,3 +1,15 @@
class ComplianceControlBlock < ActiveRecord::Base
+ extend StifTransportModeEnumerations
+ extend StifTransportSubmodeEnumerations
+
belongs_to :compliance_control_set
+ has_many :compliance_controls, dependent: :destroy
+
+ hstore_accessor :condition_attributes,
+ transport_mode: :string,
+ transport_submode: :string
+
+ validates :transport_mode, presence: true
+ validates :compliance_control_set, presence: true
+
end
diff --git a/app/models/compliance_control_set.rb b/app/models/compliance_control_set.rb
index cefdfbf1f..deb46f5a1 100644
--- a/app/models/compliance_control_set.rb
+++ b/app/models/compliance_control_set.rb
@@ -1,7 +1,12 @@
class ComplianceControlSet < ActiveRecord::Base
belongs_to :organisation
- has_many :compliance_controls
+ has_many :compliance_control_blocks, dependent: :destroy
+ has_many :compliance_controls, dependent: :destroy
validates :name, presence: true
+ validates :organisation, presence: true
+ scope :where_updated_at_between, ->(period_range) do
+ where('updated_at BETWEEN :begin AND :end', begin: period_range.begin, end: period_range.end)
+ end
end
diff --git a/app/models/concerns/min_max_values_validation.rb b/app/models/concerns/min_max_values_validation.rb
new file mode 100644
index 000000000..c177e55ca
--- /dev/null
+++ b/app/models/concerns/min_max_values_validation.rb
@@ -0,0 +1,13 @@
+module MinMaxValuesValidation
+ extend ActiveSupport::Concern
+
+ included do
+ validate :min_max_values_validation
+ end
+
+ def min_max_values_validation
+ return true unless minimum && maximum
+ return true unless maximum < minimum
+ errors.add(:min_max_values, I18n.t('compliance_controls.min_max_values', min: minimum, max: maximum))
+ end
+end
diff --git a/app/models/concerns/stif_netex_attributes_support.rb b/app/models/concerns/stif_netex_attributes_support.rb
index 0d569b613..076acf491 100644
--- a/app/models/concerns/stif_netex_attributes_support.rb
+++ b/app/models/concerns/stif_netex_attributes_support.rb
@@ -49,7 +49,7 @@ module StifNetexAttributesSupport
end
def provider_id
- self.referential.workbench.organisation.name.parameterize.underscore
+ self.referential.workbench.organisation.code.underscore.parameterize
end
def boiv_id
diff --git a/app/models/concerns/stif_transport_mode_enumerations.rb b/app/models/concerns/stif_transport_mode_enumerations.rb
new file mode 100644
index 000000000..68d481735
--- /dev/null
+++ b/app/models/concerns/stif_transport_mode_enumerations.rb
@@ -0,0 +1,18 @@
+module StifTransportModeEnumerations
+ extend ActiveSupport::Concern
+ extend Enumerize
+ extend self
+
+ enumerize :transport_mode, in: %w(bus
+ metro
+ rail
+ tram)
+
+ def transport_modes
+ StifTransportModeEnumerations.transport_mode.values
+ end
+
+ def sorted_transport_modes
+ self.transport_modes.sort_by{|m| I18n.t("enumerize.transport_mode.#{m}").parameterize }
+ end
+end
diff --git a/app/models/concerns/stif_transport_submode_enumerations.rb b/app/models/concerns/stif_transport_submode_enumerations.rb
new file mode 100644
index 000000000..cf314badd
--- /dev/null
+++ b/app/models/concerns/stif_transport_submode_enumerations.rb
@@ -0,0 +1,24 @@
+module StifTransportSubmodeEnumerations
+ extend ActiveSupport::Concern
+ extend Enumerize
+ extend self
+
+ enumerize :transport_submode, in: %w(demandAndResponseBus
+ nightBus
+ airportLinkBus
+ highFrequencyBus
+ expressBus
+ railShuttle
+ suburbanRailway
+ regionalRail
+ interregionalRail
+)
+
+ def transport_submodes
+ StifTransportSubmodeEnumerations.transport_submode.values
+ end
+
+ def sorted_transport_submodes
+ self.transport_submodes.sort_by{|m| I18n.t("enumerize.transport_submode.#{m}").parameterize }
+ end
+end
diff --git a/app/models/dashboard.rb b/app/models/dashboard.rb
new file mode 100644
index 000000000..a53267db5
--- /dev/null
+++ b/app/models/dashboard.rb
@@ -0,0 +1,27 @@
+#
+# The default Dashboard implementation can be customized in an initializer :
+#
+# Rails.application.config.to_prepare do
+# Dashboard.default_class = Custom::Dashboard
+# end
+#
+class Dashboard
+ include ActiveModel::Conversion
+
+ @@default_class = self
+ mattr_accessor :default_class
+
+ attr_reader :context
+
+ def initialize(context)
+ @context = context
+ end
+
+ def self.create(context)
+ default_class.new context
+ end
+
+ def current_organisation
+ context.send(:current_organisation)
+ end
+end
diff --git a/app/models/generic_attribute_control/min_max.rb b/app/models/generic_attribute_control/min_max.rb
new file mode 100644
index 000000000..a83ab64ab
--- /dev/null
+++ b/app/models/generic_attribute_control/min_max.rb
@@ -0,0 +1,16 @@
+module GenericAttributeControl
+ class MinMax < ComplianceControl
+ hstore_accessor :control_attributes, minimum: :integer, maximum: :integer, target: :string
+
+ validates :minimum, numericality: true, allow_nil: true
+ validates :maximum, numericality: true, allow_nil: true
+ validates :target, presence: true
+ include MinMaxValuesValidation
+
+ class << self
+ def attribute_type; :integer end
+ def default_criticity; :warning end
+ def default_code; "3-Generic-2" end
+ end
+ end
+end
diff --git a/app/models/generic_attribute_control/pattern.rb b/app/models/generic_attribute_control/pattern.rb
new file mode 100644
index 000000000..027d6948e
--- /dev/null
+++ b/app/models/generic_attribute_control/pattern.rb
@@ -0,0 +1,14 @@
+module GenericAttributeControl
+ class Pattern < ComplianceControl
+ hstore_accessor :control_attributes, pattern: :string, target: :string
+
+ validates :target, presence: true
+ validates :pattern, presence: true
+
+ class << self
+ def attribute_type; :string end
+ def default_criticity; :warning end
+ def default_code; "3-Generic-1" end
+ end
+ end
+end
diff --git a/app/models/generic_attribute_control/uniqueness.rb b/app/models/generic_attribute_control/uniqueness.rb
new file mode 100644
index 000000000..36a270d74
--- /dev/null
+++ b/app/models/generic_attribute_control/uniqueness.rb
@@ -0,0 +1,13 @@
+module GenericAttributeControl
+ class Uniqueness < ComplianceControl
+ hstore_accessor :control_attributes, target: :string
+
+ validates :target, presence: true
+
+ class << self
+ def attribute_type; :string end
+ def default_criticity; :warning end
+ def default_code; "3-Generic-3" end
+ end
+ end
+end
diff --git a/app/models/generic_attribute_min_max.rb b/app/models/generic_attribute_min_max.rb
deleted file mode 100644
index e9a127c56..000000000
--- a/app/models/generic_attribute_min_max.rb
+++ /dev/null
@@ -1,27 +0,0 @@
-#module ComplianceControls
-
- class GenericAttributeMinMax < ComplianceControl
-
-
- hstore_accessor :control_attributes, minimum: :integer, maximum: :integer
- #attribute :minimum, type: :integer, optionnal: true
- #attribute :maximum, type: :integer, optionnal: true
- # #attribute :target, type: ModelAttribute
-
- @@default_criticity = :warning
- @@default_code = "3-Generic-2"
-
- validate :min_max_values
- def min_max_values
- true
- end
-
- after_initialize do
- self.name = 'GenericAttributeMinMax'
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
-
- end
-
-#end
diff --git a/app/models/generic_attribute_pattern.rb b/app/models/generic_attribute_pattern.rb
deleted file mode 100644
index 0043f1563..000000000
--- a/app/models/generic_attribute_pattern.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-#module ComplianceControls
-
- class GenericAttributePattern < ComplianceControl
-
- hstore_accessor :control_attributes, value: :string, pattern: :string
-
- @@default_criticity = :warning
- @@default_code = "3-Generic-3"
-
- validate :pattern_match
- def pattern_match
- true
- end
-
- after_initialize do
- self.name = 'GenericAttributeMinMax'
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
-
- end
-
-#end \ No newline at end of file
diff --git a/app/models/generic_attribute_uniqueness.rb b/app/models/generic_attribute_uniqueness.rb
deleted file mode 100644
index dcf4a16c2..000000000
--- a/app/models/generic_attribute_uniqueness.rb
+++ /dev/null
@@ -1,23 +0,0 @@
-#module ComplianceControls
-
- class GenericAttributeUniqueness < ComplianceControl
-
- hstore_accessor :control_attributes, name: :string
-
- @@default_criticity = :warning
- @@default_code = "3-Generic-3"
-
- validate :unique_values
- def unique_values
- true
- end
-
- after_initialize do
- self.name = 'GenericAttributeMinMax'
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
-
- end
-
-#end \ No newline at end of file
diff --git a/app/models/import.rb b/app/models/import.rb
index 74f7ef10c..64f713914 100644
--- a/app/models/import.rb
+++ b/app/models/import.rb
@@ -9,8 +9,8 @@ class Import < ActiveRecord::Base
has_many :resources, class_name: "ImportResource", dependent: :destroy
has_many :children, foreign_key: :parent_id, class_name: "Import", dependent: :destroy
- scope :where_started_at_between, ->(start_date, end_date) do
- where('started_at BETWEEN ? AND ?', start_date, end_date)
+ scope :where_started_at_in, ->(period_range) do
+ where('started_at BETWEEN :begin AND :end', begin: period_range.begin, end: period_range.end)
end
extend Enumerize
diff --git a/app/models/journey_pattern_control/duplicates.rb b/app/models/journey_pattern_control/duplicates.rb
index 78ca07e90..e06e6021b 100644
--- a/app/models/journey_pattern_control/duplicates.rb
+++ b/app/models/journey_pattern_control/duplicates.rb
@@ -1,13 +1,6 @@
module JourneyPatternControl
class Duplicates < ComplianceControl
- @@default_criticity = :warning
- @@default_code = "3-JourneyPattern-1"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
+ def self.default_code; "3-JourneyPattern-1" end
end
end
diff --git a/app/models/journey_pattern_control/vehicle_journey.rb b/app/models/journey_pattern_control/vehicle_journey.rb
index a90c16138..dfaf42beb 100644
--- a/app/models/journey_pattern_control/vehicle_journey.rb
+++ b/app/models/journey_pattern_control/vehicle_journey.rb
@@ -1,13 +1,6 @@
module JourneyPatternControl
class VehicleJourney < ComplianceControl
- @@default_criticity = :warning
- @@default_code = "3-JourneyPattern-2"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
+ def self.default_code; "3-JourneyPattern-2" end
end
-end \ No newline at end of file
+end
diff --git a/app/models/line_control/route.rb b/app/models/line_control/route.rb
index 8ac13a080..aabd2f347 100644
--- a/app/models/line_control/route.rb
+++ b/app/models/line_control/route.rb
@@ -1,13 +1,6 @@
module LineControl
class Route < ComplianceControl
- @@default_criticity = :warning
- @@default_code = "3-Line-1"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
+ def self.default_code; "3-Line-1" end
end
-end \ No newline at end of file
+end
diff --git a/app/models/line_referential.rb b/app/models/line_referential.rb
index 8bbc32993..8bc6adec3 100644
--- a/app/models/line_referential.rb
+++ b/app/models/line_referential.rb
@@ -1,4 +1,6 @@
class LineReferential < ActiveRecord::Base
+ extend StifTransportModeEnumerations
+
has_many :line_referential_memberships
has_many :organisations, through: :line_referential_memberships
has_many :lines, class_name: 'Chouette::Line'
@@ -25,8 +27,4 @@ class LineReferential < ActiveRecord::Base
def last_sync
line_referential_syncs.last
end
-
- def transport_modes
- Chouette::TransportMode.all.select { |tm| tm.to_i > 0 }
- end
end
diff --git a/app/models/organisation.rb b/app/models/organisation.rb
index ba65ad375..6104b4431 100644
--- a/app/models/organisation.rb
+++ b/app/models/organisation.rb
@@ -3,7 +3,7 @@ class Organisation < ActiveRecord::Base
has_many :users, :dependent => :destroy
has_many :referentials, :dependent => :destroy
- has_many :rule_parameter_sets, :dependent => :destroy
+ # has_many :rule_parameter_sets, :dependent => :destroy
has_many :compliance_control_sets, :dependent => :destroy
has_many :stop_area_referential_memberships
@@ -19,11 +19,11 @@ class Organisation < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :code
- after_create :add_rule_parameter_set
+ # after_create :add_rule_parameter_set
- def add_rule_parameter_set
- RuleParameterSet.default_for_all_modes( self).save
- end
+ # def add_rule_parameter_set
+ # RuleParameterSet.default_for_all_modes( self).save
+ # end
def self.portail_api_request
conf = Rails.application.config.try(:stif_portail_api)
diff --git a/app/models/route_control/duplicates.rb b/app/models/route_control/duplicates.rb
index 379d7cf98..99e3b3aa8 100644
--- a/app/models/route_control/duplicates.rb
+++ b/app/models/route_control/duplicates.rb
@@ -1,13 +1,6 @@
module RouteControl
class Duplicates < ComplianceControl
- @@default_criticity = :warning
- @@default_code = "3-Route-4"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
+ def self.default_code; "3-Route-4" end
end
end
diff --git a/app/models/route_control/journey_pattern.rb b/app/models/route_control/journey_pattern.rb
index 0559fac42..63cec2a41 100644
--- a/app/models/route_control/journey_pattern.rb
+++ b/app/models/route_control/journey_pattern.rb
@@ -1,13 +1,6 @@
module RouteControl
class JourneyPattern < ComplianceControl
- @@default_criticity = :warning
- @@default_code = "3-Route-3"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
+ def self.default_code; "3-Route-3" end
end
-end \ No newline at end of file
+end
diff --git a/app/models/route_control/minimum_length.rb b/app/models/route_control/minimum_length.rb
index 14bc7064f..56becfb2b 100644
--- a/app/models/route_control/minimum_length.rb
+++ b/app/models/route_control/minimum_length.rb
@@ -1,13 +1,6 @@
module RouteControl
class MinimumLength < ComplianceControl
- @@default_criticity = :error
- @@default_code = "3-Route-6"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
+ def self.default_code; "3-Route-6" end
end
end
diff --git a/app/models/route_control/omnibus_journey_pattern.rb b/app/models/route_control/omnibus_journey_pattern.rb
index 2f09ff735..af3004ad7 100644
--- a/app/models/route_control/omnibus_journey_pattern.rb
+++ b/app/models/route_control/omnibus_journey_pattern.rb
@@ -1,13 +1,6 @@
module RouteControl
class OmnibusJourneyPattern < ComplianceControl
- @@default_criticity = :warning
- @@default_code = "3-Route-9"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
+ def self.default_code; "3-Route-9" end
end
end
diff --git a/app/models/route_control/opposite_route.rb b/app/models/route_control/opposite_route.rb
index d5f2bc59e..0148087ca 100644
--- a/app/models/route_control/opposite_route.rb
+++ b/app/models/route_control/opposite_route.rb
@@ -1,14 +1,6 @@
module RouteControl
class OppositeRoute < ComplianceControl
- @@default_criticity = :error
- @@default_code = "3-Route-2"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
-
+ def self.default_code; "3-Route-2" end
end
end
diff --git a/app/models/route_control/opposite_route_terminus.rb b/app/models/route_control/opposite_route_terminus.rb
index e72229ca3..e12690d48 100644
--- a/app/models/route_control/opposite_route_terminus.rb
+++ b/app/models/route_control/opposite_route_terminus.rb
@@ -1,13 +1,6 @@
module RouteControl
class OppositeRouteTerminus < ComplianceControl
- @@default_criticity = :warning
- @@default_code = "3-Route-5"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
+ def self.default_code; "3-Route-5" end
end
-end \ No newline at end of file
+end
diff --git a/app/models/route_control/speed.rb b/app/models/route_control/speed.rb
deleted file mode 100644
index fb07b5c87..000000000
--- a/app/models/route_control/speed.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-module VehicleJourneyControl
- class Speed < ComplianceControl
-
- hstore_accessor :control_attributes, minimum: :integer, maximum: :integer
-
- @@default_criticity = :warning
- @@default_code = "3-VehicleJourney-2"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
- end
-end
diff --git a/app/models/route_control/stop_points_in_journey_pattern.rb b/app/models/route_control/stop_points_in_journey_pattern.rb
index 195257a4a..c0c13e65a 100644
--- a/app/models/route_control/stop_points_in_journey_pattern.rb
+++ b/app/models/route_control/stop_points_in_journey_pattern.rb
@@ -1,13 +1,6 @@
module RouteControl
- class StopPointInJourneyPattern < ComplianceControl
+ class StopPointsInJourneyPattern < ComplianceControl
- @@default_criticity = :error
- @@default_code = "3-Route-6"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
+ def self.default_code; "3-Route-8" end
end
end
diff --git a/app/models/route_control/time_table.rb b/app/models/route_control/time_table.rb
deleted file mode 100644
index 911807ba9..000000000
--- a/app/models/route_control/time_table.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module VehicleJourneyControl
- class TimeTable < ComplianceControl
-
- @@default_criticity = :error
- @@default_code = "3-VehicleJourney-4"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
- end
-end
diff --git a/app/models/route_control/unactivated_stop_points.rb b/app/models/route_control/unactivated_stop_points.rb
index 8ab680490..a903fff53 100644
--- a/app/models/route_control/unactivated_stop_points.rb
+++ b/app/models/route_control/unactivated_stop_points.rb
@@ -1,13 +1,6 @@
module RouteControl
- class UnactivatedStopPoint < ComplianceControl
+ class UnactivatedStopPoints < ComplianceControl
- @@default_criticity = :warning
- @@default_code = "3-Route-10"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
+ def self.default_code; "3-Route-10" end
end
end
diff --git a/app/models/route_control/vehicle_journey_at_stops.rb b/app/models/route_control/vehicle_journey_at_stops.rb
deleted file mode 100644
index 02a43fb10..000000000
--- a/app/models/route_control/vehicle_journey_at_stops.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module VehicleJourneyControl
- class VehicleJourneyAtStops < ComplianceControl
-
- @@default_criticity = :error
- @@default_code = "3-VehicleJourney-5"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
- end
-end
diff --git a/app/models/route_control/zdl_stop_area.rb b/app/models/route_control/zdl_stop_area.rb
index 4561c9b2e..2efd892df 100644
--- a/app/models/route_control/zdl_stop_area.rb
+++ b/app/models/route_control/zdl_stop_area.rb
@@ -1,13 +1,6 @@
module RouteControl
class ZDLStopArea < ComplianceControl
- @@default_criticity = :warning
- @@default_code = "3-Route-1"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
+ def self.default_code; "3-Route-1" end
end
end
diff --git a/app/models/routing_constaint_zone_control/maximum_length.rb b/app/models/routing_constaint_zone_control/maximum_length.rb
deleted file mode 100644
index fd63ffeda..000000000
--- a/app/models/routing_constaint_zone_control/maximum_length.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module RoutingConstaintZoneControl
- class MaximumLength < ComplianceControl
-
- @@default_criticity = :warning
- @@default_code = "3-ITL-2"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
- end
-end \ No newline at end of file
diff --git a/app/models/routing_constaint_zone_control/minimum_length.rb b/app/models/routing_constaint_zone_control/minimum_length.rb
deleted file mode 100644
index c17bbc834..000000000
--- a/app/models/routing_constaint_zone_control/minimum_length.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module RoutingConstaintZoneControl
- class MinimumLength < ComplianceControl
-
- @@default_criticity = :warning
- @@default_code = "3-ITL-3"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
- end
-end \ No newline at end of file
diff --git a/app/models/routing_constaint_zone_control/unactivated_stop_point.rb b/app/models/routing_constaint_zone_control/unactivated_stop_point.rb
deleted file mode 100644
index 92a1d1a58..000000000
--- a/app/models/routing_constaint_zone_control/unactivated_stop_point.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module RoutingConstaintZoneControl
- class UnactivatedStopPoint < ComplianceControl
-
- @@default_criticity = :warning
- @@default_code = "3-ITL-1"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
- end
-end
diff --git a/app/models/routing_constraint_zone_control/maximum_length.rb b/app/models/routing_constraint_zone_control/maximum_length.rb
new file mode 100644
index 000000000..6b726e38c
--- /dev/null
+++ b/app/models/routing_constraint_zone_control/maximum_length.rb
@@ -0,0 +1,6 @@
+module RoutingConstraintZoneControl
+ class MaximumLength < ComplianceControl
+
+ def self.default_code; "3-ITL-2" end
+ end
+end
diff --git a/app/models/routing_constraint_zone_control/minimum_length.rb b/app/models/routing_constraint_zone_control/minimum_length.rb
new file mode 100644
index 000000000..38f583bc5
--- /dev/null
+++ b/app/models/routing_constraint_zone_control/minimum_length.rb
@@ -0,0 +1,6 @@
+module RoutingConstraintZoneControl
+ class MinimumLength < ComplianceControl
+
+ def self.default_code; "3-ITL-3" end
+ end
+end
diff --git a/app/models/routing_constraint_zone_control/unactivated_stop_point.rb b/app/models/routing_constraint_zone_control/unactivated_stop_point.rb
new file mode 100644
index 000000000..c03bb2324
--- /dev/null
+++ b/app/models/routing_constraint_zone_control/unactivated_stop_point.rb
@@ -0,0 +1,6 @@
+module RoutingConstraintZoneControl
+ class UnactivatedStopPoint < ComplianceControl
+
+ def self.default_code; "3-ITL-1" end
+ end
+end
diff --git a/app/models/rule_parameter_set.rb b/app/models/rule_parameter_set.rb
index db78a2f8a..91e575822 100644
--- a/app/models/rule_parameter_set.rb
+++ b/app/models/rule_parameter_set.rb
@@ -65,7 +65,26 @@ class RuleParameterSet < ActiveRecord::Base
end
def self.all_modes
- Chouette::TransportMode.all.map { |m| m.to_s}
+ ["interchange",
+ "unknown",
+ "coach",
+ "air",
+ "waterborne",
+ "bus",
+ "ferry",
+ "walk",
+ "metro",
+ "shuttle",
+ "rapid_transit",
+ "taxi",
+ "local_train",
+ "train",
+ "long_distance_train",
+ "tramway",
+ "trolleybus",
+ "private_vehicle",
+ "bicycle",
+ "other"]
end
def self.mode_attribute?( method_name )
diff --git a/app/models/stif_transport_mode_enumerations.rb b/app/models/stif_transport_mode_enumerations.rb
deleted file mode 100644
index a9a3fc3e0..000000000
--- a/app/models/stif_transport_mode_enumerations.rb
+++ /dev/null
@@ -1,5 +0,0 @@
-module StifTransportModeEnumerations
- extend Enumerize
-
- enumerize :transport_mode, in: %w(air bus coach ferry metro rail trolleyBus tram water cableway funicular other)
-end
diff --git a/app/models/vechicle_journey_control/delta.rb b/app/models/vechicle_journey_control/delta.rb
deleted file mode 100644
index d4e1e6eca..000000000
--- a/app/models/vechicle_journey_control/delta.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-module VehicleJourneyControl
- class Delta < ComplianceControl
-
- hstore_accessor :control_attributes, delta: :integer
-
- @@default_criticity = :warning
- @@default_code = "3-VehicleJourney-3"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
- end
-end
diff --git a/app/models/vechicle_journey_control/waiting_time.rb b/app/models/vechicle_journey_control/waiting_time.rb
deleted file mode 100644
index a7e90b6ac..000000000
--- a/app/models/vechicle_journey_control/waiting_time.rb
+++ /dev/null
@@ -1,13 +0,0 @@
-module VehicleJourneyControl
- class WatingTime < ComplianceControl
-
- @@default_criticity = :warning
- @@default_code = "3-VehicleJourney-1"
-
- after_initialize do
- self.name = self.class.name
- self.code = @@default_code
- self.criticity = @@default_criticity
- end
- end
-end
diff --git a/app/models/vehicle_journey_control/delta.rb b/app/models/vehicle_journey_control/delta.rb
new file mode 100644
index 000000000..1f3a4d492
--- /dev/null
+++ b/app/models/vehicle_journey_control/delta.rb
@@ -0,0 +1,10 @@
+module VehicleJourneyControl
+ class Delta < ComplianceControl
+
+ hstore_accessor :control_attributes, maximum: :integer
+
+ validates :maximum, numericality: true, allow_nil: true
+
+ def self.default_code; "3-VehicleJourney-3" end
+ end
+end
diff --git a/app/models/vehicle_journey_control/speed.rb b/app/models/vehicle_journey_control/speed.rb
new file mode 100644
index 000000000..be9f838e4
--- /dev/null
+++ b/app/models/vehicle_journey_control/speed.rb
@@ -0,0 +1,11 @@
+module VehicleJourneyControl
+ class Speed < ComplianceControl
+ hstore_accessor :control_attributes, minimum: :integer, maximum: :integer
+
+ validates :minimum, numericality: true, allow_nil: true
+ validates :maximum, numericality: true, allow_nil: true
+ include MinMaxValuesValidation
+
+ def self.default_code; "3-VehicleJourney-2" end
+ end
+end
diff --git a/app/models/vehicle_journey_control/time_table.rb b/app/models/vehicle_journey_control/time_table.rb
new file mode 100644
index 000000000..617ead12b
--- /dev/null
+++ b/app/models/vehicle_journey_control/time_table.rb
@@ -0,0 +1,6 @@
+module VehicleJourneyControl
+ class TimeTable < ComplianceControl
+
+ def self.default_code; "3-VehicleJourney-4" end
+ end
+end
diff --git a/app/models/vehicle_journey_control/vehicle_journey_at_stops.rb b/app/models/vehicle_journey_control/vehicle_journey_at_stops.rb
new file mode 100644
index 000000000..47ee26f82
--- /dev/null
+++ b/app/models/vehicle_journey_control/vehicle_journey_at_stops.rb
@@ -0,0 +1,6 @@
+module VehicleJourneyControl
+ class VehicleJourneyAtStops < ComplianceControl
+
+ def self.default_code; "3-VehicleJourney-5" end
+ end
+end
diff --git a/app/models/vehicle_journey_control/waiting_time.rb b/app/models/vehicle_journey_control/waiting_time.rb
new file mode 100644
index 000000000..68fccb5c1
--- /dev/null
+++ b/app/models/vehicle_journey_control/waiting_time.rb
@@ -0,0 +1,9 @@
+module VehicleJourneyControl
+ class WaitingTime < ComplianceControl
+ hstore_accessor :control_attributes, maximum: :integer
+
+ validates :maximum, numericality: true, allow_nil: true
+
+ def self.default_code; "3-VehicleJourney-1" end
+ end
+end
diff --git a/app/models/vehicle_journey_import.rb b/app/models/vehicle_journey_import.rb
index 44a6d457e..250f3a9e9 100644
--- a/app/models/vehicle_journey_import.rb
+++ b/app/models/vehicle_journey_import.rb
@@ -1,5 +1,3 @@
-# -*- coding: utf-8 -*-
-
class VehicleJourneyImport
include ActiveModel::Validations
include ActiveModel::Conversion
diff --git a/app/models/workbench.rb b/app/models/workbench.rb
index 30692e625..c304e8ba9 100644
--- a/app/models/workbench.rb
+++ b/app/models/workbench.rb
@@ -2,6 +2,7 @@ class Workbench < ActiveRecord::Base
belongs_to :organisation
belongs_to :line_referential
belongs_to :stop_area_referential
+ belongs_to :output, class_name: 'ReferentialSuite'
has_many :lines, -> (workbench) { Stif::MyWorkbenchScopes.new(workbench).line_scope(self) }, through: :line_referential
has_many :networks, through: :line_referential
@@ -10,13 +11,18 @@ class Workbench < ActiveRecord::Base
has_many :stop_areas, through: :stop_area_referential
has_many :imports
has_many :workbench_imports
+ has_many :compliance_check_sets
+ has_many :compliance_control_sets
validates :name, presence: true
validates :organisation, presence: true
+ validates :output, presence: true
has_many :referentials
has_many :referential_metadatas, through: :referentials, source: :metadatas
+ before_validation :initialize_output
+
def all_referentials
if line_ids.empty?
@@ -26,4 +32,12 @@ class Workbench < ActiveRecord::Base
end
end
+ private
+
+ def initialize_output
+ # Don't reset `output` if it's already initialised
+ return if !output.nil?
+
+ self.output = ReferentialSuite.create
+ end
end
diff --git a/app/policies/compliance_check_set_policy.rb b/app/policies/compliance_check_set_policy.rb
new file mode 100644
index 000000000..3f715649e
--- /dev/null
+++ b/app/policies/compliance_check_set_policy.rb
@@ -0,0 +1,7 @@
+class ComplianceCheckSetPolicy < ApplicationPolicy
+ class Scope < Scope
+ def resolve
+ scope
+ end
+ end
+end
diff --git a/app/policies/compliance_control_policy.rb b/app/policies/compliance_control_policy.rb
index fbea366f5..09250f013 100644
--- a/app/policies/compliance_control_policy.rb
+++ b/app/policies/compliance_control_policy.rb
@@ -6,14 +6,17 @@ class ComplianceControlPolicy < ApplicationPolicy
end
def destroy?
- user.has_permission?('compliance_controls.destroy')
+ # user.has_permission?('compliance_controls.destroy')
+ true
end
def create?
- user.has_permission?('compliance_controls.create')
+ # user.has_permission?('compliance_controls.create')
+ true
end
def update?
- user.has_permission?('compliance_controls.update')
+ # user.has_permission?('compliance_controls.update')
+ true
end
end
diff --git a/app/policies/import_policy.rb b/app/policies/import_policy.rb
index 9e1d99a66..b12dcc167 100644
--- a/app/policies/import_policy.rb
+++ b/app/policies/import_policy.rb
@@ -4,4 +4,16 @@ class ImportPolicy < ApplicationPolicy
scope
end
end
+
+ def create?
+ !archived? && user.has_permission?('imports.create')
+ end
+
+ def destroy?
+ !archived? && user.has_permission?('imports.destroy')
+ end
+
+ def update?
+ !archived? && user.has_permission?('imports.update')
+ end
end
diff --git a/app/views/calendars/index.html.slim b/app/views/calendars/index.html.slim
index 24ed15484..d3168fa3d 100644
--- a/app/views/calendars/index.html.slim
+++ b/app/views/calendars/index.html.slim
@@ -49,4 +49,4 @@
.col-lg-12
= replacement_msg t('calendars.search_no_results')
-= javascript_include_tag 'filters/calendar.js'
+= javascript_pack_tag 'date_filters'
diff --git a/app/views/compliance_check_sets/_filters.html.slim b/app/views/compliance_check_sets/_filters.html.slim
new file mode 100644
index 000000000..3051bda64
--- /dev/null
+++ b/app/views/compliance_check_sets/_filters.html.slim
@@ -0,0 +1,23 @@
+= search_form_for @q_for_form, url: workbench_compliance_check_sets_path(@workbench), builder: SimpleForm::FormBuilder, class: 'form form-filter' do |f|
+ .ffg-row
+ .input-group.search_bar
+ = f.search_field :referential_name_cont, class: 'form-control', placeholder: t('compliance_check_sets.filters.name')
+ span.input-group-btn
+ button.btn.btn-default type='submit'
+ span.fa.fa-search
+
+ .ffg-row
+ .form-group.togglable
+ = f.label t('activerecord.attributes.compliance_check_set.assigned_to'), required: false, class: 'control-label'
+ = f.input :parent_type_eq_any, collection: ComplianceCheckSet.order('parent_type'), as: :check_boxes, label: false, label_method: lambda {|w| ("<span>#{w}</span>").html_safe}, required: false, wrapper_html: {class: 'checkbox_list'}
+
+ .form-group.togglable
+ = f.label Import.human_attribute_name(:created_at), required: false, class: 'control-label'
+ .filter_menu
+ = f.simple_fields_for :created_at do |p|
+ = p.input :start_date, as: :date, label: false, wrapper_html: {class: 'date smart_date filter_menu-item'}, default: @begin_range, include_blank: @begin_range ? false : true
+ = p.input :end_date, as: :date, label: false, wrapper_html: {class: 'date smart_date filter_menu-item'}, default: @end_range, include_blank: @end_range ? false : true
+
+ .actions
+ = link_to t('actions.erase'), @compliance_checks_sets, class: 'btn btn-link'
+ = f.submit t('actions.filter'), class: 'btn btn-default', id: 'compliance_check_set_filter_btn'
diff --git a/app/views/compliance_check_sets/index.html.slim b/app/views/compliance_check_sets/index.html.slim
new file mode 100644
index 000000000..38c4babcf
--- /dev/null
+++ b/app/views/compliance_check_sets/index.html.slim
@@ -0,0 +1,54 @@
+/ PageHeader
+- header_params = ['jeux-de-donnees',
+ t('compliance_check_sets.index.title'),
+ '']
+= pageheader(*header_params) do
+
+ / Below is secundary actions & optional contents (filters, ...)
+ .row.mb-sm
+ .col-lg-12.text-right
+
+/ PageContent
+.page_content
+ .container-fluid
+ .row
+ .col-lg-12
+ = render 'filters'
+ .row
+ .col-lg-12
+ .select_table
+ = table_builder_2 @compliance_check_sets,
+ [ \
+ TableBuilderHelper::Column.new( \
+ key: :ref, \
+ attribute: 'referential_id' \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :creation_date, \
+ attribute: Proc.new { |n| l(n.created_at, format: :long) if n.created_at } \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :associated_object, \
+ attribute: Proc.new{|n| n.referential.name}, \
+ link_to: lambda do |referential| \
+ referential_path(referential, current_workbench_id: params[:id]) \
+ end \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :assigned_to, \
+ attribute: 'parent_type' \
+ ), \
+ TableBuilderHelper::Column.new(\
+ key: :compliance_control_set, \
+ attribute: Proc.new{ |n| (n.compliance_control_set.name) if n.compliance_control_set} \
+ ), \
+ ],
+ sortable: true,
+ links: [:show],
+ cls: 'table has-filter has-search'
+ - unless @compliance_check_sets.any?
+ .row.mt-xs
+ .col-lg-12
+ = replacement_msg t('compliance_check_sets.search_no_results')
+
+
diff --git a/app/views/compliance_check_sets/show.html.slim b/app/views/compliance_check_sets/show.html.slim
new file mode 100644
index 000000000..4e965947d
--- /dev/null
+++ b/app/views/compliance_check_sets/show.html.slim
@@ -0,0 +1,11 @@
+/ PageHeader
+= pageheader 'jeux-de-donnees',
+ @compliance_check_set.referential.name
+/ PageContent
+.page_content
+ .container-fluid
+ .row
+ .col-lg-6.col-md-6.col-sm-12.col-xs-12
+ = definition_list t('metadatas'),
+ ComplianceCheckSet.human_attribute_name(:id) => @compliance_check_set.referential.id,
+ ComplianceCheckSet.human_attribute_name(:name) => @compliance_check_set.referential.name \ No newline at end of file
diff --git a/app/views/compliance_control_blocks/_form.html.slim b/app/views/compliance_control_blocks/_form.html.slim
new file mode 100644
index 000000000..2e87a877e
--- /dev/null
+++ b/app/views/compliance_control_blocks/_form.html.slim
@@ -0,0 +1,10 @@
+= simple_form_for [@compliance_control_set, @compliance_control_block], html: { class: 'form-horizontal', id: 'compliance_control_block_form' }, wrapper: :horizontal_form do |f|
+ .row
+ .col-lg-12
+ .form-group
+ = f.input :transport_mode, as: :select, collection: ComplianceControlBlock.sorted_transport_modes, label: t('activerecord.attributes.compliance_control_blocks.transport_mode'), label_method: lambda {|t| ("<span>" + t("enumerize.transport_mode.#{t}") + "</span>").html_safe }
+ = f.input :transport_submode, as: :select, collection: ComplianceControlBlock.sorted_transport_submodes, label: t('activerecord.attributes.compliance_control_blocks.transport_submode'), label_method: lambda {|t| ("<span>" + t("enumerize.transport_submode.#{t}") + "</span>").html_safe }
+
+ .separator
+
+ = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'compliance_control_block_form'
diff --git a/app/views/compliance_control_blocks/edit.html.slim b/app/views/compliance_control_blocks/edit.html.slim
new file mode 100644
index 000000000..0ac507ece
--- /dev/null
+++ b/app/views/compliance_control_blocks/edit.html.slim
@@ -0,0 +1,11 @@
+/ PageHeader
+= pageheader 'modele-calendrier',
+ t('compliance_control_blocks.edit.title', compliance_control_block: @compliance_control_block.id)
+
+
+/ PageContent
+.page_content
+ .container-fluid
+ .row
+ .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1
+ = render 'form' \ No newline at end of file
diff --git a/app/views/compliance_control_blocks/new.html.slim b/app/views/compliance_control_blocks/new.html.slim
new file mode 100644
index 000000000..654a0dc7f
--- /dev/null
+++ b/app/views/compliance_control_blocks/new.html.slim
@@ -0,0 +1,11 @@
+/ PageHeader
+= pageheader 'modele-calendrier',
+ t('compliance_control_blocks.new.title')
+
+
+/ PageContent
+.page_content
+ .container-fluid
+ .row
+ .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1
+ = render 'form' \ No newline at end of file
diff --git a/app/views/compliance_control_sets/_filters.html.slim b/app/views/compliance_control_sets/_filters.html.slim
index 587f74ce4..6a5d3ac44 100644
--- a/app/views/compliance_control_sets/_filters.html.slim
+++ b/app/views/compliance_control_sets/_filters.html.slim
@@ -9,7 +9,14 @@
.form-group.togglable
= f.label t('activerecord.models.organisation.one'), required: false, class: 'control-label'
= f.input :organisation_name_eq_any, collection: organisations_filters_values, as: :check_boxes, label: false, label_method: lambda {|w| ("<span>#{w.name}</span>").html_safe}, required: false, wrapper_html: {class: 'checkbox_list'}
+
+ .form-group.togglable
+ = f.label Import.human_attribute_name(:updated_at), required: false, class: 'control-label'
+ .filter_menu
+ = f.simple_fields_for :updated_at do |p|
+ = p.input :start_date, as: :date, label: false, wrapper_html: {class: 'date smart_date filter_menu-item'}, default: @begin_range, include_blank: @begin_range ? false : true
+ = p.input :end_date, as: :date, label: false, wrapper_html: {class: 'date smart_date filter_menu-item'}, default: @end_range, include_blank: @end_range ? false : true
.actions
= link_to t('actions.erase'), @compliance_control_set, class: 'btn btn-link'
- = f.submit t('actions.filter'), class: 'btn btn-default', id: 'referential_filter_btn' \ No newline at end of file
+ = f.submit t('actions.filter'), class: 'btn btn-default', id: 'compliance_control_set_filter_btn' \ No newline at end of file
diff --git a/app/views/compliance_control_sets/edit.html.slim b/app/views/compliance_control_sets/edit.html.slim
index a9b8d7253..934bd81b0 100644
--- a/app/views/compliance_control_sets/edit.html.slim
+++ b/app/views/compliance_control_sets/edit.html.slim
@@ -1,6 +1,6 @@
/ PageHeader
= pageheader 'modele-calendrier',
- t('compliance_control_sets.index.edit')
+ t('compliance_control_sets.edit.title', name: @compliance_control_set.name)
/ PageContent
.page_content
diff --git a/app/views/compliance_control_sets/index.html.slim b/app/views/compliance_control_sets/index.html.slim
index aee1595ef..68173fee9 100644
--- a/app/views/compliance_control_sets/index.html.slim
+++ b/app/views/compliance_control_sets/index.html.slim
@@ -19,7 +19,7 @@
.col-lg-12
.select_table
= table_builder_2 @compliance_control_sets,
- [ \
+ [ \
TableBuilderHelper::Column.new( \
key: :name, \
attribute: 'name', \
@@ -28,7 +28,7 @@
end \
), \
TableBuilderHelper::Column.new( \
- key: :assignment, \
+ key: :assigned_to, \
attribute: 'assignment' \
), \
TableBuilderHelper::Column.new( \
@@ -44,12 +44,13 @@
attribute: Proc.new { |n| l(n.updated_at, format: :long) if n.updated_at }, \
) \
],
- sortable: true,
- links: [:show],
- cls: 'table has-filter has-search'
+ sortable: true,
+ links: [:show],
+ cls: 'table has-filter has-search'
- unless @compliance_control_sets.any?
.row.mt-xs
.col-lg-12
= replacement_msg t('compliance_control_sets.search_no_results')
+= javascript_pack_tag 'date_filters' \ No newline at end of file
diff --git a/app/views/compliance_control_sets/show.html.slim b/app/views/compliance_control_sets/show.html.slim
index b4a5b2260..b6e203a9e 100644
--- a/app/views/compliance_control_sets/show.html.slim
+++ b/app/views/compliance_control_sets/show.html.slim
@@ -1,6 +1,6 @@
/ PageHeader
= pageheader 'jeux-de-donnees',
- @compliance_control_set.name,
+ t('compliance_control_sets.show.title', name: @compliance_control_set.name),
'Lorem ipsum dolor sit amet'
/ Below is secondary actions & optional contents (filters, ...)
@@ -14,7 +14,7 @@
method: link.method,
data: link.data,
class: 'btn btn-primary' do
- = link.content
+ = link.content
/ PageContent
.page_content
@@ -22,4 +22,83 @@
.row
.col-lg-6.col-md-6.col-sm-12.col-xs-12
= definition_list t('metadatas'),
- ComplianceControlSet.human_attribute_name(:name) => @compliance_control_set.name \ No newline at end of file
+ ComplianceControlSet.human_attribute_name(:name) => @compliance_control_set.name
+ .row
+ .col-lg-12
+ h2
+ = transport_mode("", "")
+ .row
+ .col-lg-12
+ .select_table
+ = table_builder_2 @compliance_controls_without_block,
+ [ \
+ TableBuilderHelper::Column.new( \
+ key: :code, \
+ attribute: 'code' \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :name, \
+ attribute: 'name', \
+ link_to: lambda do |compliance_control| \
+ compliance_control_set_compliance_control_path(@compliance_control_set, compliance_control) \
+ end \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :criticity, \
+ attribute: 'criticity' \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :comment, \
+ attribute: 'comment' \
+ ), \
+ ],
+ sortable: true,
+ cls: 'table has-filter has-search'
+
+ - @compliance_control_set.compliance_control_blocks.each do |block|
+ .row
+ .col-lg-12
+ h2
+ = transport_mode(block.transport_mode, block.transport_submode)
+ .btn-group
+ .btn.dropdown-toggle{ data-toggle="dropdown" }
+ .span.fa.fa-cog
+ ul.dropdown-menu
+ li
+ = link_to t('compliance_control_sets.actions.edit'), edit_compliance_control_set_compliance_control_block_path(@compliance_control_set.id, block.id)
+ = link_to t('compliance_control_sets.actions.destroy'), compliance_control_set_compliance_control_block_path(@compliance_control_set.id, block.id), :method => :delete, :data => {:confirm => t('compliance_control_sets.actions.destroy_confirm')}
+ .row
+ .col-lg-12
+ .select_table
+ = table_builder_2 ModelDecorator.decorate(block.compliance_controls, with: ComplianceControlDecorator),
+ [ \
+ TableBuilderHelper::Column.new( \
+ key: :code, \
+ attribute: 'code' \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :name, \
+ attribute: 'name', \
+ link_to: lambda do |compliance_control| \
+ compliance_control_set_compliance_control_path(@compliance_control_set, compliance_control) \
+ end \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :criticity, \
+ attribute: 'criticity' \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :comment, \
+ attribute: 'comment' \
+ ), \
+ ],
+ sortable: true,
+ cls: 'table has-filter has-search'
+ .select_toolbox
+ ul
+ li.st_action
+ = link_to select_type_compliance_control_set_compliance_controls_path(@compliance_control_set.id)
+ span.fa.fa-plus
+ li.st_action
+ = link_to new_compliance_control_set_compliance_control_block_path(@compliance_control_set.id)
+ span.fa.fa-plus-square
diff --git a/app/views/compliance_controls/_form.html.slim b/app/views/compliance_controls/_form.html.slim
index 1377ed12b..d342f120a 100644
--- a/app/views/compliance_controls/_form.html.slim
+++ b/app/views/compliance_controls/_form.html.slim
@@ -2,11 +2,18 @@
.row
.col-lg-12
= f.input :name
- = f.input :type
+ = f.input :type, as: :hidden
+ = f.input :compliance_control_set_id, as: :hidden, input_html: { value: @compliance_control_set.id }
= f.input :code
= f.input :criticity
+ = f.association :compliance_control_block, collection: @compliance_control_set.compliance_control_blocks, label_method: lambda { |block| transport_mode(block.transport_mode, block.transport_submode) }
= f.input :comment
-
+ - f.object.class.dynamic_attributes.each do |attribute|
+ - if attribute == :target
+ = f.input :target, as: :grouped_select, collection: ModelAttribute.grouped_options(@compliance_control.class.attribute_type), group_method: :last, include_blank: false
+ - else
+ = f.input attribute.to_sym
+ end
.separator
= f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'compliance_control_form'
diff --git a/app/views/compliance_controls/edit.html.slim b/app/views/compliance_controls/edit.html.slim
index e69de29bb..d7497c0e2 100644
--- a/app/views/compliance_controls/edit.html.slim
+++ b/app/views/compliance_controls/edit.html.slim
@@ -0,0 +1,9 @@
+= pageheader 'compliance-control',
+ t('compliance_controls.edit.title')
+
+
+.page_content
+ .container-fluid
+ .row
+ .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1
+ = render 'form'
diff --git a/app/views/compliance_controls/index.html.slim b/app/views/compliance_controls/index.html.slim
deleted file mode 100644
index fd1293837..000000000
--- a/app/views/compliance_controls/index.html.slim
+++ /dev/null
@@ -1,44 +0,0 @@
-/ PageHeader
-- header_params = ['jeux-de-donnees',
- t('compliance_controls.index.title'),
- '']
-- header_params << link_to(t('compliance_controls.actions.new'), new_compliance_control_set_compliance_control_path(@compliance_control_set), class: 'btn btn-default') if policy(ComplianceControl).create?
-= pageheader(*header_params) do
-
- .row.mb-sm
- .col-lg-12.text-right
-
-.page_content
- .container-fluid
- .row
- .col-lg-12
- /= render 'filters'
- .row
- .col-lg-12
- .select_table
- = table_builder_2 @compliance_controls,
- [ \
- TableBuilderHelper::Column.new( \
- key: :code, \
- attribute: 'code' \
- ), \
- TableBuilderHelper::Column.new( \
- key: :name, \
- attribute: 'name', \
- link_to: lambda do |compliance_control| \
- compliance_control_set_compliance_control_path(@compliance_control_set, compliance_control) \
- end \
- ), \
- TableBuilderHelper::Column.new( \
- key: :criticity, \
- attribute: 'criticity' \
- ), \
- TableBuilderHelper::Column.new( \
- key: :comment, \
- attribute: 'comment' \
- ), \
- ],
- sortable: true,
- cls: 'table has-filter has-search'
-
-
diff --git a/app/views/compliance_controls/new.html.slim b/app/views/compliance_controls/new.html.slim
index 0651461cb..962f70ecc 100644
--- a/app/views/compliance_controls/new.html.slim
+++ b/app/views/compliance_controls/new.html.slim
@@ -1,5 +1,8 @@
-= pageheader 'compliance-control',
- t('compliance_control.index.new')
+/ PageHeader
+- header_params = ['jeux-de-donnees',
+ t('compliance_controls.new.title'),
+ '']
+= pageheader(*header_params) do
.page_content
diff --git a/app/views/compliance_controls/select_type.html.slim b/app/views/compliance_controls/select_type.html.slim
new file mode 100644
index 000000000..c6e3b0427
--- /dev/null
+++ b/app/views/compliance_controls/select_type.html.slim
@@ -0,0 +1,18 @@
+/ PageHeader
+- header_params = ['jeux-de-donnees',
+ t('compliance_controls.select_type.title'),
+ '']
+= pageheader(*header_params) do
+
+/ PageContent
+.page_content
+ .container-fluid
+ .row
+ .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1
+ = form_tag(new_compliance_control_set_compliance_control_path, method: :get) do
+ - @sti_subclasses.each do |klass|
+ .radio
+ = radio_button_tag(:sti_class, klass, @sti_subclasses.first)
+ = "#{klass.default_code} - #{I18n.t("activerecord.models.#{klass.name.underscore}.one")}"
+ .text-right
+ = submit_tag t('compliance_control_sets.actions.loaded'), class: "btn btn-outline-primary"
diff --git a/app/views/compliance_controls/show.html.slim b/app/views/compliance_controls/show.html.slim
index e69de29bb..8232dbe28 100644
--- a/app/views/compliance_controls/show.html.slim
+++ b/app/views/compliance_controls/show.html.slim
@@ -0,0 +1,32 @@
+/ PageHeader
+= pageheader 'jeux-de-donnees',
+ t('compliance_controls.show.title'),
+ ''
+/ PageContent
+.page_content
+ .container-fluid
+ .row
+ .col-lg-6.col-md-6.col-sm-12.col-xs-12
+ /- @compliance_control.control_attributes.each_with_index do |(key,value), index|
+ = definition_list t('metadatas'),
+ { \
+ ComplianceControl.human_attribute_name(:name) => @compliance_control.name,
+ ComplianceControl.human_attribute_name(:code) => @compliance_control.code,
+ ComplianceControl.human_attribute_name(:criticity) => @compliance_control.criticity,
+ ComplianceControl.human_attribute_name(:comment) => @compliance_control.comment,
+ }.merge( \
+ {}.tap do |hash| \
+ @compliance_control.class.dynamic_attributes.each do |attribute| \
+ hash[ComplianceControl.human_attribute_name(attribute)] = @compliance_control.send(attribute) \
+ end \
+ end \
+ )
+ - if @compliance_control.compliance_control_block
+ = definition_list t('metadatas'),
+ {}.merge( \
+ {}.tap do |hash| \
+ @compliance_control.compliance_control_block.condition_attributes.each do |k, v| \
+ hash[ComplianceControl.human_attribute_name(k)] = v \
+ end \
+ end \
+ )
diff --git a/app/views/dashboards/show.html.slim b/app/views/dashboards/show.html.slim
new file mode 100644
index 000000000..66154712d
--- /dev/null
+++ b/app/views/dashboards/show.html.slim
@@ -0,0 +1,15 @@
+/ PageHeader
+= pageheader 'tableau-de-bord',
+ t('.title', organisation: current_organisation.name)
+
+ / Below is secundary actions & optional contents (filters, ...)
+ .row.mb-sm
+ .col-lg-12.text-right
+ - if policy(Api::V1::ApiKey).create?
+ = link_to t('actions.create_api_key'), new_api_key_path, class: 'btn btn-primary'
+
+
+/ PageContent
+.page_content
+ .container-fluid
+ = render partial: @dashboard
diff --git a/app/views/imports/_filters.html.slim b/app/views/imports/_filters.html.slim
index 85099b99a..b1f23e2c8 100644
--- a/app/views/imports/_filters.html.slim
+++ b/app/views/imports/_filters.html.slim
@@ -15,8 +15,8 @@
= f.label Import.human_attribute_name(:started_at), required: false, class: 'control-label'
.filter_menu
= f.simple_fields_for :started_at do |p|
- = p.input :begin, as: :date, label: false, wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @begin_range, include_blank: @begin_range ? false : true
- = p.input :end, as: :date, label: false, wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @end_range, include_blank: @end_range ? false : true
+ = p.input :start_date, as: :date, label: false, wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @begin_range, include_blank: @begin_range ? false : true
+ = p.input :end_date, as: :date, label: false, wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @end_range, include_blank: @end_range ? false : true
.actions
= link_to t('actions.erase'), workbench_imports_path(@workbench), class: 'btn btn-link'
diff --git a/app/views/imports/index.html.slim b/app/views/imports/index.html.slim
index a6da730f1..cd236ef36 100644
--- a/app/views/imports/index.html.slim
+++ b/app/views/imports/index.html.slim
@@ -48,4 +48,4 @@
.col-lg-12
= replacement_msg t('imports.search_no_results')
-= javascript_include_tag 'filters/import.js'
+= javascript_pack_tag 'date_filters'
diff --git a/app/views/journey_patterns_collections/show.html.slim b/app/views/journey_patterns_collections/show.html.slim
index bce4f28b5..8c0950536 100644
--- a/app/views/journey_patterns_collections/show.html.slim
+++ b/app/views/journey_patterns_collections/show.html.slim
@@ -20,4 +20,4 @@
| window.journeyPatternsPerPage = #{@ppage};
| window.perms = #{raw @perms}
-= javascript_include_tag 'es6_browserified/journey_patterns/index.js'
+= javascript_pack_tag 'journey_patterns/index.js'
diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim
index d6a22c4f8..1bc9de136 100644
--- a/app/views/layouts/application.html.slim
+++ b/app/views/layouts/application.html.slim
@@ -11,7 +11,9 @@ html lang=I18n.locale
= stylesheet_link_tag 'base'
= stylesheet_link_tag 'application'
+ = javascript_pack_tag 'application'
= javascript_include_tag 'application'
+
body
diff --git a/app/views/layouts/navigation/_main_nav_left.html.slim b/app/views/layouts/navigation/_main_nav_left.html.slim
index 12139c93b..062c9383c 100644
--- a/app/views/layouts/navigation/_main_nav_left.html.slim
+++ b/app/views/layouts/navigation/_main_nav_left.html.slim
@@ -37,7 +37,7 @@
span Import
= link_to calendars_path, class: 'list-group-item' do
span Modèles de calendrier
- = link_to '#', class: 'list-group-item' do
+ = link_to workbench_compliance_check_sets_path(current_offer_workbench), class: 'list-group-item' do
span Rapport de contrôle
= link_to compliance_control_sets_path, class: 'list-group-item' do
span Jeux de contrôle
diff --git a/app/views/lines/_filters.html.slim b/app/views/lines/_filters.html.slim
index 0e34b2e4c..7662c41b5 100644
--- a/app/views/lines/_filters.html.slim
+++ b/app/views/lines/_filters.html.slim
@@ -17,11 +17,11 @@
.form-group.togglable
= f.label Chouette::Line.human_attribute_name(:transport_mode), required: false, class: 'control-label'
- = f.input :transport_mode_eq_any, collection: sorted_transport_mode, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.line.transport_mode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
+ = f.input :transport_mode_eq_any, collection: Chouette::Line.sorted_transport_modes, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.transport_mode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
.form-group.togglable
= f.label Chouette::Line.human_attribute_name(:transport_submode), required: false, class: 'control-label'
- = f.input :transport_submode_eq_any, collection: sorted_transport_submode, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.line.transport_submode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
+ = f.input :transport_submode_eq_any, collection: Chouette::Line.sorted_transport_submodes, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.transport_submode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
.actions
= link_to 'Effacer', @workbench, class: 'btn btn-link'
diff --git a/app/views/lines/index.html.slim b/app/views/lines/index.html.slim
index dda5afd44..87c3a69e7 100644
--- a/app/views/lines/index.html.slim
+++ b/app/views/lines/index.html.slim
@@ -36,7 +36,7 @@
), \
TableBuilderHelper::Column.new( \
key: :deactivated, \
- attribute: Proc.new{|n| n.deactivated? ? t('false') : t('true')} \
+ attribute: Proc.new { |n| line_status(n.deactivated?) } \
), \
TableBuilderHelper::Column.new( \
key: 'networks.name', \
@@ -48,11 +48,11 @@
), \
TableBuilderHelper::Column.new( \
key: :transport_mode, \
- attribute: Proc.new { |n| n.transport_mode.nil? ? '-' : t("enumerize.line.transport_mode.#{n.try(:transport_mode)}") } \
+ attribute: Proc.new { |n| n.transport_mode.present? ? t("enumerize.transport_mode.#{n.try(:transport_mode)}") : "-" } \
), \
TableBuilderHelper::Column.new( \
key: :transport_submode, \
- attribute: Proc.new { |n| n.transport_submode.nil? ? '-' : t("enumerize.line.transport_submode.#{n.try(:transport_submode)}") } \
+ attribute: Proc.new { |n| n.transport_submode.present? ? t("enumerize.transport_submode.#{n.try(:transport_submode)}") : "-" } \
) \
],
links: [:show],
diff --git a/app/views/lines/show.html.slim b/app/views/lines/show.html.slim
index 0779a0f5a..b16b6472a 100644
--- a/app/views/lines/show.html.slim
+++ b/app/views/lines/show.html.slim
@@ -27,7 +27,7 @@
'Transporteur(s) secondaire(s)' => (@line.secondary_companies.nil? ? t('lines.index.unset') : @line.secondary_companies.collect(&:name).join(', ')),
'Nom court' => @line.number,
'Code public' => (@line.registration_number ? @line.registration_number : '-'),
- @line.human_attribute_name(:transport_mode) => (@line.transport_mode ? t("enumerize.line.transport_mode.#{@line.transport_mode}") : '-'),
- @line.human_attribute_name(:transport_submode) => (@line.transport_submode ? t("enumerize.line.transport_submode.#{@line.transport_submode}") : '-'),
+ @line.human_attribute_name(:transport_mode) => (@line.transport_mode.present? ? t("enumerize.transport_mode.#{@line.transport_mode}") : '-'),
+ @line.human_attribute_name(:transport_submode) => (@line.transport_submode.present? ? t("enumerize.transport_submode.#{@line.transport_submode}") : '-'),
@line.human_attribute_name(:url) => (@line.url ? @line.url : '-'),
@line.human_attribute_name(:seasonal) => (@line.seasonal? ? t('true') : t('false')),}
diff --git a/app/views/referential_lines/show.html.slim b/app/views/referential_lines/show.html.slim
index 6e59d83b3..df3c285ee 100644
--- a/app/views/referential_lines/show.html.slim
+++ b/app/views/referential_lines/show.html.slim
@@ -1,6 +1,6 @@
/ PageHeader
= pageheader 'ligne',
- @line.name,
+ t('lines.index.line', line: @line.name),
'',
t('last_update', time: l(@line.updated_at, format: :short)) do
@@ -27,13 +27,14 @@
'Transporteur(s) secondaire(s)' => (@line.secondary_companies.nil? ? t('lines.index.unset') : @line.secondary_companies.collect(&:name).join(', ')),
'Nom court' => @line.number,
'Code public' => (@line.registration_number ? @line.registration_number : '-'),
- @line.human_attribute_name(:transport_mode) => (@line.transport_mode ? t("enumerize.line.transport_mode.#{@line.transport_mode}") : '-'),
- @line.human_attribute_name(:transport_submode) => (@line.transport_submode ? t("enumerize.line.transport_submode.#{@line.transport_submode}") : '-'),
+ @line.human_attribute_name(:transport_mode) => (@line.transport_mode.present? ? t("enumerize.transport_mode.#{@line.transport_mode}") : '-'),
+ @line.human_attribute_name(:transport_submode) => (@line.transport_submode.present? ? t("enumerize.transport_submode.#{@line.transport_submode}") : '-'),
@line.human_attribute_name(:url) => (@line.url ? @line.url : '-'),
@line.human_attribute_name(:seasonal) => (@line.seasonal? ? t('true') : t('false')),}
.row
.col-lg-12
+ .h3 = t('lines.show.routes.title')
- if params[:q].present? or @routes.any?
.row
.col-lg-12
diff --git a/app/views/referentials/_filters.html.slim b/app/views/referentials/_filters.html.slim
index 1cc6bb410..c5b6042f0 100644
--- a/app/views/referentials/_filters.html.slim
+++ b/app/views/referentials/_filters.html.slim
@@ -9,7 +9,7 @@
.ffg-row
.form-group.togglable
= f.label Chouette::Line.human_attribute_name(:transport_mode), required: false, class: 'control-label'
- = f.input :transport_mode_eq_any, collection: @referential.lines.pluck(:transport_mode).uniq.compact, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.line.transport_mode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' }
+ = f.input :transport_mode_eq_any, collection: @referential.lines.pluck(:transport_mode).uniq.compact, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.transport_mode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' }
.form-group.togglable
= f.label Chouette::Line.human_attribute_name(:network), required: false, class: 'control-label'
diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim
index e1d89cba4..26ce0acbb 100644
--- a/app/views/referentials/show.html.slim
+++ b/app/views/referentials/show.html.slim
@@ -58,11 +58,11 @@
), \
TableBuilderHelper::Column.new( \
key: :deactivated, \
- attribute: Proc.new { |n| n.deactivated? ? t('false') : t('true') } \
+ attribute: Proc.new { |n| line_status(n.deactivated?) } \
), \
TableBuilderHelper::Column.new( \
key: :transport_mode, \
- attribute: Proc.new { |n| n.transport_mode ? t("enumerize.line.transport_mode.#{n.transport_mode}") : '' }, \
+ attribute: Proc.new { |n| n.transport_mode ? t("enumerize.transport_mode.#{n.transport_mode}") : '' }, \
), \
TableBuilderHelper::Column.new( \
key: 'networks.name', \
diff --git a/app/views/routes/_form.html.slim b/app/views/routes/_form.html.slim
index 244b427dc..29e5be3d2 100644
--- a/app/views/routes/_form.html.slim
+++ b/app/views/routes/_form.html.slim
@@ -26,7 +26,8 @@
// Get JSON data for route stop points
= javascript_tag do
- | window.itinerary_stop = "#{URI.escape(route_json_for_edit(@route))}"
+ | window.itinerary_stop = "#{URI.escape(route_json_for_edit(@route))}";
+ | window.I18n = #{(I18n.backend.send(:translations)[I18n.locale].to_json).html_safe};
/ StopPoints Reactux component
-= javascript_include_tag 'es6_browserified/itineraries/index.js'
+= javascript_pack_tag 'routes/edit.js'
diff --git a/app/views/routes/show.html.slim b/app/views/routes/show.html.slim
index e2681d215..6bd3451cd 100644
--- a/app/views/routes/show.html.slim
+++ b/app/views/routes/show.html.slim
@@ -1,6 +1,6 @@
/ PageHeader
= pageheader 'itineraire',
- @route.name,
+ t('routes.index.title', route: @route.name),
'',
t('last_update', time: l(@route.updated_at, format: :short)),
(policy(@route).edit? ? link_to(t('actions.edit'), edit_referential_line_route_path(@referential, @line, @route), class: 'btn btn-default') : '') do
@@ -32,6 +32,7 @@
.row
.col-lg-12
+ .h3 = t('routes.show.stop_areas.title')
- if @route_sp.any?
= table_builder_2 @route_sp,
[ \
@@ -48,7 +49,7 @@
), \
TableBuilderHelper::Column.new( \
key: :deleted_at, \
- attribute: Proc.new { |s| s.try(:stop_area).deleted_at ? t('false') : t('true') }, \
+ attribute: Proc.new { |s| line_status(s.try(:stop_area).deleted_at) } \
), \
TableBuilderHelper::Column.new( \
key: :zip_code, \
@@ -76,4 +77,5 @@
= javascript_tag do
| window.route = "#{URI.escape(route_json_for_edit(@route))}"
-= javascript_include_tag 'es6_browserified/itineraries/show.js'
+
+= javascript_pack_tag 'routes/show.js' \ No newline at end of file
diff --git a/app/views/rule_parameter_sets/_mode_selection.html.slim b/app/views/rule_parameter_sets/_mode_selection.html.slim
index a2a8a16e5..b9afd10b6 100644
--- a/app/views/rule_parameter_sets/_mode_selection.html.slim
+++ b/app/views/rule_parameter_sets/_mode_selection.html.slim
@@ -1,4 +1,4 @@
-select.undescribed_modes
- - Chouette::TransportMode.all.map { |m| m.name.downcase}.each do |mode|
- option value="#{mode}"
- = t("transport_modes.label.#{mode}") \ No newline at end of file
+/ select.undescribed_modes
+/ - Chouette::TransportMode.all.map { |m| m.name.downcase}.each do |mode|
+/ option value="#{mode}"
+/ = t("transport_modes.label.#{mode}") \ No newline at end of file
diff --git a/app/views/shared/_lines_search_form.html.slim b/app/views/shared/_lines_search_form.html.slim
index 3bc84a3ad..8a59412a4 100644
--- a/app/views/shared/_lines_search_form.html.slim
+++ b/app/views/shared/_lines_search_form.html.slim
@@ -19,6 +19,6 @@
.col-xs-3
= f.select(:company_id_eq, referential.companies.collect { |c| [c.name, c.id] }.unshift([t("lines.index.no_networks"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_companies") })
.col-xs-3
- = f.select(:transport_mode_eq, Chouette::Line.transport_mode.values.collect { |v| [ I18n.t("enumerize.line.transport_mode.#{v}"), v] }.sort.unshift([t("lines.index.no_transport_modes"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_transport_modes") })
+ = f.select(:transport_mode_eq, Chouette::Line.transport_mode.values.collect { |v| [ I18n.t("enumerize.transport_mode.#{v}"), v] }.sort.unshift([t("lines.index.no_transport_modes"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_transport_modes") })
.col-xs-3
- = f.select(:transport_submode_eq, Chouette::Line.transport_submode.values.collect { |v| [ I18n.t("enumerize.line.transport_submode.#{v}"), v] }.sort.unshift([t("lines.index.no_transport_submodes"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_transport_submodes") })
+ = f.select(:transport_submode_eq, Chouette::Line.transport_submode.values.collect { |v| [ I18n.t("enumerize.transport_submode.#{v}"), v] }.sort.unshift([t("lines.index.no_transport_submodes"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_transport_submodes") })
diff --git a/app/views/stif/dashboards/_dashboard.html.slim b/app/views/stif/dashboards/_dashboard.html.slim
new file mode 100644
index 000000000..3142ecd5b
--- /dev/null
+++ b/app/views/stif/dashboards/_dashboard.html.slim
@@ -0,0 +1,73 @@
+.row
+ .col-lg-12
+ h2.content_header = t('.subtitle')
+
+.row
+ .col-lg-6.col-md-6.col-sm-6.col-xs-12
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title
+ = t('.organisation')
+
+ .panel-body
+ em.small.text-muted = t('.no_content')
+
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title
+ = t('.idf')
+
+ .panel-body
+ em.small.text-muted = t('.no_content')
+
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title
+ = t('.api_keys')
+ span.badge.ml-xs = current_organisation.api_keys.count if current_organisation.api_keys.present?
+ - if current_organisation.api_keys.present?
+ - current_organisation.api_keys.each do |api_key|
+ .list-group
+ = policy(api_key).edit? ? link_to( "#{api_key.name} : #{api_key.token}", edit_api_key_path(api_key), class: 'list-group-item') : "#{api_key.name} : #{api_key.token}"
+ - else
+ .panel-body
+ em.small.text-muted = t('.no_content')
+
+ .col-lg-6.col-md-6.col-sm-6.col-xs-12
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title.with_actions
+ div
+ = t('.referentials')
+ span.badge.ml-xs = @referentials.count if @referentials.present?
+
+ div
+ = link_to '', workbench_path(@dashboard.workbench), class: ' fa fa-chevron-right pull-right', title: t('.see')
+
+ - if @referentials.present?
+ .list-group
+ - @referentials.each_with_index do |referential, i|
+ = link_to referential.name, referential_path(referential, workbench_id: referential.workbench_id, current_workbench_id: @dashboard.workbench.id), class: 'list-group-item' if i < 6
+
+ - else
+ .panel-body
+ em.small.text-muted = t('.no_content')
+
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title.with_actions
+ div
+ = t('.calendars')
+ span.badge.ml-xs = @dashboard.calendars.count if @dashboard.calendars.present?
+
+ div
+ = link_to '', calendars_path, class: ' fa fa-chevron-right pull-right', title: t('.see')
+
+ - if @dashboard.calendars.present?
+ .list-group
+ - @dashboard.calendars.each_with_index do |calendar, i|
+ = link_to calendar.name, calendar_path(calendar), class: 'list-group-item' if i < 6
+
+ - else
+ .panel-body
+ em.small.text-muted = t('.no_content')
diff --git a/app/views/stop_areas/index.html.slim b/app/views/stop_areas/index.html.slim
index 4c95761d2..95b9b1b0e 100644
--- a/app/views/stop_areas/index.html.slim
+++ b/app/views/stop_areas/index.html.slim
@@ -39,7 +39,7 @@
), \
TableBuilderHelper::Column.new( \
key: :deleted_at, \
- attribute: Proc.new { |s| s.deleted_at ? t('false') : t('true') } \
+ attribute: Proc.new { |s| line_status(s.deleted_at) } \
), \
TableBuilderHelper::Column.new( \
key: :zip_code, \
diff --git a/app/views/time_tables/_filter.html.slim b/app/views/time_tables/_filter.html.slim
index 043aa87d0..2672f7dfc 100644
--- a/app/views/time_tables/_filter.html.slim
+++ b/app/views/time_tables/_filter.html.slim
@@ -14,8 +14,9 @@
.form-group.togglable
= f.label Chouette::TimeTable.human_attribute_name(:bounding_dates), required: false, class: 'control-label'
.filter_menu
- = f.input :start_date_gteq, as: :date, label: t('simple_form.from'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @begin_range, include_blank: @begin_range ? false : true
- = f.input :end_date_lteq, as: :date, label: t('simple_form.to'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @end_range, include_blank: @end_range ? false : true
+ = f.simple_fields_for :bounding_dates do |p|
+ = p.input :start_date, as: :date, label: t('simple_form.from'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @begin_range, include_blank: @begin_range ? false : true
+ = p.input :end_date, as: :date, label: t('simple_form.to'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @end_range, include_blank: @end_range ? false : true
.actions
diff --git a/app/views/time_tables/edit.html.slim b/app/views/time_tables/edit.html.slim
index cc6f31489..bf7573c71 100644
--- a/app/views/time_tables/edit.html.slim
+++ b/app/views/time_tables/edit.html.slim
@@ -13,4 +13,4 @@
| window.actionType = "#{raw params[:action]}";
| window.I18n = #{(I18n.backend.send(:translations)[I18n.locale].to_json).html_safe};
-= javascript_include_tag 'es6_browserified/time_tables/index.js'
+= javascript_pack_tag 'time_tables/edit.js'
diff --git a/app/views/time_tables/index.html.slim b/app/views/time_tables/index.html.slim
index b984f95c8..c71a214f1 100644
--- a/app/views/time_tables/index.html.slim
+++ b/app/views/time_tables/index.html.slim
@@ -69,4 +69,4 @@
= javascript_tag do
| window.I18n = #{(I18n.backend.send(:translations).to_json).html_safe};
-= javascript_include_tag 'filters/time_table.js'
+= javascript_pack_tag 'date_filters'
diff --git a/app/views/vehicle_journeys/index.html.slim b/app/views/vehicle_journeys/index.html.slim
index 4efc34eaa..f88afc398 100644
--- a/app/views/vehicle_journeys/index.html.slim
+++ b/app/views/vehicle_journeys/index.html.slim
@@ -25,4 +25,4 @@
| window.perms = #{raw @perms};
| window.I18n = #{(I18n.backend.send(:translations).to_json).html_safe};
-= javascript_include_tag 'es6_browserified/vehicle_journeys/index.js'
+= javascript_pack_tag 'vehicle_journeys/index.js'
diff --git a/app/views/workbenches/_filters.html.slim b/app/views/workbenches/_filters.html.slim
index 8da629e9c..4d9e0066c 100644
--- a/app/views/workbenches/_filters.html.slim
+++ b/app/views/workbenches/_filters.html.slim
@@ -25,8 +25,8 @@
= f.label Referential.human_attribute_name(:validity_period), required: false, class: 'control-label'
.filter_menu
= f.simple_fields_for :validity_period do |p|
- = p.input :begin_gteq, as: :date, label: t('simple_form.from'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @begin_range, include_blank: @begin_range ? false : true
- = p.input :end_lteq, as: :date, label: t('simple_form.to'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @end_range, include_blank: @end_range ? false : true
+ = p.input :start_date, as: :date, label: t('simple_form.from'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @begin_range, include_blank: @begin_range ? false : true
+ = p.input :end_date, as: :date, label: t('simple_form.to'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @end_range, include_blank: @end_range ? false : true
.actions
= link_to t('actions.erase'), @workbench, class: 'btn btn-link'
diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim
index fd72979ea..32a933cc2 100644
--- a/app/views/workbenches/show.html.slim
+++ b/app/views/workbenches/show.html.slim
@@ -78,4 +78,4 @@
= javascript_tag do
| window.I18n = #{(I18n.backend.send(:translations).to_json).html_safe};
-= javascript_include_tag 'filters/workbench.js'
+= javascript_pack_tag 'date_filters' \ No newline at end of file