aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Gemfile3
-rw-r--r--Gemfile.lock5
-rw-r--r--app/assets/stylesheets/components/_device.sass9
-rw-r--r--app/assets/stylesheets/components/_forms.sass6
-rw-r--r--app/assets/stylesheets/components/_page_header.sass1
-rw-r--r--app/assets/stylesheets/typography/_sboiv.sass34
-rw-r--r--app/controllers/access_links_controller.rb3
-rw-r--r--app/controllers/access_points_controller.rb3
-rw-r--r--app/controllers/api_keys_controller.rb2
-rw-r--r--app/controllers/application_controller.rb2
-rw-r--r--app/controllers/autocomplete_stop_areas_controller.rb2
-rw-r--r--app/controllers/autocomplete_time_tables_controller.rb2
-rw-r--r--app/controllers/autocomplete_timebands_controller.rb2
-rw-r--r--app/controllers/calendars_controller.rb2
-rw-r--r--app/controllers/chouette_controller.rb3
-rw-r--r--app/controllers/clean_ups_controller.rb1
-rw-r--r--app/controllers/companies_controller.rb4
-rw-r--r--app/controllers/compliance_check_sets_controller.rb16
-rw-r--r--app/controllers/compliance_control_blocks_controller.rb2
-rw-r--r--app/controllers/compliance_control_sets_controller.rb2
-rw-r--r--app/controllers/compliance_controls_controller.rb2
-rw-r--r--app/controllers/concerns/paper_trail_support.rb11
-rw-r--r--app/controllers/connection_link_areas_controller.rb13
-rw-r--r--app/controllers/connection_links_controller.rb3
-rw-r--r--app/controllers/dashboards_controller.rb3
-rw-r--r--app/controllers/export_tasks_controller.rb13
-rw-r--r--app/controllers/exports_controller.rb1
-rw-r--r--app/controllers/group_of_lines_controller.rb4
-rw-r--r--app/controllers/import_messages_controller.rb2
-rw-r--r--app/controllers/import_resources_controller.rb2
-rw-r--r--app/controllers/import_tasks_controller.rb15
-rw-r--r--app/controllers/imports_controller.rb6
-rw-r--r--app/controllers/journey_pattern_stop_points_controller.rb1
-rw-r--r--app/controllers/journey_patterns_collections_controller.rb1
-rw-r--r--app/controllers/journey_patterns_controller.rb3
-rw-r--r--app/controllers/line_footnotes_controller.rb1
-rw-r--r--app/controllers/line_referentials_controller.rb2
-rw-r--r--app/controllers/lines_controller.rb3
-rw-r--r--app/controllers/networks_controller.rb6
-rw-r--r--app/controllers/organisations_controller.rb2
-rw-r--r--app/controllers/referential_companies_controller.rb3
-rw-r--r--app/controllers/referential_group_of_lines_controller.rb3
-rw-r--r--app/controllers/referential_lines_controller.rb2
-rw-r--r--app/controllers/referential_networks_controller.rb3
-rw-r--r--app/controllers/referential_stop_areas_controller.rb3
-rw-r--r--app/controllers/referentials_controller.rb2
-rw-r--r--app/controllers/route_stop_points_controller.rb1
-rw-r--r--app/controllers/routes_controller.rb2
-rw-r--r--app/controllers/routing_constraint_zones_controller.rb2
-rw-r--r--app/controllers/stop_area_copies_controller.rb11
-rw-r--r--app/controllers/stop_area_referentials_controller.rb2
-rw-r--r--app/controllers/stop_area_routing_lines_controller.rb11
-rw-r--r--app/controllers/stop_areas_controller.rb16
-rw-r--r--app/controllers/time_table_combinations_controller.rb1
-rw-r--r--app/controllers/time_tables_controller.rb2
-rw-r--r--app/controllers/timebands_controller.rb1
-rw-r--r--app/controllers/users_controller.rb2
-rw-r--r--app/controllers/vehicle_journey_exports_controller.rb17
-rw-r--r--app/controllers/vehicle_journey_imports_controller.rb1
-rw-r--r--app/controllers/vehicle_journeys_collections_controller.rb1
-rw-r--r--app/controllers/vehicle_journeys_controller.rb1
-rw-r--r--app/controllers/vehicle_translations_controller.rb1
-rw-r--r--app/controllers/workbenches_controller.rb2
-rw-r--r--app/decorators/compliance_check_set_decorator.rb17
-rw-r--r--app/decorators/import_decorator.rb22
-rw-r--r--app/decorators/line_decorator.rb20
-rw-r--r--app/helpers/application_helper.rb26
-rw-r--r--app/helpers/compliance_check_sets_helper.rb14
-rw-r--r--app/helpers/import_resources_helper.rb4
-rw-r--r--app/helpers/networks_helper.rb7
-rw-r--r--app/models/api/v1/api_key.rb1
-rw-r--r--app/models/calendar.rb2
-rw-r--r--app/models/chouette/access_link.rb7
-rw-r--r--app/models/chouette/access_point.rb4
-rw-r--r--app/models/chouette/company.rb3
-rw-r--r--app/models/chouette/connection_link.rb3
-rw-r--r--app/models/chouette/group_of_line.rb3
-rw-r--r--app/models/chouette/journey_pattern.rb1
-rw-r--r--app/models/chouette/line.rb7
-rw-r--r--app/models/chouette/network.rb15
-rw-r--r--app/models/chouette/pt_link.rb4
-rw-r--r--app/models/chouette/route.rb4
-rw-r--r--app/models/chouette/routing_constraint_zone.rb3
-rw-r--r--app/models/chouette/stop_area.rb4
-rw-r--r--app/models/chouette/stop_point.rb4
-rw-r--r--app/models/chouette/time_table.rb4
-rw-r--r--app/models/chouette/timeband.rb4
-rw-r--r--app/models/chouette/vehicle_journey.rb3
-rw-r--r--app/models/compliance_check_set.rb9
-rw-r--r--app/models/compliance_control_set.rb1
-rw-r--r--app/models/concerns/default_attributes_support.rb1
-rw-r--r--app/models/concerns/objectid_support.rb2
-rw-r--r--app/models/dashboard.rb5
-rw-r--r--app/policies/company_policy.rb20
-rw-r--r--app/policies/compliance_check_set_policy.rb3
-rw-r--r--app/policies/import_policy.rb8
-rw-r--r--app/policies/line_policy.rb14
-rw-r--r--app/policies/stop_area_policy.rb12
-rw-r--r--app/services/http_service.rb3
-rw-r--r--app/views/api/kml/access_links/index.kml.slim2
-rw-r--r--app/views/api/kml/access_points/index.kml.slim2
-rw-r--r--app/views/api/kml/connection_links/index.kml.slim2
-rw-r--r--app/views/api/kml/journey_patterns/show.kml.slim4
-rw-r--r--app/views/api/kml/lines/show.kml.slim2
-rw-r--r--app/views/api/kml/routes/show.kml.slim2
-rw-r--r--app/views/api/kml/stop_areas/index.kml.slim2
-rw-r--r--app/views/api/v1/compliance_check_sets/validated.rabl1
-rw-r--r--app/views/api/v1/group_of_lines/short_description.rabl2
-rw-r--r--app/views/api/v1/group_of_lines/show.rabl2
-rw-r--r--app/views/api/v1/trident_objects/show.rabl2
-rw-r--r--app/views/api_keys/edit.html.slim14
-rw-r--r--app/views/api_keys/new.html.slim7
-rw-r--r--app/views/calendars/edit.html.slim8
-rw-r--r--app/views/calendars/index.html.slim10
-rw-r--r--app/views/calendars/new.html.slim7
-rw-r--r--app/views/calendars/show.html.slim14
-rw-r--r--app/views/companies/_form.html.slim34
-rw-r--r--app/views/companies/edit.html.slim5
-rw-r--r--app/views/companies/index.html.slim10
-rw-r--r--app/views/companies/new.html.slim8
-rw-r--r--app/views/companies/show.html.slim12
-rw-r--r--app/views/compliance_check_sets/_filters.html.slim8
-rw-r--r--app/views/compliance_check_sets/executed.html.slim8
-rw-r--r--app/views/compliance_check_sets/index.html.slim16
-rw-r--r--app/views/compliance_check_sets/show.html.slim47
-rw-r--r--app/views/compliance_control_blocks/edit.html.slim8
-rw-r--r--app/views/compliance_control_blocks/new.html.slim8
-rw-r--r--app/views/compliance_control_sets/edit.html.slim5
-rw-r--r--app/views/compliance_control_sets/index.html.slim14
-rw-r--r--app/views/compliance_control_sets/new.html.slim5
-rw-r--r--app/views/compliance_control_sets/show.html.slim8
-rw-r--r--app/views/compliance_controls/edit.html.slim5
-rw-r--r--app/views/compliance_controls/new.html.slim9
-rw-r--r--app/views/compliance_controls/select_type.html.slim7
-rw-r--r--app/views/compliance_controls/show.html.slim12
-rw-r--r--app/views/dashboards/_dashboard.html.slim14
-rw-r--r--app/views/dashboards/show.html.slim9
-rw-r--r--app/views/errors/forbidden.html.slim5
-rw-r--r--app/views/errors/not_found.html.slim11
-rw-r--r--app/views/errors/server_error.html.slim11
-rw-r--r--app/views/import_resources/index.html.slim9
-rw-r--r--app/views/imports/index.html.slim9
-rw-r--r--app/views/imports/new.html.slim4
-rw-r--r--app/views/imports/show.html.slim11
-rw-r--r--app/views/journey_patterns_collections/show.html.slim8
-rw-r--r--app/views/layouts/application.html.slim1
-rw-r--r--app/views/layouts/navigation/_page_header.html.slim23
-rw-r--r--app/views/line_footnotes/edit.html.slim7
-rw-r--r--app/views/line_footnotes/show.html.slim13
-rw-r--r--app/views/line_referentials/edit.html.slim5
-rw-r--r--app/views/line_referentials/show.html.slim12
-rw-r--r--app/views/lines/_filters.html.slim4
-rw-r--r--app/views/lines/_form.html.slim63
-rw-r--r--app/views/lines/edit.html.slim9
-rw-r--r--app/views/lines/index.html.slim10
-rw-r--r--app/views/lines/new.html.slim9
-rw-r--r--app/views/lines/show.html.slim15
-rw-r--r--app/views/networks/_form.html.slim27
-rw-r--r--app/views/networks/edit.html.slim9
-rw-r--r--app/views/networks/index.html.slim12
-rw-r--r--app/views/networks/new.html.slim8
-rw-r--r--app/views/networks/show.html.slim11
-rw-r--r--app/views/referential_companies/edit.html.slim3
-rw-r--r--app/views/referential_companies/index.html.slim10
-rw-r--r--app/views/referential_companies/new.html.slim1
-rw-r--r--app/views/referential_companies/show.html.slim11
-rw-r--r--app/views/referential_lines/edit.html.slim5
-rw-r--r--app/views/referential_lines/new.html.slim4
-rw-r--r--app/views/referential_lines/show.html.slim10
-rw-r--r--app/views/referential_networks/edit.html.slim3
-rw-r--r--app/views/referential_networks/index.html.slim10
-rw-r--r--app/views/referential_networks/new.html.slim3
-rw-r--r--app/views/referential_networks/show.html.slim9
-rw-r--r--app/views/referential_stop_areas/edit.html.slim3
-rw-r--r--app/views/referential_stop_areas/index.html.slim1
-rw-r--r--app/views/referential_stop_areas/new.html.slim2
-rw-r--r--app/views/referential_stop_areas/show.html.slim8
-rw-r--r--app/views/referentials/edit.html.slim8
-rw-r--r--app/views/referentials/new.html.slim9
-rw-r--r--app/views/referentials/select_compliance_control_set.html.slim9
-rw-r--r--app/views/referentials/show.html.slim13
-rw-r--r--app/views/routes/edit.html.slim7
-rw-r--r--app/views/routes/new.html.slim6
-rw-r--r--app/views/routes/show.html.slim13
-rw-r--r--app/views/routing_constraint_zones/edit.html.slim7
-rw-r--r--app/views/routing_constraint_zones/index.html.slim10
-rw-r--r--app/views/routing_constraint_zones/new.html.slim4
-rw-r--r--app/views/routing_constraint_zones/show.html.slim10
-rw-r--r--app/views/stop_area_referentials/show.html.slim11
-rw-r--r--app/views/stop_areas/_form.html.slim180
-rw-r--r--app/views/stop_areas/edit.html.slim8
-rw-r--r--app/views/stop_areas/index.html.slim12
-rw-r--r--app/views/stop_areas/new.html.slim7
-rw-r--r--app/views/stop_areas/select_parent.html.slim4
-rw-r--r--app/views/stop_areas/show.html.slim7
-rw-r--r--app/views/time_table_combinations/new.html.slim6
-rw-r--r--app/views/time_tables/edit.html.slim7
-rw-r--r--app/views/time_tables/index.html.slim9
-rw-r--r--app/views/time_tables/new.html.slim7
-rw-r--r--app/views/time_tables/show.html.slim16
-rw-r--r--app/views/vehicle_journeys/index.html.slim7
-rw-r--r--app/views/vehicle_journeys/show.html.slim3
-rw-r--r--app/views/workbenches/index.html.slim5
-rw-r--r--app/views/workbenches/show.html.slim9
-rw-r--r--config/breadcrumbs.rb7
-rw-r--r--config/initializers/simple_form_bootstrap.rb11
-rw-r--r--config/locales/calendars.en.yml4
-rw-r--r--config/locales/calendars.fr.yml4
-rw-r--r--config/locales/companies.en.yml4
-rw-r--r--config/locales/companies.fr.yml4
-rw-r--r--config/locales/compliance_check_sets.en.yml10
-rw-r--r--config/locales/compliance_check_sets.fr.yml10
-rw-r--r--config/locales/en.yml4
-rw-r--r--config/locales/enumerize.en.yml12
-rw-r--r--config/locales/enumerize.fr.yml11
-rw-r--r--config/locales/fr.yml4
-rw-r--r--config/locales/imports.en.yml1
-rw-r--r--config/locales/imports.fr.yml1
-rw-r--r--config/locales/journey_patterns.en.yml2
-rw-r--r--config/locales/journey_patterns.fr.yml2
-rw-r--r--config/locales/line_referentials.en.yml2
-rw-r--r--config/locales/line_referentials.fr.yml2
-rw-r--r--config/locales/lines.en.yml8
-rw-r--r--config/locales/lines.fr.yml8
-rw-r--r--config/locales/networks.en.yml2
-rw-r--r--config/locales/networks.fr.yml4
-rw-r--r--config/locales/routes.en.yml6
-rw-r--r--config/locales/routes.fr.yml6
-rw-r--r--config/locales/routing_constraint_zones.en.yml4
-rw-r--r--config/locales/routing_constraint_zones.fr.yml4
-rw-r--r--config/locales/source_types.en.yml13
-rw-r--r--config/locales/source_types.fr.yml13
-rw-r--r--config/locales/stop_areas.fr.yml4
-rw-r--r--config/locales/time_tables.en.yml4
-rw-r--r--config/locales/time_tables.fr.yml2
-rw-r--r--config/locales/workbenches.en.yml2
-rw-r--r--config/locales/workbenches.fr.yml2
-rw-r--r--db/migrate/20171109100955_add_object_id_format_to_workbenches.rb2
-rw-r--r--db/migrate/20171109101523_add_object_id_format_to_referential.rb2
-rw-r--r--db/migrate/20171109101545_add_object_id_format_to_line_referential.rb2
-rw-r--r--db/migrate/20171109101605_add_object_id_format_to_stop_area_referential.rb2
-rw-r--r--db/migrate/20171121142536_create_versions.rb34
-rw-r--r--db/migrate/20171121153506_remove_creator_id.rb11
-rw-r--r--db/migrate/20171121163631_remove_creator_from_compliance_check_sets.rb5
-rw-r--r--db/migrate/20171128112629_delete_referential_foreign_key_for_compliance_check_set.rb9
-rw-r--r--db/migrate/20171130172926_delete_compliance_control_set_foreign_key_for_compliance_check_set.rb10
-rw-r--r--db/migrate/20171130180144_change_item_id_in_versions_to_bigint.rb8
-rw-r--r--db/schema.rb76
-rw-r--r--db/seeds.rb1
-rw-r--r--db/seeds/chouette.seeds.rb6
-rw-r--r--db/seeds/stif.rb38
-rw-r--r--spec/db/schema_spec.rb2
-rw-r--r--spec/models/api/v1/api_key_spec.rb1
-rw-r--r--spec/models/calendar_spec.rb2
-rw-r--r--spec/models/chouette/access_link_spec.rb1
-rw-r--r--spec/models/chouette/access_point_spec.rb1
-rw-r--r--spec/models/chouette/company_spec.rb1
-rw-r--r--spec/models/chouette/connection_link_spec.rb1
-rw-r--r--spec/models/chouette/group_of_line_spec.rb1
-rw-r--r--spec/models/chouette/journey_pattern_spec.rb2
-rw-r--r--spec/models/chouette/line_spec.rb1
-rw-r--r--spec/models/chouette/network_spec.rb1
-rw-r--r--spec/models/chouette/route/route_base_spec.rb1
-rw-r--r--spec/models/chouette/routing_constraint_zone_spec.rb1
-rw-r--r--spec/models/chouette/stop_area_spec.rb1
-rw-r--r--spec/models/chouette/stop_point_spec.rb1
-rw-r--r--spec/models/chouette/time_table_spec.rb1
-rw-r--r--spec/models/chouette/timeband_spec.rb1
-rw-r--r--spec/models/chouette/vehicle_journey_spec.rb1
-rw-r--r--spec/models/compliance_check_set_spec.rb10
-rw-r--r--spec/models/compliance_check_spec.rb1
-rw-r--r--spec/models/compliance_control_set_spec.rb1
-rw-r--r--spec/policies/company_policy_spec.rb11
-rw-r--r--spec/policies/import_policy_spec.rb14
-rw-r--r--spec/policies/line_policy_spec.rb11
-rw-r--r--spec/policies/stop_area_policy_spec.rb11
-rw-r--r--spec/rails_helper.rb1
-rw-r--r--spec/spec_helper.rb1
-rw-r--r--spec/views/companies/edit.html.erb_spec.rb8
-rw-r--r--spec/views/companies/show.html.erb_spec.rb16
-rw-r--r--spec/views/lines/edit.html.erb_spec.rb7
-rw-r--r--spec/views/lines/show.html.erb_spec.rb21
-rw-r--r--spec/views/networks/edit.html.erb_spec.rb7
-rw-r--r--spec/views/networks/show.html.erb_spec.rb16
-rw-r--r--spec/views/routes/show.html.erb_spec.rb16
-rw-r--r--spec/views/stop_areas/edit.html.erb_spec.rb7
-rw-r--r--spec/views/stop_areas/show.html.erb_spec.rb16
-rw-r--r--spec/views/time_tables/edit.html.erb_spec.rb8
-rw-r--r--spec/views/time_tables/show.html.erb_spec.rb16
289 files changed, 1056 insertions, 1217 deletions
diff --git a/Gemfile b/Gemfile
index 88fd635ea..3c625a530 100644
--- a/Gemfile
+++ b/Gemfile
@@ -33,6 +33,9 @@ gem 'spring', group: :development
# ActiveRecord associations on top of PostgreSQL arrays
gem 'has_array_of', af83: 'has_array_of'
+# Track changes to your models' data. Good for auditing or versioning.
+gem 'paper_trail'
+
gem 'rails-observers'
# Use SeedBank for spliting seeds
diff --git a/Gemfile.lock b/Gemfile.lock
index 9262eeb74..f9682dff1 100644
--- a/Gemfile.lock
+++ b/Gemfile.lock
@@ -321,6 +321,10 @@ GEM
mini_portile2 (~> 2.3.0)
open4 (1.3.4)
orm_adapter (0.5.0)
+ paper_trail (4.1.0)
+ activerecord (>= 3.0, < 6.0)
+ activesupport (>= 3.0, < 6.0)
+ request_store (~> 1.1)
parser (2.4.0.0)
ast (~> 2.2)
pg (0.20.0)
@@ -621,6 +625,7 @@ DEPENDENCIES
map_layers (= 0.0.4)
mimemagic
newrelic_rpm
+ paper_trail
pg
phantomjs
poltergeist
diff --git a/app/assets/stylesheets/components/_device.sass b/app/assets/stylesheets/components/_device.sass
new file mode 100644
index 000000000..0e773c29c
--- /dev/null
+++ b/app/assets/stylesheets/components/_device.sass
@@ -0,0 +1,9 @@
+#sessions_new
+ li
+ list-style: none
+ .login
+ .checkbox
+ width: 100%
+ .panel-body
+ padding-left: 35px !important
+ padding-right: 35px !important \ No newline at end of file
diff --git a/app/assets/stylesheets/components/_forms.sass b/app/assets/stylesheets/components/_forms.sass
index 2b715d669..9a363ab97 100644
--- a/app/assets/stylesheets/components/_forms.sass
+++ b/app/assets/stylesheets/components/_forms.sass
@@ -531,6 +531,12 @@ table, .table
&.open > .control-label + *
display: block
+ &.search
+ width: 30%
+ > .search_bar
+ padding: 0 15px
+ > .input-group-btn
+ right: 5%
> .filter_menu
margin: 0
diff --git a/app/assets/stylesheets/components/_page_header.sass b/app/assets/stylesheets/components/_page_header.sass
index 566f46d6b..30b88f2c1 100644
--- a/app/assets/stylesheets/components/_page_header.sass
+++ b/app/assets/stylesheets/components/_page_header.sass
@@ -59,7 +59,6 @@
.page-action
line-height: 42px
- height: 45px
margin-bottom: 10px
text-align: right
diff --git a/app/assets/stylesheets/typography/_sboiv.sass b/app/assets/stylesheets/typography/_sboiv.sass
index e37f89f2d..6c82a5739 100644
--- a/app/assets/stylesheets/typography/_sboiv.sass
+++ b/app/assets/stylesheets/typography/_sboiv.sass
@@ -62,25 +62,25 @@
.sb-ZDEP:before
content: '\e906'
-.sb-transporteur:before
+.sb-company:before
content: '\e907'
.sb-trace:before
content: '\e908'
-.sb-tableau-de-bord:before
+.sb-dashboard:before
content: '\e909'
-.sb-synchro-ilico:before
+.sb-line_referential:before
content: '\e90a'
-.sb-synchro-icar:before
+.sb-stop_area_referential:before
content: '\e90b'
-.sb-reseau:before
+.sb-network:before
content: '\e90c'
-.sb-rapport-de-controle:before
+.sb-compliance-check-set:before
content: '\e90d'
.sb-OAT:before
@@ -89,10 +89,10 @@
.sb-OAS:before
content: '\e90f'
-.sb-modele-calendrier:before
+.sb-calendar:before
content: '\e910'
-.sb-mission:before
+.sb-journey_pattern:before
content: '\e911'
.sb-ligne_commerciale:before
@@ -104,28 +104,28 @@
.sb-LDA:before
content: '\e914'
-.sb-jeux-de-donnees:before
+.sb-referential:before
content: '\e915'
-.sb-jeux-de-controle:before
+.sb-compliance_control_set:before
content: '\e916'
-.sb-itl:before
+.sb-routing_constraint_zone:before
content: '\e917'
-.sb-itineraire:before
+.sb-route:before
content: '\e918'
-.sb-importer:before
+.sb-import:before
content: '\e919'
-.sb-horaires-des-courses:before
+.sb-vehicle_journey:before
content: '\e91a'
-.sb-calendrier-application:before
+.sb-time_table:before
content: '\e91b'
-.sb-arret:before
+.sb-stop_area:before
content: '\e91c'
.sb-Acces:before
@@ -143,5 +143,5 @@
.sb-update-vj:before
content: '\e900'
-.sb-ligne:before
+.sb-line:before
content: '\e91e'
diff --git a/app/controllers/access_links_controller.rb b/app/controllers/access_links_controller.rb
index 936b8ea5e..19b3eb742 100644
--- a/app/controllers/access_links_controller.rb
+++ b/app/controllers/access_links_controller.rb
@@ -1,4 +1,5 @@
class AccessLinksController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => Chouette::AccessLink
belongs_to :referential do
@@ -83,7 +84,7 @@ class AccessLinksController < ChouetteController
private
def access_link_params
- params.require(:access_link).permit(:access_link_type,:access_point_id, :stop_area_id, :objectid, :object_version, :creator_id, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :link_orientation, :link_orientation_type, :stop_area )
+ params.require(:access_link).permit(:access_link_type,:access_point_id, :stop_area_id, :objectid, :object_version, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :link_orientation, :link_orientation_type, :stop_area )
end
end
diff --git a/app/controllers/access_points_controller.rb b/app/controllers/access_points_controller.rb
index 477875cc9..112a13a86 100644
--- a/app/controllers/access_points_controller.rb
+++ b/app/controllers/access_points_controller.rb
@@ -1,4 +1,5 @@
class AccessPointsController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => Chouette::AccessPoint
belongs_to :referential do
@@ -63,7 +64,7 @@ class AccessPointsController < ChouetteController
private
def access_point_params
- params.require(:access_point).permit( :objectid, :object_version, :creator_id, :name, :comment, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :openning_time, :closing_time, :access_type, :access_point_type, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :stop_area_id, :coordinates )
+ params.require(:access_point).permit( :objectid, :object_version, :name, :comment, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :openning_time, :closing_time, :access_type, :access_point_type, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :stop_area_id, :coordinates )
end
end
diff --git a/app/controllers/api_keys_controller.rb b/app/controllers/api_keys_controller.rb
index eebad5e7b..9706c5961 100644
--- a/app/controllers/api_keys_controller.rb
+++ b/app/controllers/api_keys_controller.rb
@@ -1,4 +1,4 @@
-class ApiKeysController < InheritedResources::Base
+class ApiKeysController < ChouetteController
defaults resource_class: Api::V1::ApiKey
include PolicyChecker
diff --git a/app/controllers/application_controller.rb b/app/controllers/application_controller.rb
index 6a9f6942f..97f5548ae 100644
--- a/app/controllers/application_controller.rb
+++ b/app/controllers/application_controller.rb
@@ -1,5 +1,7 @@
class ApplicationController < ActionController::Base
+ include PaperTrailSupport
include Pundit
+
rescue_from Pundit::NotAuthorizedError, with: :user_not_authorized
# TODO : Delete hack to authorize Cross Request for js and json get request from javascript
diff --git a/app/controllers/autocomplete_stop_areas_controller.rb b/app/controllers/autocomplete_stop_areas_controller.rb
index e35a545ae..233012028 100644
--- a/app/controllers/autocomplete_stop_areas_controller.rb
+++ b/app/controllers/autocomplete_stop_areas_controller.rb
@@ -1,4 +1,4 @@
-class AutocompleteStopAreasController < InheritedResources::Base
+class AutocompleteStopAreasController < ChouetteController
respond_to :json, :only => [:index, :children, :parent, :physicals]
include ReferentialSupport
diff --git a/app/controllers/autocomplete_time_tables_controller.rb b/app/controllers/autocomplete_time_tables_controller.rb
index f65f5b9f6..0a9f51ced 100644
--- a/app/controllers/autocomplete_time_tables_controller.rb
+++ b/app/controllers/autocomplete_time_tables_controller.rb
@@ -1,4 +1,4 @@
-class AutocompleteTimeTablesController < InheritedResources::Base
+class AutocompleteTimeTablesController < ChouetteController
respond_to :json, :only => [:index]
before_action :switch_referential
diff --git a/app/controllers/autocomplete_timebands_controller.rb b/app/controllers/autocomplete_timebands_controller.rb
index 4922e214c..af041c33e 100644
--- a/app/controllers/autocomplete_timebands_controller.rb
+++ b/app/controllers/autocomplete_timebands_controller.rb
@@ -1,4 +1,4 @@
-class AutocompleteTimebandsController < InheritedResources::Base
+class AutocompleteTimebandsController < ChouetteController
respond_to :json, :only => [:index]
include ReferentialSupport
diff --git a/app/controllers/calendars_controller.rb b/app/controllers/calendars_controller.rb
index e9ee7579a..2ed10a111 100644
--- a/app/controllers/calendars_controller.rb
+++ b/app/controllers/calendars_controller.rb
@@ -1,4 +1,4 @@
-class CalendarsController < InheritedResources::Base
+class CalendarsController < ChouetteController
include PolicyChecker
defaults resource_class: Calendar
before_action :ransack_contains_date, only: [:index]
diff --git a/app/controllers/chouette_controller.rb b/app/controllers/chouette_controller.rb
index 1313aa7cc..3e4f3af27 100644
--- a/app/controllers/chouette_controller.rb
+++ b/app/controllers/chouette_controller.rb
@@ -1,5 +1,4 @@
class ChouetteController < InheritedResources::Base
-
+ include PaperTrailSupport
include ApplicationHelper
- include ReferentialSupport
end
diff --git a/app/controllers/clean_ups_controller.rb b/app/controllers/clean_ups_controller.rb
index b9ff225b3..ec28aa0fc 100644
--- a/app/controllers/clean_ups_controller.rb
+++ b/app/controllers/clean_ups_controller.rb
@@ -1,4 +1,5 @@
class CleanUpsController < ChouetteController
+ include ReferentialSupport
respond_to :html, :only => [:create]
belongs_to :referential
diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb
index bc5bedd7f..931d846c5 100644
--- a/app/controllers/companies_controller.rb
+++ b/app/controllers/companies_controller.rb
@@ -1,4 +1,4 @@
-class CompaniesController < InheritedResources::Base
+class CompaniesController < ChouetteController
include ApplicationHelper
include PolicyChecker
defaults :resource_class => Chouette::Company
@@ -62,7 +62,7 @@ class CompaniesController < InheritedResources::Base
helper_method :current_referential
def company_params
- params.require(:company).permit( :objectid, :object_version, :creator_id, :name, :short_name, :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number, :url, :time_zone )
+ params.require(:company).permit( :objectid, :object_version, :name, :short_name, :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number, :url, :time_zone )
end
private
diff --git a/app/controllers/compliance_check_sets_controller.rb b/app/controllers/compliance_check_sets_controller.rb
index 175c22191..600c69126 100644
--- a/app/controllers/compliance_check_sets_controller.rb
+++ b/app/controllers/compliance_check_sets_controller.rb
@@ -1,4 +1,4 @@
-class ComplianceCheckSetsController < InheritedResources::Base
+class ComplianceCheckSetsController < ChouetteController
defaults resource_class: ComplianceCheckSet
include RansackDateFilter
before_action only: [:index] { set_date_time_params("created_at", DateTime) }
@@ -12,18 +12,26 @@ class ComplianceCheckSetsController < InheritedResources::Base
@q_for_form = scope.ransack(params[:q])
format.html {
@compliance_check_sets = ModelDecorator.decorate(
- @q_for_form.result,
+ @q_for_form.result.order(created_at: :desc),
with: ComplianceCheckSetDecorator
)
}
end
end
+ def show
+ show! do
+ @compliance_check_set = @compliance_check_set.decorate(context: {
+ compliance_check_set: @compliance_check_set
+ })
+ end
+ end
+
def executed
- show! do |format|
+ show! do |format|
# But now nobody is aware anymore that `format.html` passes a parameter into the block
format.html { executed_for_html }
- end
+ end
end
diff --git a/app/controllers/compliance_control_blocks_controller.rb b/app/controllers/compliance_control_blocks_controller.rb
index f53a1e04a..9eee8dfaf 100644
--- a/app/controllers/compliance_control_blocks_controller.rb
+++ b/app/controllers/compliance_control_blocks_controller.rb
@@ -1,4 +1,4 @@
-class ComplianceControlBlocksController < InheritedResources::Base
+class ComplianceControlBlocksController < ChouetteController
include PolicyChecker
defaults resource_class: ComplianceControlBlock
belongs_to :compliance_control_set
diff --git a/app/controllers/compliance_control_sets_controller.rb b/app/controllers/compliance_control_sets_controller.rb
index 83a345c6f..2d3d03ad0 100644
--- a/app/controllers/compliance_control_sets_controller.rb
+++ b/app/controllers/compliance_control_sets_controller.rb
@@ -1,4 +1,4 @@
-class ComplianceControlSetsController < InheritedResources::Base
+class ComplianceControlSetsController < ChouetteController
include PolicyChecker
defaults resource_class: ComplianceControlSet
include RansackDateFilter
diff --git a/app/controllers/compliance_controls_controller.rb b/app/controllers/compliance_controls_controller.rb
index 5a9c0b671..dfbecaa71 100644
--- a/app/controllers/compliance_controls_controller.rb
+++ b/app/controllers/compliance_controls_controller.rb
@@ -1,4 +1,4 @@
-class ComplianceControlsController < InheritedResources::Base
+class ComplianceControlsController < ChouetteController
include PolicyChecker
defaults resource_class: ComplianceControl
belongs_to :compliance_control_set
diff --git a/app/controllers/concerns/paper_trail_support.rb b/app/controllers/concerns/paper_trail_support.rb
new file mode 100644
index 000000000..4b0b1a7c7
--- /dev/null
+++ b/app/controllers/concerns/paper_trail_support.rb
@@ -0,0 +1,11 @@
+module PaperTrailSupport
+ extend ActiveSupport::Concern
+
+ included do
+ before_action :set_paper_trail_whodunnit
+
+ def user_for_paper_trail
+ current_user ? current_user.name : ''
+ end
+ end
+end
diff --git a/app/controllers/connection_link_areas_controller.rb b/app/controllers/connection_link_areas_controller.rb
index eceb1b0fc..981a7639e 100644
--- a/app/controllers/connection_link_areas_controller.rb
+++ b/app/controllers/connection_link_areas_controller.rb
@@ -1,16 +1,17 @@
class ConnectionLinkAreasController < ChouetteController
+ include ReferentialSupport
respond_to :json, :only => :index
def index
- respond_to do |format|
- format.json { render :json => areas_maps }
- end
+ respond_to do |format|
+ format.json { render :json => areas_maps }
+ end
end
def areas_maps
areas.collect do |area|
- { :id => area.id.to_s,
+ { :id => area.id.to_s,
:name => area.name,
:country_code => area.country_code,
:zip_code => area.zip_code || "",
@@ -20,8 +21,8 @@ class ConnectionLinkAreasController < ChouetteController
end
end
- def areas
- referential.connection_links.find(params[:connection_link_id]).possible_areas.select{ |p| p.name =~ /#{params[:q]}/i }
+ def areas
+ referential.connection_links.find(params[:connection_link_id]).possible_areas.select{ |p| p.name =~ /#{params[:q]}/i }
end
end
diff --git a/app/controllers/connection_links_controller.rb b/app/controllers/connection_links_controller.rb
index b56450291..f14868776 100644
--- a/app/controllers/connection_links_controller.rb
+++ b/app/controllers/connection_links_controller.rb
@@ -1,4 +1,5 @@
class ConnectionLinksController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => Chouette::ConnectionLink
belongs_to :referential do
@@ -53,7 +54,7 @@ class ConnectionLinksController < ChouetteController
private
def connection_link_params
- params.require(:connection_link).permit( :connection_link_type,:departure_id, :arrival_id, :objectid, :object_version, :creator_id, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs )
+ params.require(:connection_link).permit( :connection_link_type,:departure_id, :arrival_id, :objectid, :object_version, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs )
end
end
diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb
index 1c7876c58..c90d0c296 100644
--- a/app/controllers/dashboards_controller.rb
+++ b/app/controllers/dashboards_controller.rb
@@ -3,8 +3,9 @@
# this controller will use a custom partial like
# custom/dashboards/_dashboard.html.slim for Custom::Dashboard
#
-class DashboardsController < InheritedResources::Base
+class DashboardsController < ChouetteController
respond_to :html, only: [:show]
+ defaults :resource_class => Dashboard
def show
@dashboard = Dashboard.create self
diff --git a/app/controllers/export_tasks_controller.rb b/app/controllers/export_tasks_controller.rb
index 2b30a5605..b889c1882 100644
--- a/app/controllers/export_tasks_controller.rb
+++ b/app/controllers/export_tasks_controller.rb
@@ -1,6 +1,7 @@
class ExportTasksController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => ExportTask
-
+
respond_to :html, :only => [:new, :create]
respond_to :js, :only => [:new, :create]
belongs_to :referential
@@ -15,10 +16,10 @@ class ExportTasksController < ChouetteController
redirect_to referential_path(@referential)
end
end
-
+
def create
@available_exports = available_exports
- begin
+ begin
create! do |success, failure|
success.html { redirect_to referential_exports_path(@referential) }
end
@@ -62,7 +63,7 @@ class ExportTasksController < ChouetteController
end
end
- def build_resource
+ def build_resource
@export_task ||= if params[:export_task].present?
export_task_parameters = params[:export_task]
case export_task_parameters[:data_format]
@@ -80,7 +81,7 @@ class ExportTasksController < ChouetteController
else
NeptuneExport.new
end
-
+
end
-
+
end
diff --git a/app/controllers/exports_controller.rb b/app/controllers/exports_controller.rb
index ad88c6dae..ccc163e34 100644
--- a/app/controllers/exports_controller.rb
+++ b/app/controllers/exports_controller.rb
@@ -2,6 +2,7 @@ require 'will_paginate/array'
require 'open-uri'
class ExportsController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => Export
respond_to :html, :only => [:show, :index, :destroy, :exported_file]
diff --git a/app/controllers/group_of_lines_controller.rb b/app/controllers/group_of_lines_controller.rb
index 1a59d39f7..5762108dc 100644
--- a/app/controllers/group_of_lines_controller.rb
+++ b/app/controllers/group_of_lines_controller.rb
@@ -1,4 +1,4 @@
-class GroupOfLinesController < InheritedResources::Base
+class GroupOfLinesController < ChouetteController
include ApplicationHelper
include PolicyChecker
defaults :resource_class => Chouette::GroupOfLine
@@ -73,7 +73,7 @@ class GroupOfLinesController < InheritedResources::Base
private
def group_of_line_params
- params.require(:group_of_line).permit( :objectid, :object_version, :creator_id, :name, :comment, :lines, :registration_number, :line_tokens)
+ params.require(:group_of_line).permit( :objectid, :object_version, :name, :comment, :lines, :registration_number, :line_tokens)
end
end
diff --git a/app/controllers/import_messages_controller.rb b/app/controllers/import_messages_controller.rb
index c3c6b46b5..6546b25f8 100644
--- a/app/controllers/import_messages_controller.rb
+++ b/app/controllers/import_messages_controller.rb
@@ -1,4 +1,4 @@
-class ImportMessagesController < InheritedResources::Base
+class ImportMessagesController < ChouetteController
defaults resource_class: ImportMessage, collection_name: 'import_messages', instance_name: 'import_message'
respond_to :csv
belongs_to :import, :parent_class => Import do
diff --git a/app/controllers/import_resources_controller.rb b/app/controllers/import_resources_controller.rb
index 3e52233f2..c83721310 100644
--- a/app/controllers/import_resources_controller.rb
+++ b/app/controllers/import_resources_controller.rb
@@ -1,4 +1,4 @@
-class ImportResourcesController < InheritedResources::Base
+class ImportResourcesController < ChouetteController
defaults resource_class: ImportResource, collection_name: 'import_resources', instance_name: 'import_resource'
respond_to :html
belongs_to :import
diff --git a/app/controllers/import_tasks_controller.rb b/app/controllers/import_tasks_controller.rb
index cb377ec5a..1a349087d 100644
--- a/app/controllers/import_tasks_controller.rb
+++ b/app/controllers/import_tasks_controller.rb
@@ -1,6 +1,7 @@
class ImportTasksController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => ImportTask
-
+
respond_to :html, :only => [:new, :create]
respond_to :js, :only => [:new, :create]
belongs_to :referential
@@ -15,10 +16,10 @@ class ImportTasksController < ChouetteController
redirect_to referential_path(@referential)
end
end
-
+
def create
@available_imports = available_imports
- begin
+ begin
create! do |success, failure|
success.html { redirect_to referential_imports_path(@referential) }
end
@@ -33,14 +34,14 @@ class ImportTasksController < ChouetteController
def available_imports
import_task_parameters = params[:import_task]
-
+
if import_task_parameters.present?
@available_imports = [
import_task_parameters[:data_format] == "neptune" ? build_resource : NeptuneImport.new(:referential_id => @referential.id ),
import_task_parameters[:data_format] == "netex" ? build_resource : NetexImport.new(:referential_id => @referential.id ),
import_task_parameters[:data_format] == "gtfs" ? build_resource : GtfsImport.new(:referential_id => @referential.id )
]
- else
+ else
@available_imports = [
NeptuneImport.new(:referential_id => @referential.id ),
NetexImport.new(:referential_id => @referential.id ),
@@ -48,7 +49,7 @@ class ImportTasksController < ChouetteController
]
end
end
-
+
def build_resource
@import_task ||= if params[:import_task].present?
import_task_parameters = params[:import_task]
@@ -64,5 +65,5 @@ class ImportTasksController < ChouetteController
@import_task = NeptuneImport.new
end
end
-
+
end
diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb
index 6c9d81d82..46d34efda 100644
--- a/app/controllers/imports_controller.rb
+++ b/app/controllers/imports_controller.rb
@@ -1,4 +1,4 @@
-class ImportsController < InheritedResources::Base
+class ImportsController < ChouetteController
include PolicyChecker
include RansackDateFilter
before_action only: [:index] { set_date_time_params("started_at", DateTime) }
@@ -77,10 +77,10 @@ class ImportsController < InheritedResources::Base
end
def sort_column
- parent.imports.column_names.include?(params[:sort]) ? params[:sort] : 'name'
+ parent.imports.column_names.include?(params[:sort]) ? params[:sort] : 'created_at'
end
def sort_direction
- %w[asc desc].include?(params[:direction]) ? params[:direction] : 'asc'
+ %w[asc desc].include?(params[:direction]) ? params[:direction] : 'desc'
end
def decorate_imports(imports)
diff --git a/app/controllers/journey_pattern_stop_points_controller.rb b/app/controllers/journey_pattern_stop_points_controller.rb
index c4fc9b08f..65e41af3b 100644
--- a/app/controllers/journey_pattern_stop_points_controller.rb
+++ b/app/controllers/journey_pattern_stop_points_controller.rb
@@ -1,4 +1,5 @@
class JourneyPatternStopPointsController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => Chouette::JourneyPattern
respond_to :html
diff --git a/app/controllers/journey_patterns_collections_controller.rb b/app/controllers/journey_patterns_collections_controller.rb
index 546158fa8..736fb1441 100644
--- a/app/controllers/journey_patterns_collections_controller.rb
+++ b/app/controllers/journey_patterns_collections_controller.rb
@@ -1,4 +1,5 @@
class JourneyPatternsCollectionsController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => Chouette::JourneyPattern
before_action :user_permissions, only: :show
diff --git a/app/controllers/journey_patterns_controller.rb b/app/controllers/journey_patterns_controller.rb
index a72e7da7f..881ab6630 100644
--- a/app/controllers/journey_patterns_controller.rb
+++ b/app/controllers/journey_patterns_controller.rb
@@ -1,4 +1,5 @@
class JourneyPatternsController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => Chouette::JourneyPattern
respond_to :html
@@ -54,7 +55,7 @@ class JourneyPatternsController < ChouetteController
private
def journey_pattern_params
- params.require(:journey_pattern).permit(:route_id, :objectid, :object_version, :creator_id, :name, :comment, :registration_number, :published_name, :departure_stop_point_id, :arrival_stop_point_id, {:stop_point_ids => []})
+ params.require(:journey_pattern).permit(:route_id, :objectid, :object_version, :name, :comment, :registration_number, :published_name, :departure_stop_point_id, :arrival_stop_point_id, {:stop_point_ids => []})
end
end
diff --git a/app/controllers/line_footnotes_controller.rb b/app/controllers/line_footnotes_controller.rb
index 2d4d10064..1fe677a39 100644
--- a/app/controllers/line_footnotes_controller.rb
+++ b/app/controllers/line_footnotes_controller.rb
@@ -1,4 +1,5 @@
class LineFootnotesController < ChouetteController
+ include ReferentialSupport
defaults resource_class: Chouette::Line, collection_name: 'lines', instance_name: 'line'
belongs_to :referential
diff --git a/app/controllers/line_referentials_controller.rb b/app/controllers/line_referentials_controller.rb
index f70ddef41..39c2cdb89 100644
--- a/app/controllers/line_referentials_controller.rb
+++ b/app/controllers/line_referentials_controller.rb
@@ -1,4 +1,4 @@
-class LineReferentialsController < InheritedResources::Base
+class LineReferentialsController < ChouetteController
defaults :resource_class => LineReferential
diff --git a/app/controllers/lines_controller.rb b/app/controllers/lines_controller.rb
index cf2908500..2f0ef1542 100644
--- a/app/controllers/lines_controller.rb
+++ b/app/controllers/lines_controller.rb
@@ -1,4 +1,4 @@
-class LinesController < InheritedResources::Base
+class LinesController < ChouetteController
include ApplicationHelper
include PolicyChecker
defaults :resource_class => Chouette::Line
@@ -119,7 +119,6 @@ class LinesController < InheritedResources::Base
:company_id,
:objectid,
:object_version,
- :creator_id,
:name,
:number,
:published_name,
diff --git a/app/controllers/networks_controller.rb b/app/controllers/networks_controller.rb
index 98c840777..494d1e69f 100644
--- a/app/controllers/networks_controller.rb
+++ b/app/controllers/networks_controller.rb
@@ -1,4 +1,4 @@
-class NetworksController < InheritedResources::Base
+class NetworksController < ChouetteController
include ApplicationHelper
include PolicyChecker
defaults :resource_class => Chouette::Network
@@ -22,10 +22,12 @@ class NetworksController < InheritedResources::Base
def new
authorize resource_class
+ new!
end
def create
authorize resource_class
+ create!
end
def index
@@ -70,7 +72,7 @@ class NetworksController < InheritedResources::Base
helper_method :current_referential
def network_params
- params.require(:network).permit(:objectid, :object_version, :creator_id, :version_date, :description, :name, :registration_number, :source_name, :source_type_name, :source_identifier, :comment )
+ params.require(:network).permit(:objectid, :object_version, :version_date, :description, :name, :registration_number, :source_name, :source_type_name, :source_identifier, :comment )
end
private
diff --git a/app/controllers/organisations_controller.rb b/app/controllers/organisations_controller.rb
index d80541800..fa521faaf 100644
--- a/app/controllers/organisations_controller.rb
+++ b/app/controllers/organisations_controller.rb
@@ -1,4 +1,4 @@
-class OrganisationsController < InheritedResources::Base
+class OrganisationsController < ChouetteController
defaults :resource_class => Organisation
respond_to :html, :only => [:edit, :show, :update]
diff --git a/app/controllers/referential_companies_controller.rb b/app/controllers/referential_companies_controller.rb
index fdbd83dc9..ca1ff67db 100644
--- a/app/controllers/referential_companies_controller.rb
+++ b/app/controllers/referential_companies_controller.rb
@@ -1,4 +1,5 @@
class ReferentialCompaniesController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => Chouette::Company, :collection_name => 'companies', :instance_name => 'company'
respond_to :html
respond_to :xml
@@ -55,7 +56,7 @@ class ReferentialCompaniesController < ChouetteController
end
def company_params
- params.require(:company).permit( :objectid, :object_version, :creator_id, :name, :short_name, :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number, :url, :time_zone )
+ params.require(:company).permit( :objectid, :object_version, :name, :short_name, :organizational_unit, :operating_department_name, :code, :phone, :fax, :email, :registration_number, :url, :time_zone )
end
private
diff --git a/app/controllers/referential_group_of_lines_controller.rb b/app/controllers/referential_group_of_lines_controller.rb
index d88daab84..1294fc5d5 100644
--- a/app/controllers/referential_group_of_lines_controller.rb
+++ b/app/controllers/referential_group_of_lines_controller.rb
@@ -1,4 +1,5 @@
class ReferentialGroupOfLinesController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => Chouette::GroupOfLine, :collection_name => 'group_of_lines', :instance_name => 'group_of_line'
respond_to :html
@@ -68,7 +69,7 @@ class ReferentialGroupOfLinesController < ChouetteController
private
def group_of_line_params
- params.require(:group_of_line).permit( :objectid, :object_version, :creator_id, :name, :comment, :lines, :registration_number, :line_tokens)
+ params.require(:group_of_line).permit( :objectid, :object_version, :name, :comment, :lines, :registration_number, :line_tokens)
end
end
diff --git a/app/controllers/referential_lines_controller.rb b/app/controllers/referential_lines_controller.rb
index b9f8c0050..9e8f5c512 100644
--- a/app/controllers/referential_lines_controller.rb
+++ b/app/controllers/referential_lines_controller.rb
@@ -1,4 +1,5 @@
class ReferentialLinesController < ChouetteController
+ include ReferentialSupport
include PolicyChecker
defaults :resource_class => Chouette::Line, :collection_name => 'lines', :instance_name => 'line'
@@ -127,7 +128,6 @@ class ReferentialLinesController < ChouetteController
:company_id,
:objectid,
:object_version,
- :creator_id,
:name, :number,
:published_name,
:transport_mode,
diff --git a/app/controllers/referential_networks_controller.rb b/app/controllers/referential_networks_controller.rb
index 2131b8e57..b2d83f953 100644
--- a/app/controllers/referential_networks_controller.rb
+++ b/app/controllers/referential_networks_controller.rb
@@ -1,4 +1,5 @@
class ReferentialNetworksController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => Chouette::Network, :collection_name => 'networks', :instance_name => 'network'
respond_to :html
respond_to :xml
@@ -64,7 +65,7 @@ class ReferentialNetworksController < ChouetteController
end
def network_params
- params.require(:network).permit(:objectid, :object_version, :creator_id, :version_date, :description, :name, :registration_number, :source_name, :source_type_name, :source_identifier, :comment )
+ params.require(:network).permit(:objectid, :object_version, :version_date, :description, :name, :registration_number, :source_name, :source_type_name, :source_identifier, :comment )
end
private
diff --git a/app/controllers/referential_stop_areas_controller.rb b/app/controllers/referential_stop_areas_controller.rb
index 78dcd6dd9..0ed330180 100644
--- a/app/controllers/referential_stop_areas_controller.rb
+++ b/app/controllers/referential_stop_areas_controller.rb
@@ -1,5 +1,6 @@
# -*- coding: utf-8 -*-
class ReferentialStopAreasController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => Chouette::StopArea, :collection_name => 'stop_areas', :instance_name => 'stop_area'
belongs_to :referential do
@@ -144,7 +145,7 @@ class ReferentialStopAreasController < ChouetteController
end
def stop_area_params
- params.require(:stop_area).permit( :routing_stop_ids, :routing_line_ids, :children_ids, :stop_area_type, :parent_id, :objectid, :object_version, :creator_id, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :coordinates, :url, :time_zone )
+ params.require(:stop_area).permit( :routing_stop_ids, :routing_line_ids, :children_ids, :stop_area_type, :parent_id, :objectid, :object_version, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :coordinates, :url, :time_zone )
end
end
diff --git a/app/controllers/referentials_controller.rb b/app/controllers/referentials_controller.rb
index b63741ef6..ee1236912 100644
--- a/app/controllers/referentials_controller.rb
+++ b/app/controllers/referentials_controller.rb
@@ -1,4 +1,4 @@
-class ReferentialsController < InheritedResources::Base
+class ReferentialsController < ChouetteController
defaults :resource_class => Referential
include PolicyChecker
diff --git a/app/controllers/route_stop_points_controller.rb b/app/controllers/route_stop_points_controller.rb
index 730bd08a9..36e1cbc4f 100644
--- a/app/controllers/route_stop_points_controller.rb
+++ b/app/controllers/route_stop_points_controller.rb
@@ -1,4 +1,5 @@
class RouteStopPointsController < ChouetteController
+ include ReferentialSupport
defaults resource_class: Chouette::StopPoint
actions :index
respond_to :json, only: :index
diff --git a/app/controllers/routes_controller.rb b/app/controllers/routes_controller.rb
index 1a6c82484..79f49143a 100644
--- a/app/controllers/routes_controller.rb
+++ b/app/controllers/routes_controller.rb
@@ -1,4 +1,5 @@
class RoutesController < ChouetteController
+ include ReferentialSupport
include PolicyChecker
defaults :resource_class => Chouette::Route
@@ -110,7 +111,6 @@ class RoutesController < ChouetteController
:line_id,
:objectid,
:object_version,
- :creator_id,
:name,
:comment,
:opposite_route_id,
diff --git a/app/controllers/routing_constraint_zones_controller.rb b/app/controllers/routing_constraint_zones_controller.rb
index 6c3da5980..a72b288b8 100644
--- a/app/controllers/routing_constraint_zones_controller.rb
+++ b/app/controllers/routing_constraint_zones_controller.rb
@@ -1,4 +1,5 @@
class RoutingConstraintZonesController < ChouetteController
+ include ReferentialSupport
include PolicyChecker
defaults resource_class: Chouette::RoutingConstraintZone
@@ -96,7 +97,6 @@ class RoutingConstraintZonesController < ChouetteController
:route_id,
:objectid,
:object_version,
- :creator_id
)
end
diff --git a/app/controllers/stop_area_copies_controller.rb b/app/controllers/stop_area_copies_controller.rb
index fb429595e..992a2bb08 100644
--- a/app/controllers/stop_area_copies_controller.rb
+++ b/app/controllers/stop_area_copies_controller.rb
@@ -1,13 +1,14 @@
class StopAreaCopiesController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => StopAreaCopy
belongs_to :referential do
- belongs_to :stop_area, :parent_class => Chouette::StopArea
+ belongs_to :stop_area, :parent_class => Chouette::StopArea
end
-
+
actions :new, :create
respond_to :html, :only => :new
-
- def new
+
+ def new
@stop_area_copy = StopAreaCopy.new(:hierarchy => params[:hierarchy], :source => parent)
new! do
build_breadcrumb :new
@@ -25,6 +26,6 @@ class StopAreaCopiesController < ChouetteController
end
end
- protected
+ protected
end
diff --git a/app/controllers/stop_area_referentials_controller.rb b/app/controllers/stop_area_referentials_controller.rb
index e2815e5fb..85541230d 100644
--- a/app/controllers/stop_area_referentials_controller.rb
+++ b/app/controllers/stop_area_referentials_controller.rb
@@ -1,4 +1,4 @@
-class StopAreaReferentialsController < InheritedResources::Base
+class StopAreaReferentialsController < ChouetteController
defaults :resource_class => StopAreaReferential
def sync
diff --git a/app/controllers/stop_area_routing_lines_controller.rb b/app/controllers/stop_area_routing_lines_controller.rb
index 9ba6fb40c..cba0a369c 100644
--- a/app/controllers/stop_area_routing_lines_controller.rb
+++ b/app/controllers/stop_area_routing_lines_controller.rb
@@ -1,11 +1,12 @@
class StopAreaRoutingLinesController < ChouetteController
+ include ReferentialSupport
respond_to :json, :only => :index
def index
- respond_to do |format|
- format.json { render :json => routing_lines_maps }
- end
+ respond_to do |format|
+ format.json { render :json => routing_lines_maps }
+ end
end
def routing_lines_maps
@@ -14,8 +15,8 @@ class StopAreaRoutingLinesController < ChouetteController
end
end
- def routing_lines
- referential.lines.all.select{ |p| p.name =~ /#{params[:q]}/i || p.number =~ /#{params[:q]}/i }
+ def routing_lines
+ referential.lines.all.select{ |p| p.name =~ /#{params[:q]}/i || p.number =~ /#{params[:q]}/i }
end
end
diff --git a/app/controllers/stop_areas_controller.rb b/app/controllers/stop_areas_controller.rb
index 1d6f88068..133518324 100644
--- a/app/controllers/stop_areas_controller.rb
+++ b/app/controllers/stop_areas_controller.rb
@@ -1,4 +1,4 @@
-class StopAreasController < InheritedResources::Base
+class StopAreasController < ChouetteController
include ApplicationHelper
defaults :resource_class => Chouette::StopArea
@@ -64,22 +64,22 @@ class StopAreasController < InheritedResources::Base
def new
authorize resource_class
- @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self)
- @map.editable = true
+ # @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self)
+ # @map.editable = true
new!
end
def create
authorize resource_class
- @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self)
- @map.editable = true
+ # @map = StopAreaMap.new( Chouette::StopArea.new).with_helpers(self)
+ # @map.editable = true
create!
end
def show
- map.editable = false
- @access_points = @stop_area.access_points
+ # map.editable = false
+ # @access_points = @stop_area.access_points
show! do |format|
unless stop_area.position or params[:default] or params[:routing]
format.kml {
@@ -171,7 +171,7 @@ class StopAreasController < InheritedResources::Base
helper_method :current_referential
def stop_area_params
- params.require(:stop_area).permit( :routing_stop_ids, :routing_line_ids, :children_ids, :stop_area_type, :parent_id, :objectid, :object_version, :creator_id, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :coordinates, :url, :time_zone )
+ params.require(:stop_area).permit( :routing_stop_ids, :routing_line_ids, :children_ids, :stop_area_type, :parent_id, :objectid, :object_version, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :zip_code, :city_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :coordinates, :url, :time_zone )
end
end
diff --git a/app/controllers/time_table_combinations_controller.rb b/app/controllers/time_table_combinations_controller.rb
index ba61a2ea4..26cd425b3 100644
--- a/app/controllers/time_table_combinations_controller.rb
+++ b/app/controllers/time_table_combinations_controller.rb
@@ -1,4 +1,5 @@
class TimeTableCombinationsController < ChouetteController
+ include ReferentialSupport
belongs_to :referential do
belongs_to :time_table, :parent_class => Chouette::TimeTable
end
diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb
index 0c1769ad7..a0fa168f0 100644
--- a/app/controllers/time_tables_controller.rb
+++ b/app/controllers/time_tables_controller.rb
@@ -1,4 +1,5 @@
class TimeTablesController < ChouetteController
+ include ReferentialSupport
include TimeTablesHelper
include RansackDateFilter
before_action only: [:index] { set_date_time_params("bounding_dates", Date) }
@@ -179,7 +180,6 @@ class TimeTablesController < ChouetteController
params.require(:time_table).permit(
:objectid,
:object_version,
- :creator_id,
:calendar_id,
:version, :comment, :color,
:int_day_types,
diff --git a/app/controllers/timebands_controller.rb b/app/controllers/timebands_controller.rb
index 765557193..937283b0e 100644
--- a/app/controllers/timebands_controller.rb
+++ b/app/controllers/timebands_controller.rb
@@ -1,4 +1,5 @@
class TimebandsController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => Chouette::Timeband
diff --git a/app/controllers/users_controller.rb b/app/controllers/users_controller.rb
index 2452a2796..6343320a4 100644
--- a/app/controllers/users_controller.rb
+++ b/app/controllers/users_controller.rb
@@ -1,4 +1,4 @@
-class UsersController < InheritedResources::Base
+class UsersController < ChouetteController
defaults :resource_class => User
diff --git a/app/controllers/vehicle_journey_exports_controller.rb b/app/controllers/vehicle_journey_exports_controller.rb
index 0cc30f23a..2ce47e51f 100644
--- a/app/controllers/vehicle_journey_exports_controller.rb
+++ b/app/controllers/vehicle_journey_exports_controller.rb
@@ -1,22 +1,23 @@
class VehicleJourneyExportsController < ChouetteController
+ include ReferentialSupport
belongs_to :referential do
belongs_to :line, :parent_class => Chouette::Line do
belongs_to :route, :parent_class => Chouette::Route
end
end
-
+
respond_to :csv, :only => [:index]
respond_to :zip, :only => [:index]
#respond_to :xls, :only => [:index]
def index
- index! do |format|
+ index! do |format|
format.csv { send_data VehicleJourneyExport.new(:route => route, :vehicle_journeys => vehicle_journeys).to_csv(:col_sep => ";") , :filename => t("vehicle_journey_exports.new.basename")+"_#{route.id}.csv" }
format.zip do
begin
temp_file = Tempfile.new("vehicle_journey_export")
VehicleJourneyExport.new(:route => route, :vehicle_journeys => vehicle_journeys).to_zip(temp_file,:col_sep => ";")
- send_data File.read(temp_file.path), :filename => t("vehicle_journey_exports.new.basename")+"_#{route.id}.zip"
+ send_data File.read(temp_file.path), :filename => t("vehicle_journey_exports.new.basename")+"_#{route.id}.zip"
ensure
temp_file.close
temp_file.unlink
@@ -25,15 +26,15 @@ class VehicleJourneyExportsController < ChouetteController
#format.xls
end
end
-
+
protected
-
-
+
+
alias_method :route, :parent
-
+
def collection
@vehicle_journeys ||= route.vehicle_journeys.includes(:vehicle_journey_at_stops).order("vehicle_journey_at_stops.departure_time")
end
alias_method :vehicle_journeys, :collection
-
+
end
diff --git a/app/controllers/vehicle_journey_imports_controller.rb b/app/controllers/vehicle_journey_imports_controller.rb
index 58f8816aa..aec90f7ec 100644
--- a/app/controllers/vehicle_journey_imports_controller.rb
+++ b/app/controllers/vehicle_journey_imports_controller.rb
@@ -1,4 +1,5 @@
class VehicleJourneyImportsController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => VehicleJourneyImport
belongs_to :referential do
diff --git a/app/controllers/vehicle_journeys_collections_controller.rb b/app/controllers/vehicle_journeys_collections_controller.rb
index caaa2258e..712bcc154 100644
--- a/app/controllers/vehicle_journeys_collections_controller.rb
+++ b/app/controllers/vehicle_journeys_collections_controller.rb
@@ -1,4 +1,5 @@
class VehicleJourneysCollectionsController < ChouetteController
+ include ReferentialSupport
respond_to :json
belongs_to :referential do
belongs_to :line, :parent_class => Chouette::Line do
diff --git a/app/controllers/vehicle_journeys_controller.rb b/app/controllers/vehicle_journeys_controller.rb
index 050f2f219..c941aeae4 100644
--- a/app/controllers/vehicle_journeys_controller.rb
+++ b/app/controllers/vehicle_journeys_controller.rb
@@ -1,4 +1,5 @@
class VehicleJourneysController < ChouetteController
+ include ReferentialSupport
defaults :resource_class => Chouette::VehicleJourney
before_action :user_permissions, only: :index
diff --git a/app/controllers/vehicle_translations_controller.rb b/app/controllers/vehicle_translations_controller.rb
index 65a0db7fe..5b6b392ac 100644
--- a/app/controllers/vehicle_translations_controller.rb
+++ b/app/controllers/vehicle_translations_controller.rb
@@ -1,4 +1,5 @@
class VehicleTranslationsController < ChouetteController
+ include ReferentialSupport
respond_to :js, :only => [:new, :create]
belongs_to :referential do
diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb
index 9b4f0d6c4..b2dac9e67 100644
--- a/app/controllers/workbenches_controller.rb
+++ b/app/controllers/workbenches_controller.rb
@@ -1,4 +1,4 @@
-class WorkbenchesController < InheritedResources::Base
+class WorkbenchesController < ChouetteController
before_action :query_params, only: [:show]
include RansackDateFilter
before_action only: [:show] { set_date_time_params("validity_period", Date) }
diff --git a/app/decorators/compliance_check_set_decorator.rb b/app/decorators/compliance_check_set_decorator.rb
index 5f3821cbe..096596b19 100644
--- a/app/decorators/compliance_check_set_decorator.rb
+++ b/app/decorators/compliance_check_set_decorator.rb
@@ -3,6 +3,23 @@ class ComplianceCheckSetDecorator < Draper::Decorator
def action_links
links = []
+
+ links << Link.new(
+ content: h.destroy_link_content,
+ href: h.workbench_compliance_check_sets_path(object.id),
+ method: :delete,
+ data: {confirm: h.t('imports.actions.destroy_confirm')}
+ )
+
+ links
+ end
+
+ def lines_status
+ object.compliance_check_resources.where(status: :OK, resource_type: :line).count
+ end
+
+ def lines_in_compliance_check_set
+ object.compliance_check_resources.where(resource_type: :line).count
end
end
diff --git a/app/decorators/import_decorator.rb b/app/decorators/import_decorator.rb
index d63d723cd..e748f830d 100644
--- a/app/decorators/import_decorator.rb
+++ b/app/decorators/import_decorator.rb
@@ -12,6 +12,7 @@ class ImportDecorator < Draper::Decorator
end
def action_links
+ policy = h.policy(object)
links = []
links << Link.new(
@@ -27,16 +28,17 @@ class ImportDecorator < Draper::Decorator
href: object.file.url
)
- # if h.policy(object).destroy?
- links << Link.new(
- content: h.destroy_link_content,
- href: h.workbench_import_path(
- context[:workbench],
- object
- ),
- method: :delete,
- data: { confirm: h.t('imports.actions.destroy_confirm') }
- )
+ if policy.destroy?
+ links << Link.new(
+ content: h.destroy_link_content,
+ href: h.workbench_import_path(
+ context[:workbench],
+ object
+ ),
+ method: :delete,
+ data: { confirm: h.t('imports.actions.destroy_confirm') }
+ )
+ end
links
end
diff --git a/app/decorators/line_decorator.rb b/app/decorators/line_decorator.rb
index f351103b2..ede670cbd 100644
--- a/app/decorators/line_decorator.rb
+++ b/app/decorators/line_decorator.rb
@@ -22,9 +22,19 @@ class LineDecorator < Draper::Decorator
)
if h.policy(Chouette::Line).create? &&
- context[:line_referential].organisations.include?(
- context[:current_organisation]
- )
+ context[:line_referential].organisations.include?(
+ context[:current_organisation]
+ )
+ links << Link.new(
+ content: h.t('lines.actions.edit'),
+ href: h.edit_line_referential_line_path(context[:line_referential], object.id)
+ )
+ end
+
+ if h.policy(Chouette::Line).create? &&
+ context[:line_referential].organisations.include?(
+ context[:current_organisation]
+ )
links << Link.new(
content: h.t('lines.actions.new'),
href: h.new_line_referential_line_path(context[:line_referential])
@@ -33,10 +43,10 @@ class LineDecorator < Draper::Decorator
if h.policy(object).destroy?
links << Link.new(
- content: h.destroy_link_content('lines.actions.destroy_confirm'),
+ content: h.destroy_link_content('lines.actions.destroy'),
href: h.line_referential_line_path(context[:line_referential], object),
method: :delete,
- data: { confirm: h.t('lines.actions.destroy_confirm') }
+ data: {confirm: h.t('lines.actions.destroy_confirm')}
)
end
diff --git a/app/helpers/application_helper.rb b/app/helpers/application_helper.rb
index 0a7b0fb75..d2cdaaa20 100644
--- a/app/helpers/application_helper.rb
+++ b/app/helpers/application_helper.rb
@@ -1,7 +1,33 @@
+
module ApplicationHelper
include NewapplicationHelper
+ def page_header_title(object)
+ # Unwrap from decorator, we want to know the object model name
+ object = object.object if object.try(:object)
+ local = "#{object.model_name.name.underscore.pluralize}.#{params[:action]}.title"
+ if object.try(:name)
+ t(local, name: object.name)
+ else
+ t(local)
+ end
+ end
+
+ def page_header_meta(object)
+ info = t('last_update', time: l(object.updated_at, format: :short))
+ if object.try(:versions)
+ author = object.versions.try(:last).try(:whodunnit) || t('default_whodunnit')
+ info = "#{info} <br/> #{t('whodunnit', author: author)}"
+ end
+ content_tag :div, info.html_safe, class: 'small'
+ end
+
+ def page_header_content_for(object)
+ content_for :page_header_title, page_header_title(object)
+ content_for :page_header_meta, page_header_meta(object)
+ end
+
def font_awesome_classic_tag(name)
name = "fa-file-text-o" if name == "fa-file-csv-o"
name = "fa-file-code-o" if name == "fa-file-xml-o"
diff --git a/app/helpers/compliance_check_sets_helper.rb b/app/helpers/compliance_check_sets_helper.rb
index fc7165fed..b255aee63 100644
--- a/app/helpers/compliance_check_sets_helper.rb
+++ b/app/helpers/compliance_check_sets_helper.rb
@@ -13,4 +13,18 @@ module ComplianceCheckSetsHelper
compliance_check.compliance_check_set,
compliance_check)
end
+
+ # Import statuses helper
+ def compliance_check_set_status(status)
+ if %w[new running pending].include? status
+ content_tag :span, '', class: "fa fa-clock-o"
+ else
+ cls =''
+ cls = 'success' if status == 'OK'
+ cls = 'warning' if status == 'WARNING'
+ cls = 'danger' if %w[ERROR IGNORED].include? status
+
+ content_tag :span, '', class: "fa fa-circle text-#{cls}"
+ end
+ end
end
diff --git a/app/helpers/import_resources_helper.rb b/app/helpers/import_resources_helper.rb
index 1d870f68e..3ee96eb9b 100644
--- a/app/helpers/import_resources_helper.rb
+++ b/app/helpers/import_resources_helper.rb
@@ -12,8 +12,4 @@ module ImportResourcesHelper
content_tag :span, '', class: "fa fa-circle text-#{cls}"
end
- def import_resoruce_metrics(metrics)
- metrics.delete_if {|k,v| !k.include?("count")}.deep_symbolize_keys
- end
-
end
diff --git a/app/helpers/networks_helper.rb b/app/helpers/networks_helper.rb
deleted file mode 100644
index b881ce078..000000000
--- a/app/helpers/networks_helper.rb
+++ /dev/null
@@ -1,7 +0,0 @@
-module NetworksHelper
-
- def source_type_name_label_pairs
- Chouette::Network.source_type_names
- .zip_map { |source_type_name| t("source_types.label.#{source_type_name}") }
- end
-end
diff --git a/app/models/api/v1/api_key.rb b/app/models/api/v1/api_key.rb
index 767e65f3a..09c6f77ac 100644
--- a/app/models/api/v1/api_key.rb
+++ b/app/models/api/v1/api_key.rb
@@ -1,6 +1,7 @@
module Api
module V1
class ApiKey < ::ActiveRecord::Base
+ has_paper_trail
before_create :generate_access_token
belongs_to :referential, :class_name => '::Referential'
belongs_to :organisation, :class_name => '::Organisation'
diff --git a/app/models/calendar.rb b/app/models/calendar.rb
index bb38e74df..b2e73929f 100644
--- a/app/models/calendar.rb
+++ b/app/models/calendar.rb
@@ -3,7 +3,7 @@ require_relative 'calendar/date_value'
require_relative 'calendar/period'
class Calendar < ActiveRecord::Base
-
+ has_paper_trail
belongs_to :organisation
has_many :time_tables
diff --git a/app/models/chouette/access_link.rb b/app/models/chouette/access_link.rb
index 46fbcb631..4b99ab5ba 100644
--- a/app/models/chouette/access_link.rb
+++ b/app/models/chouette/access_link.rb
@@ -1,5 +1,6 @@
module Chouette
class AccessLink < Chouette::TridentActiveRecord
+ has_paper_trail
include ObjectidSupport
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
@@ -50,11 +51,11 @@ module Chouette
def link_key
Chouette::AccessLink.build_link_key(access_point,stop_area,link_orientation_type)
end
-
+
def self.build_link_key(access_point,stop_area,link_orientation_type)
if link_orientation_type == "access_point_to_stop_area"
"A_#{access_point.id}-S_#{stop_area.id}"
- else
+ else
"S_#{stop_area.id}-A_#{access_point.id}"
end
end
@@ -63,4 +64,4 @@ module Chouette
Chouette::Geometry::AccessLinkPresenter.new self
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/access_point.rb b/app/models/chouette/access_point.rb
index 7757fdcfb..7428db1ea 100644
--- a/app/models/chouette/access_point.rb
+++ b/app/models/chouette/access_point.rb
@@ -1,8 +1,10 @@
require 'geokit'
require 'geo_ruby'
+
module Chouette
class AccessPoint < Chouette::ActiveRecord
+ has_paper_trail
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
@@ -167,4 +169,4 @@ module Chouette
Chouette::Geometry::AccessPointPresenter.new self
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/company.rb b/app/models/chouette/company.rb
index d79e5ff59..12b21e347 100644
--- a/app/models/chouette/company.rb
+++ b/app/models/chouette/company.rb
@@ -3,6 +3,7 @@ module Chouette
include CompanyRestrictions
include LineReferentialSupport
include ObjectidSupport
+ has_paper_trail
has_many :lines
@@ -16,4 +17,4 @@ module Chouette
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/connection_link.rb b/app/models/chouette/connection_link.rb
index d19b53974..d5ddc606a 100644
--- a/app/models/chouette/connection_link.rb
+++ b/app/models/chouette/connection_link.rb
@@ -1,5 +1,6 @@
module Chouette
class ConnectionLink < Chouette::TridentActiveRecord
+ has_paper_trail
include ObjectidSupport
include ConnectionLinkRestrictions
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
@@ -47,4 +48,4 @@ module Chouette
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/group_of_line.rb b/app/models/chouette/group_of_line.rb
index 3023d23ed..75ee1ce73 100644
--- a/app/models/chouette/group_of_line.rb
+++ b/app/models/chouette/group_of_line.rb
@@ -1,5 +1,6 @@
module Chouette
class GroupOfLine < Chouette::ActiveRecord
+ has_paper_trail
include ObjectidSupport
include GroupOfLineRestrictions
include LineReferentialSupport
@@ -30,4 +31,4 @@ module Chouette
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/journey_pattern.rb b/app/models/chouette/journey_pattern.rb
index c1f9fb4f8..a62da6353 100644
--- a/app/models/chouette/journey_pattern.rb
+++ b/app/models/chouette/journey_pattern.rb
@@ -1,5 +1,6 @@
module Chouette
class JourneyPattern < Chouette::TridentActiveRecord
+ has_paper_trail
include ChecksumSupport
include JourneyPatternRestrictions
include ObjectidSupport
diff --git a/app/models/chouette/line.rb b/app/models/chouette/line.rb
index 8d5ff5f60..784e3f5b9 100644
--- a/app/models/chouette/line.rb
+++ b/app/models/chouette/line.rb
@@ -1,10 +1,11 @@
module Chouette
class Line < Chouette::ActiveRecord
+ has_paper_trail
include LineRestrictions
include LineReferentialSupport
include ObjectidSupport
- extend StifTransportModeEnumerations
- extend StifTransportSubmodeEnumerations
+ include StifTransportModeEnumerations
+ include StifTransportSubmodeEnumerations
extend ActiveModel::Naming
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
@@ -79,4 +80,4 @@ module Chouette
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/network.rb b/app/models/chouette/network.rb
index 3f07ebe0c..9b3f2fe29 100644
--- a/app/models/chouette/network.rb
+++ b/app/models/chouette/network.rb
@@ -1,15 +1,26 @@
module Chouette
class Network < Chouette::ActiveRecord
+ has_paper_trail
include NetworkRestrictions
include LineReferentialSupport
include ObjectidSupport
+ extend Enumerize
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
-
has_many :lines
attr_accessor :source_type_name
+ enumerize :source_type_name, in: %w(public_and_private_utilities
+ road_authorities
+ transit_operator
+ public_transport
+ passenger_transport_coordinating_authority
+ travel_information_service_provider
+ travel_agency
+ individual_subject_of_travel_itinerary
+ other_information)
+
validates_format_of :registration_number, :with => %r{\A[0-9A-Za-z_-]+\Z}, :allow_nil => true, :allow_blank => true
validates_presence_of :name
@@ -47,4 +58,4 @@ module Chouette
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/pt_link.rb b/app/models/chouette/pt_link.rb
index 5bf77da02..d14d5f29c 100644
--- a/app/models/chouette/pt_link.rb
+++ b/app/models/chouette/pt_link.rb
@@ -2,9 +2,9 @@ require 'geokit'
module Chouette
class PtLink < Chouette::ActiveRecord
+ has_paper_trail
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
-
include Geokit::Mappable
def geometry
@@ -34,4 +34,4 @@ module Chouette
end
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/route.rb b/app/models/chouette/route.rb
index 1f4088aa7..5c0ad24a1 100644
--- a/app/models/chouette/route.rb
+++ b/app/models/chouette/route.rb
@@ -1,5 +1,7 @@
+
module Chouette
class Route < Chouette::TridentActiveRecord
+ has_paper_trail
include RouteRestrictions
include ChecksumSupport
include ObjectidSupport
@@ -190,4 +192,4 @@ module Chouette
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/routing_constraint_zone.rb b/app/models/chouette/routing_constraint_zone.rb
index 70b016a48..fcf47f154 100644
--- a/app/models/chouette/routing_constraint_zone.rb
+++ b/app/models/chouette/routing_constraint_zone.rb
@@ -1,5 +1,6 @@
module Chouette
class RoutingConstraintZone < Chouette::TridentActiveRecord
+ has_paper_trail
include ChecksumSupport
include ObjectidSupport
@@ -43,4 +44,4 @@ module Chouette
route.name
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/stop_area.rb b/app/models/chouette/stop_area.rb
index 5d8b5033f..cc7170728 100644
--- a/app/models/chouette/stop_area.rb
+++ b/app/models/chouette/stop_area.rb
@@ -1,8 +1,8 @@
require 'geokit'
require 'geo_ruby'
-
module Chouette
class StopArea < Chouette::ActiveRecord
+ has_paper_trail
include ProjectionFields
include StopAreaRestrictions
include StopAreaReferentialSupport
@@ -325,4 +325,4 @@ module Chouette
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/stop_point.rb b/app/models/chouette/stop_point.rb
index f4c9b3800..3b9eaa2f6 100644
--- a/app/models/chouette/stop_point.rb
+++ b/app/models/chouette/stop_point.rb
@@ -1,6 +1,6 @@
module Chouette
class StopPoint < Chouette::TridentActiveRecord
-
+ has_paper_trail
def self.policy_class
RoutePolicy
end
@@ -57,4 +57,4 @@ module Chouette
Chouette::StopArea.where(:area_type => ['Quay', 'BoardingPosition'])
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/time_table.rb b/app/models/chouette/time_table.rb
index 09d3e2244..74c20f061 100644
--- a/app/models/chouette/time_table.rb
+++ b/app/models/chouette/time_table.rb
@@ -1,11 +1,11 @@
module Chouette
class TimeTable < Chouette::TridentActiveRecord
+ has_paper_trail
include ChecksumSupport
include TimeTableRestrictions
include ObjectidSupport
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
-
acts_as_taggable
attr_accessor :monday,:tuesday,:wednesday,:thursday,:friday,:saturday,:sunday
@@ -570,4 +570,4 @@ module Chouette
tt
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/timeband.rb b/app/models/chouette/timeband.rb
index 21c81ab1c..6155ffc77 100644
--- a/app/models/chouette/timeband.rb
+++ b/app/models/chouette/timeband.rb
@@ -9,7 +9,7 @@ module Chouette
class Timeband < Chouette::TridentActiveRecord
include ObjectidSupport
-
+ has_paper_trail
self.primary_key = "id"
validates :start_time, :end_time, presence: true
@@ -26,4 +26,4 @@ module Chouette
"#{self.name} (#{fullname})" if self.name
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/chouette/vehicle_journey.rb b/app/models/chouette/vehicle_journey.rb
index 329b37a6c..247c30668 100644
--- a/app/models/chouette/vehicle_journey.rb
+++ b/app/models/chouette/vehicle_journey.rb
@@ -1,5 +1,6 @@
module Chouette
class VehicleJourney < Chouette::TridentActiveRecord
+ has_paper_trail
include ChecksumSupport
include VehicleJourneyRestrictions
include ObjectidSupport
@@ -304,4 +305,4 @@ module Chouette
.where('"time_tables_vehicle_journeys"."vehicle_journey_id" IS NULL')
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/compliance_check_set.rb b/app/models/compliance_check_set.rb
index ecc9b7fd4..4e14b054f 100644
--- a/app/models/compliance_check_set.rb
+++ b/app/models/compliance_check_set.rb
@@ -1,16 +1,17 @@
class ComplianceCheckSet < ActiveRecord::Base
extend Enumerize
+ has_paper_trail
belongs_to :referential
belongs_to :compliance_control_set
belongs_to :workbench
belongs_to :parent, polymorphic: true
- has_many :compliance_check_blocks
- has_many :compliance_checks
+ has_many :compliance_check_blocks, dependent: :destroy
+ has_many :compliance_checks, dependent: :destroy
- has_many :compliance_check_resources
- has_many :compliance_check_messages
+ has_many :compliance_check_resources, dependent: :destroy
+ has_many :compliance_check_messages, dependent: :destroy
enumerize :status, in: %w[new pending successful warning failed running aborted canceled]
diff --git a/app/models/compliance_control_set.rb b/app/models/compliance_control_set.rb
index deb46f5a1..41076fefc 100644
--- a/app/models/compliance_control_set.rb
+++ b/app/models/compliance_control_set.rb
@@ -1,4 +1,5 @@
class ComplianceControlSet < ActiveRecord::Base
+ has_paper_trail
belongs_to :organisation
has_many :compliance_control_blocks, dependent: :destroy
has_many :compliance_controls, dependent: :destroy
diff --git a/app/models/concerns/default_attributes_support.rb b/app/models/concerns/default_attributes_support.rb
index e85a59160..2ef9149cb 100644
--- a/app/models/concerns/default_attributes_support.rb
+++ b/app/models/concerns/default_attributes_support.rb
@@ -47,7 +47,6 @@ module DefaultAttributesSupport
else
self.object_version += 1
end
- self.creator_id = 'chouette'
end
def reset_auto_columns
diff --git a/app/models/concerns/objectid_support.rb b/app/models/concerns/objectid_support.rb
index 85b5da3a8..cec36678e 100644
--- a/app/models/concerns/objectid_support.rb
+++ b/app/models/concerns/objectid_support.rb
@@ -27,4 +27,4 @@ module ObjectidSupport
get_objectid.try(:class)
end
end
-end \ No newline at end of file
+end
diff --git a/app/models/dashboard.rb b/app/models/dashboard.rb
index a53267db5..46c621266 100644
--- a/app/models/dashboard.rb
+++ b/app/models/dashboard.rb
@@ -11,8 +11,11 @@ class Dashboard
@@default_class = self
mattr_accessor :default_class
- attr_reader :context
+ def self.model_name
+ ActiveModel::Name.new Dashboard, Dashboard, "Dashboard"
+ end
+ attr_reader :context
def initialize(context)
@context = context
end
diff --git a/app/policies/company_policy.rb b/app/policies/company_policy.rb
index 45386aba4..b08dcec53 100644
--- a/app/policies/company_policy.rb
+++ b/app/policies/company_policy.rb
@@ -1,7 +1,19 @@
class CompanyPolicy < ApplicationPolicy
- class Scope < Scope
- def resolve
- scope
- end
+ class Scope < Scope
+ def resolve
+ scope
end
end
+
+ def create?
+ user.has_permission?('companies.create')
+ end
+
+ def destroy?
+ user.has_permission?('companies.destroy')
+ end
+
+ def update?
+ user.has_permission?('companies.update')
+ end
+end
diff --git a/app/policies/compliance_check_set_policy.rb b/app/policies/compliance_check_set_policy.rb
index 171a33347..90323d7c3 100644
--- a/app/policies/compliance_check_set_policy.rb
+++ b/app/policies/compliance_check_set_policy.rb
@@ -3,5 +3,6 @@ class ComplianceCheckSetPolicy < ApplicationPolicy
def resolve
scope
end
+
end
-end \ No newline at end of file
+end
diff --git a/app/policies/import_policy.rb b/app/policies/import_policy.rb
index b12dcc167..512bfc8ac 100644
--- a/app/policies/import_policy.rb
+++ b/app/policies/import_policy.rb
@@ -6,14 +6,10 @@ class ImportPolicy < ApplicationPolicy
end
def create?
- !archived? && user.has_permission?('imports.create')
- end
-
- def destroy?
- !archived? && user.has_permission?('imports.destroy')
+ user.has_permission?('imports.create')
end
def update?
- !archived? && user.has_permission?('imports.update')
+ user.has_permission?('imports.update')
end
end
diff --git a/app/policies/line_policy.rb b/app/policies/line_policy.rb
index acb0d79e7..67ea0b611 100644
--- a/app/policies/line_policy.rb
+++ b/app/policies/line_policy.rb
@@ -1,11 +1,23 @@
class LinePolicy < ApplicationPolicy
-
class Scope < Scope
def resolve
scope
end
end
+ def create?
+ Rails.logger.debug "LinePolicy.create?"
+ user.has_permission?('lines.create')
+ end
+
+ def destroy?
+ user.has_permission?('lines.destroy')
+ end
+
+ def update?
+ user.has_permission?('lines.update')
+ end
+
def create_footnote?
!archived? && organisation_match? && user.has_permission?('footnotes.create')
end
diff --git a/app/policies/stop_area_policy.rb b/app/policies/stop_area_policy.rb
index de8ecda8d..faeebbc2a 100644
--- a/app/policies/stop_area_policy.rb
+++ b/app/policies/stop_area_policy.rb
@@ -4,4 +4,16 @@ class StopAreaPolicy < ApplicationPolicy
scope
end
end
+
+ def create?
+ user.has_permission?('stop_areas.create')
+ end
+
+ def destroy?
+ user.has_permission?('stop_areas.destroy')
+ end
+
+ def update?
+ user.has_permission?('stop_areas.update')
+ end
end
diff --git a/app/services/http_service.rb b/app/services/http_service.rb
index d3999f293..db4441395 100644
--- a/app/services/http_service.rb
+++ b/app/services/http_service.rb
@@ -26,7 +26,8 @@ module HTTPService extend self
# params: { netex_import: {referential_id: 13, workbench_id: 1}},
# upload: {file: [StringIO.new('howdy'), 'application/zip', 'greeting']})
def post_resource(host:, path:, token: nil, params: {}, upload: nil)
- result = Faraday.new(url: host) do |c|
+ token = token || params
+ Faraday.new(url: host) do |c|
c.headers['Authorization'] = "Token token=#{token.inspect}" if token
c.request :multipart
c.request :url_encoded
diff --git a/app/views/api/kml/access_links/index.kml.slim b/app/views/api/kml/access_links/index.kml.slim
index 1bcfdacf1..06db8bf9d 100644
--- a/app/views/api/kml/access_links/index.kml.slim
+++ b/app/views/api/kml/access_links/index.kml.slim
@@ -8,7 +8,7 @@ kml xmlns="http://www.opengis.net/kml/2.2"
placemark id="#{access_link.objectid}"
name = h(access_link.name)
extendeddata
- - [ :access_link_type, :objectid, :object_version, :created_at, :updated_at, :creator_id, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :link_orientation].each do |prop|
+ - [ :access_link_type, :objectid, :object_version, :created_at, :updated_at, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs, :link_orientation].each do |prop|
data name="#{prop.to_s}"
value = h(access_link.send( prop))
diff --git a/app/views/api/kml/access_points/index.kml.slim b/app/views/api/kml/access_points/index.kml.slim
index 1a162f7ed..c6f6b7797 100644
--- a/app/views/api/kml/access_points/index.kml.slim
+++ b/app/views/api/kml/access_points/index.kml.slim
@@ -9,7 +9,7 @@ kml xmlns="http://www.opengis.net/kml/2.2"
placemark id="#{access_point.objectid}"
name = h(access_point.name)
extendeddata
- - [ :objectid, :object_version, :creator_id, :created_at, :updated_at, :name, :comment, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :openning_time, :closing_time, :access_type, :access_point_type, :mobility_restricted_suitability, :stairs_availability, :lift_availability].each do |prop|
+ - [ :objectid, :object_version, :created_at, :updated_at, :name, :comment, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :openning_time, :closing_time, :access_type, :access_point_type, :mobility_restricted_suitability, :stairs_availability, :lift_availability].each do |prop|
data name="#{prop.to_s}"
value = h(access_point.send( prop))
diff --git a/app/views/api/kml/connection_links/index.kml.slim b/app/views/api/kml/connection_links/index.kml.slim
index 7305fbc78..0acdeaafe 100644
--- a/app/views/api/kml/connection_links/index.kml.slim
+++ b/app/views/api/kml/connection_links/index.kml.slim
@@ -8,7 +8,7 @@ kml xmlns="http://www.opengis.net/kml/2.2"
placemark id="#{connection_link.objectid}"
name = h(connection_link.name)
extendeddata
- - [ :connection_link_type, :objectid, :object_version, :creator_id, :created_at, :updated_at, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs].each do |prop|
+ - [ :connection_link_type, :objectid, :object_version, :created_at, :updated_at, :name, :comment, :link_distance, :link_type, :default_duration, :frequent_traveller_duration, :occasional_traveller_duration, :mobility_restricted_traveller_duration, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs].each do |prop|
data name="#{prop.to_s}"
value = h(connection_link.send( prop))
diff --git a/app/views/api/kml/journey_patterns/show.kml.slim b/app/views/api/kml/journey_patterns/show.kml.slim
index 15fb96daa..347d358cc 100644
--- a/app/views/api/kml/journey_patterns/show.kml.slim
+++ b/app/views/api/kml/journey_patterns/show.kml.slim
@@ -4,7 +4,7 @@ kml xmlns="http://www.opengis.net/kml/2.2"
document
name = "#{h(Chouette::JourneyPattern.model_name.human)} : #{h(@journey_pattern.name)}"
extendeddata
- - [:objectid, :object_version, :creator_id, :created_at, :updated_at, :name, :comment, :registration_number, :published_name].each do |prop|
+ - [:objectid, :object_version, :created_at, :updated_at, :name, :comment, :registration_number, :published_name].each do |prop|
data name="#{prop.to_s}"
value = h(@journey_pattern.send( prop))
@@ -17,7 +17,7 @@ kml xmlns="http://www.opengis.net/kml/2.2"
placemark id="#{stop_area.objectid}"
name = h(stop_area.name)
extendeddata
- - [ :objectid, :object_version, :creator_id, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs].each do |prop|
+ - [ :objectid, :object_version, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs].each do |prop|
data name="#{prop.to_s}"
value = h(stop_area.send( prop))
diff --git a/app/views/api/kml/lines/show.kml.slim b/app/views/api/kml/lines/show.kml.slim
index d1e48323d..1163c98d3 100644
--- a/app/views/api/kml/lines/show.kml.slim
+++ b/app/views/api/kml/lines/show.kml.slim
@@ -7,7 +7,7 @@ kml xmlns="http://www.opengis.net/kml/2.2"
placemark id="#{@line.objectid}"
name = h(@line.name)
extendeddata
- - [ :transport_mode, :objectid, :created_at, :updated_at, :object_version, :creator_id, :name, :number, :published_name, :registration_number, :comment, :mobility_restricted_suitability, :int_user_needs].each do |prop|
+ - [ :transport_mode, :objectid, :created_at, :updated_at, :object_version, :name, :number, :published_name, :registration_number, :comment, :mobility_restricted_suitability, :int_user_needs].each do |prop|
data name="#{prop.to_s}"
value = h(@line.send( prop))
diff --git a/app/views/api/kml/routes/show.kml.slim b/app/views/api/kml/routes/show.kml.slim
index 8a2843bc0..fdf73754d 100644
--- a/app/views/api/kml/routes/show.kml.slim
+++ b/app/views/api/kml/routes/show.kml.slim
@@ -6,7 +6,7 @@ kml xmlns="http://www.opengis.net/kml/2.2"
placemark id="#{@route.objectid}"
name = h(@route.name)
extendeddata
- - [:direction, :wayback, :objectid, :object_version, :creator_id, :created_at, :updated_at, :name, :comment, :published_name, :number, :direction_text, :wayback_text].each do |prop|
+ - [:direction, :wayback, :objectid, :object_version, :created_at, :updated_at, :name, :comment, :published_name, :number, :direction_text, :wayback_text].each do |prop|
data name="#{prop.to_s}"
value = h(@route.send( prop))
diff --git a/app/views/api/kml/stop_areas/index.kml.slim b/app/views/api/kml/stop_areas/index.kml.slim
index a08dbf963..284bd3e34 100644
--- a/app/views/api/kml/stop_areas/index.kml.slim
+++ b/app/views/api/kml/stop_areas/index.kml.slim
@@ -8,7 +8,7 @@ kml xmlns="http://www.opengis.net/kml/2.2"
placemark id="#{stop_area.objectid}"
name = h(stop_area.name)
extendeddata
- - [:objectid, :object_version, :creator_id, :created_at, :updated_at, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs].each do |prop|
+ - [:objectid, :object_version, :created_at, :updated_at, :name, :comment, :area_type, :registration_number, :nearest_topic_name, :fare_code, :longitude, :latitude, :long_lat_type, :country_code, :street_name, :mobility_restricted_suitability, :stairs_availability, :lift_availability, :int_user_needs].each do |prop|
data name="#{prop.to_s}"
value = h(stop_area.send( prop))
diff --git a/app/views/api/v1/compliance_check_sets/validated.rabl b/app/views/api/v1/compliance_check_sets/validated.rabl
index 1368a8014..4dfa9e420 100644
--- a/app/views/api/v1/compliance_check_sets/validated.rabl
+++ b/app/views/api/v1/compliance_check_sets/validated.rabl
@@ -4,7 +4,6 @@ attributes(
:id,
:referential_id,
:name,
- :creator,
:status,
:started_at,
:ended_at
diff --git a/app/views/api/v1/group_of_lines/short_description.rabl b/app/views/api/v1/group_of_lines/short_description.rabl
index 770b334ec..15465874c 100644
--- a/app/views/api/v1/group_of_lines/short_description.rabl
+++ b/app/views/api/v1/group_of_lines/short_description.rabl
@@ -1,6 +1,6 @@
object @group_of_line
extends "api/v1/trident_objects/short_description"
-[ :creator_id, :name].each do |attr|
+[:name].each do |attr|
attributes attr, :unless => lambda { |m| m.send( attr).nil?}
end
diff --git a/app/views/api/v1/group_of_lines/show.rabl b/app/views/api/v1/group_of_lines/show.rabl
index 96e4bfc58..d02247da9 100644
--- a/app/views/api/v1/group_of_lines/show.rabl
+++ b/app/views/api/v1/group_of_lines/show.rabl
@@ -1,6 +1,6 @@
object @group_of_line
extends "api/v1/trident_objects/show"
-[ :creator_id, :name].each do |attr|
+[:name].each do |attr|
attributes attr, :unless => lambda { |m| m.send( attr).nil?}
end
diff --git a/app/views/api/v1/trident_objects/show.rabl b/app/views/api/v1/trident_objects/show.rabl
index e58c0a866..9722594e1 100644
--- a/app/views/api/v1/trident_objects/show.rabl
+++ b/app/views/api/v1/trident_objects/show.rabl
@@ -1,5 +1,5 @@
attributes :objectid => :object_id
-[ :object_version, :created_at, :updated_at, :creator_id].each do |attr|
+[ :object_version, :created_at, :updated_at].each do |attr|
attributes attr, :unless => lambda { |m| m.send( attr).nil?}
end
diff --git a/app/views/api_keys/edit.html.slim b/app/views/api_keys/edit.html.slim
index 9d7d1fdb7..50808b5a4 100644
--- a/app/views/api_keys/edit.html.slim
+++ b/app/views/api_keys/edit.html.slim
@@ -1,16 +1,10 @@
-/ PageHeader
-= pageheader 'Clé d\'API',
- t('api_keys.edit.title'),
- 'Lorem ipsum dolor sit amet',
- t('last_update', time: l(@api_key.updated_at, format: :short)),
- ''
-
- / Below are secondary actions & optional content (filters, ...)
+- page_header_content_for @api_key
+- content_for :page_header_content do
+ - if policy(@api_key).destroy?
.row.mb-sm
.col-lg-12.text-right
- = ( policy(@api_key).destroy? ? link_to(t('actions.destroy'), api_key_path(@api_key), :method => :delete, class: 'btn btn-default') : '' )
+ = link_to(t('actions.destroy'), api_key_path(@api_key), :method => :delete, class: 'btn btn-default')
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/api_keys/new.html.slim b/app/views/api_keys/new.html.slim
index 9acb08a94..2bed9f912 100644
--- a/app/views/api_keys/new.html.slim
+++ b/app/views/api_keys/new.html.slim
@@ -1,10 +1,3 @@
-/ PageHeader
-= pageheader 'Clé d\'API',
- t('api_keys.new.title'),
- 'Lorem ipsum dolor sit amet',
- ''
-
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/calendars/edit.html.slim b/app/views/calendars/edit.html.slim
index 3463bd05c..e806fc94b 100644
--- a/app/views/calendars/edit.html.slim
+++ b/app/views/calendars/edit.html.slim
@@ -1,11 +1,5 @@
- breadcrumb :calendar, @calendar
-/ PageHeader
-= pageheader 'modele-calendrier',
- t('.title', calendar: @calendar.name),
- '',
- t('last_update', time: l(@calendar.updated_at, format: :short))
-
-/ PageContent
+- page_header_content_for @calendar
.page_content
.container-fluid
.row
diff --git a/app/views/calendars/index.html.slim b/app/views/calendars/index.html.slim
index a95d54428..77478a624 100644
--- a/app/views/calendars/index.html.slim
+++ b/app/views/calendars/index.html.slim
@@ -1,12 +1,8 @@
- breadcrumb :calendars
-/ PageHeader
-- header_params = ['modele-calendrier',
- t('.title'),
- '']
-- header_params << link_to(t('actions.add'), new_calendar_path, class: 'btn btn-default') if policy(Calendar).create?
-= pageheader(*header_params) do
+- content_for :page_header_actions do
+ - if policy(Calendar).create?
+ = link_to(t('actions.add'), new_calendar_path, class: 'btn btn-default')
-/ PageContent
.page_content
.container-fluid
- if params[:q].present? or @calendars.any?
diff --git a/app/views/calendars/new.html.slim b/app/views/calendars/new.html.slim
index 146173d35..ce8b6a036 100644
--- a/app/views/calendars/new.html.slim
+++ b/app/views/calendars/new.html.slim
@@ -1,11 +1,4 @@
- breadcrumb :calendars
-/ PageHeader
-= pageheader 'modele-calendrier',
- t('.title'),
- '',
- ''
-
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/calendars/show.html.slim b/app/views/calendars/show.html.slim
index b2ace0ccc..da4afa3e6 100644
--- a/app/views/calendars/show.html.slim
+++ b/app/views/calendars/show.html.slim
@@ -1,12 +1,6 @@
- breadcrumb :calendar, @calendar
-/ PageHeader
-= pageheader 'modele-calendrier',
- @calendar.name,
- '',
- t('last_update', time: l(@calendar.updated_at, format: :short)),
- (policy(@calendar).edit? ? link_to(t('actions.edit'), edit_calendar_path(@calendar), class: 'btn btn-default') : '') do
-
- / Below is secondary actions & optional contents (filters, ...)
+- page_header_content_for @calendar
+- content_for :page_header_content do
.row.mb-sm
.col-lg-12.text-right
- @calendar.action_links.each do |link|
@@ -15,8 +9,10 @@
data: link.data,
class: 'btn btn-primary' do
= link.content
+- if policy(@calendar).edit?
+ - content_for :page_header_actions do
+ = link_to(t('actions.edit'), edit_calendar_path(@calendar), class: 'btn btn-default')
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/companies/_form.html.slim b/app/views/companies/_form.html.slim
index caf75bd8b..3979c5800 100644
--- a/app/views/companies/_form.html.slim
+++ b/app/views/companies/_form.html.slim
@@ -1,18 +1,18 @@
-= semantic_form_for [@line_referential, @company] do |form|
- = form.inputs do
- = form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.company.name") }
- = form.input :short_name
- = form.input :organizational_unit
- = form.input :operating_department_name
- = form.input :code
- = form.input :phone, as: :phone
- = form.input :fax, as: :phone
- = form.input :email, as: :email
- = form.input :time_zone, include_blank: true
- = form.input :url
- = form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.company.registration_number") }
- = form.input :objectid, :required => !@company.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.company.objectid") }
+= simple_form_for [@line_referential, @company], html: {class: 'form-horizontal', id: 'company_form'}, wrapper: :horizontal_form do |f|
+ .row
+ .col-lg-12
+ = f.input :name, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.company.name")}
+ = f.input :short_name
+ = f.input :organizational_unit
+ = f.input :operating_department_name
+ = f.input :code
+ = f.input :phone
+ = f.input :fax
+ = f.input :email, as: :email
+ = f.input :time_zone, include_blank: true
+ = f.input :url
+ = f.input :registration_number, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.company.registration_number")}
- = form.actions do
- = form.action :submit, as: :button
- = form.action :cancel, as: :link \ No newline at end of file
+ .separator
+
+ = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'company_form'
diff --git a/app/views/companies/edit.html.slim b/app/views/companies/edit.html.slim
index 2f4c559b9..faa88f829 100644
--- a/app/views/companies/edit.html.slim
+++ b/app/views/companies/edit.html.slim
@@ -1,4 +1,3 @@
- breadcrumb :company, @company
-
-= title_tag t('companies.edit.title', company: @company.name)
-= render 'form'
+- page_header_content_for @company
+= render 'form' \ No newline at end of file
diff --git a/app/views/companies/index.html.slim b/app/views/companies/index.html.slim
index 8fcadc370..5d746642f 100644
--- a/app/views/companies/index.html.slim
+++ b/app/views/companies/index.html.slim
@@ -1,12 +1,8 @@
- breadcrumb :companies, @line_referential
-/ PageHeader
-= pageheader 'transporteur',
- t('companies.index.title'),
- 'Lorem ipsum dolor sit amet',
- '',
- (policy(Chouette::Company).create? ? link_to(t('companies.actions.new'), new_line_referential_company_path(@line_referential), class: 'btn btn-primary') : '')
+- content_for :page_header_actions do
+ - if policy(Chouette::Company).create?
+ = link_to(t('companies.actions.new'), new_line_referential_company_path(@line_referential), class: 'btn btn-primary')
-/ PageContent
.page_content
.container-fluid
- if params[:q].present? or @companies.any?
diff --git a/app/views/companies/new.html.slim b/app/views/companies/new.html.slim
index 68c0f76c3..cc085ffe2 100644
--- a/app/views/companies/new.html.slim
+++ b/app/views/companies/new.html.slim
@@ -1,2 +1,6 @@
-= title_tag t('companies.new.title')
-= render 'form'
+- breadcrumb :lines, @line_referential
+.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/companies/show.html.slim b/app/views/companies/show.html.slim
index 4219595b8..0d6b4aae3 100644
--- a/app/views/companies/show.html.slim
+++ b/app/views/companies/show.html.slim
@@ -1,11 +1,6 @@
- breadcrumb :company, @company
-/ PageHeader
-= pageheader 'transporteur',
- @company.name,
- 'Lorem ipsum dolor sit amet',
- t('last_update', time: l(@company.updated_at, format: :short)) do
- / Below is secundary actions & optional contents (filters, ...)
+- content_for :page_header_content do
.row
.col-lg-12.text-right.mb-sm
- if policy(Chouette::Company).create?
@@ -16,14 +11,15 @@
= link_to line_referential_company_path(@line_referential, @company), method: :delete, data: {confirm: t('companies.actions.destroy_confirm')}, class: 'btn btn-primary' do
span.fa.fa-trash
span = t('companies.actions.destroy')
+- page_header_content_for @company
+
-/ PageContent
.page_content
.container-fluid
.row
.col-lg-6.col-md-6.col-sm-12.col-xs-12
= definition_list t('metadatas'),
- { 'ID Codif' => @company.try(:get_objectid).try(:local_id),
+ { 'ID Codif' => @company.try(:get_objectid).try(:short_id),
Chouette::Company.human_attribute_name(:phone) => @company.phone,
Chouette::Company.human_attribute_name(:email) => @company.email,
Chouette::Company.human_attribute_name(:url) => @company.url }
diff --git a/app/views/compliance_check_sets/_filters.html.slim b/app/views/compliance_check_sets/_filters.html.slim
index 3051bda64..bf929bc08 100644
--- a/app/views/compliance_check_sets/_filters.html.slim
+++ b/app/views/compliance_check_sets/_filters.html.slim
@@ -10,14 +10,18 @@
.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
-
+ .form-group.search
+ .input-group.search_bar
+ = f.search_field :compliance_control_set_name_cont, class: 'form-control', placeholder: t('compliance_check_sets.filters.name_compliance_control_set')
+ span.input-group-btn
+ button.btn.btn-default type='submit'
+ span.fa.fa-search
.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/executed.html.slim b/app/views/compliance_check_sets/executed.html.slim
index bb055272d..da8a2a3de 100644
--- a/app/views/compliance_check_sets/executed.html.slim
+++ b/app/views/compliance_check_sets/executed.html.slim
@@ -1,8 +1,6 @@
- breadcrumb :compliance_check_set, @workbench, @compliance_check_set
-/ PageHeader
-= pageheader 'jeux-de-donnees',
- t('compliance_check_sets.executed.title', name: @compliance_check_set.name)
-/ PageContent
+- page_header_content_for @compliance_check_set
+
.page_content
.container-fluid
.row
@@ -47,7 +45,7 @@
sortable: true,
cls: 'table has-filter has-search',
model: ComplianceCheck
-
+
- @blocks_to_compliance_checks_map.each do |block, compliance_checks|
- if compliance_checks.try(:any?)
diff --git a/app/views/compliance_check_sets/index.html.slim b/app/views/compliance_check_sets/index.html.slim
index 4ca5a2ee7..f5d1bd777 100644
--- a/app/views/compliance_check_sets/index.html.slim
+++ b/app/views/compliance_check_sets/index.html.slim
@@ -1,15 +1,5 @@
- breadcrumb :compliance_check_sets, @workbench
-/ 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
@@ -22,7 +12,7 @@
[ \
TableBuilderHelper::Column.new( \
key: :ref, \
- attribute: 'referential_id' \
+ attribute: 'compliance_check_set_id' \
), \
TableBuilderHelper::Column.new( \
key: :creation_date, \
@@ -31,8 +21,8 @@
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]) \
+ link_to: lambda do |compliance_check_set| \
+ referential_path(compliance_check_set.referential_id) \
end \
), \
TableBuilderHelper::Column.new( \
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..c9d0583a5
--- /dev/null
+++ b/app/views/compliance_check_sets/show.html.slim
@@ -0,0 +1,47 @@
+- breadcrumb :compliance_check_sets, @workbench, @compliance_check_set
+/ PageHeader
+= pageheader 'jeux-de-donnees',
+ @compliance_check_set.name,
+ '',
+ t('last_update', time: l(@compliance_check_set.updated_at, format: :short)) do
+
+ / Below is secundary actions & optional contents (filters, ...)
+ .row
+ .col-lg-12.text-right.mb-sm
+ - @compliance_check_set.action_links.each do |link|
+ = link_to link.href,
+ method: link.method,
+ data: link.data,
+ class: 'btn btn-primary' do
+ = link.content
+
+/ PageContent
+.page_content.import_messages
+ .container-fluid
+ .row
+ .col-lg-12
+ h1
+ span.status_icon = compliance_check_set_status(@compliance_check_set.status)
+ span = t('compliance_check_sets.show.table_state', lines_status: @compliance_check_set.lines_status , lines_in_compliance_check_set: @compliance_check_set.lines_in_compliance_check_set )
+ .col-lg-12
+ = t('compliance_check_sets.show.table_explanation')
+ .row
+ .col-lg-12
+ = table_builder_2 @compliance_check_set.compliance_check_resources,
+ [ \
+ TableBuilderHelper::Column.new( \
+ key: :name, \
+ attribute: 'name' \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :status, \
+ attribute: Proc.new { |n| compliance_check_set_status(n.status) } \
+ ), \
+ TableBuilderHelper::Column.new( \
+ key: :metrics, \
+ attribute: Proc.new { |n| I18n.t('compliance_check_sets.show.metrics', n.metrics.deep_symbolize_keys) } \
+ ) \
+ ],
+ sortable: false, \
+ links: [],
+ cls: 'table'
diff --git a/app/views/compliance_control_blocks/edit.html.slim b/app/views/compliance_control_blocks/edit.html.slim
index 637bb7311..49aee7705 100644
--- a/app/views/compliance_control_blocks/edit.html.slim
+++ b/app/views/compliance_control_blocks/edit.html.slim
@@ -1,11 +1,7 @@
-/ PageHeader
-= pageheader 'jeux-de-controle',
- t('compliance_control_blocks.edit.title', compliance_control_block: @compliance_control_block.id)
+- page_header_content_for @compliance_control_block
-
-/ 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
+ = render 'form'
diff --git a/app/views/compliance_control_blocks/new.html.slim b/app/views/compliance_control_blocks/new.html.slim
index 49404c552..7d2551311 100644
--- a/app/views/compliance_control_blocks/new.html.slim
+++ b/app/views/compliance_control_blocks/new.html.slim
@@ -1,11 +1,5 @@
-/ PageHeader
-= pageheader 'jeux-de-controle',
- 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
+ = render 'form'
diff --git a/app/views/compliance_control_sets/edit.html.slim b/app/views/compliance_control_sets/edit.html.slim
index dbe537c93..fd68f0abb 100644
--- a/app/views/compliance_control_sets/edit.html.slim
+++ b/app/views/compliance_control_sets/edit.html.slim
@@ -1,9 +1,6 @@
- breadcrumb :compliance_control_set, @compliance_control_set
-/ PageHeader
-= pageheader 'jeux-de-controle',
- t('compliance_control_sets.edit.title', name: @compliance_control_set.name)
+- page_header_content_for @compliance_control_set
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/compliance_control_sets/index.html.slim b/app/views/compliance_control_sets/index.html.slim
index 69bff4725..2a5651280 100644
--- a/app/views/compliance_control_sets/index.html.slim
+++ b/app/views/compliance_control_sets/index.html.slim
@@ -1,16 +1,8 @@
- breadcrumb :compliance_control_sets
-/ PageHeader
-- header_params = ['jeux-de-controle',
- t('compliance_control_sets.index.title'),
- '']
-- header_params << link_to(t('compliance_control_sets.actions.new'), new_compliance_control_set_path, class: 'btn btn-default') if policy(Calendar).create?
-= pageheader(*header_params) do
+- content_for :page_header_actions do
+ - if policy(ComplianceControlSet).create?
+ = link_to(t('compliance_control_sets.actions.new'), new_compliance_control_set_path, class: 'btn btn-default')
- / Below is secundary actions & optional contents (filters, ...)
- .row.mb-sm
- .col-lg-12.text-right
-
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/compliance_control_sets/new.html.slim b/app/views/compliance_control_sets/new.html.slim
index d543a6395..ada0de5bf 100644
--- a/app/views/compliance_control_sets/new.html.slim
+++ b/app/views/compliance_control_sets/new.html.slim
@@ -1,10 +1,5 @@
- breadcrumb :compliance_control_sets
-/ PageHeader
-= pageheader 'jeux-de-controle',
- t('compliance_control_sets.index.new')
-
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/compliance_control_sets/show.html.slim b/app/views/compliance_control_sets/show.html.slim
index a6e2c192a..2291eda06 100644
--- a/app/views/compliance_control_sets/show.html.slim
+++ b/app/views/compliance_control_sets/show.html.slim
@@ -1,9 +1,6 @@
- breadcrumb :compliance_control_set, @compliance_control_set
-/ PageHeader
-= pageheader 'jeux-de-controle',
- t('compliance_control_sets.show.title', name: @compliance_control_set.name)
-
- / Below is secondary actions & optional contents (filters, ...)
+- page_header_content_for @compliance_control_set
+- content_for :page_header_content do
.row.mb-sm
.col-lg-12.text-right
- @compliance_control_set.action_links.each do |link|
@@ -16,7 +13,6 @@
class: 'btn btn-primary' do
= link.content
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/compliance_controls/edit.html.slim b/app/views/compliance_controls/edit.html.slim
index 192e3521f..00456410c 100644
--- a/app/views/compliance_controls/edit.html.slim
+++ b/app/views/compliance_controls/edit.html.slim
@@ -1,8 +1,5 @@
- breadcrumb :compliance_control, @compliance_control
-
-= pageheader 'jeux-de-controle',
- t('compliance_controls.edit.title')
-
+- page_header_content_for @compliance_control
.page_content
.container-fluid
diff --git a/app/views/compliance_controls/new.html.slim b/app/views/compliance_controls/new.html.slim
index bd2db230b..f7f47fba3 100644
--- a/app/views/compliance_controls/new.html.slim
+++ b/app/views/compliance_controls/new.html.slim
@@ -1,11 +1,4 @@
- breadcrumb :compliance_control_set, parent
-/ PageHeader
-- header_params = ['jeux-de-controle',
- t('compliance_controls.new.title'),
- '']
-= pageheader(*header_params) do
-
-
.page_content
.container-fluid
.row
@@ -14,4 +7,4 @@
= definition_list t('metadatas'),
I18n.t('activerecord.attributes.compliance_control.predicate') => @compliance_control.class.predicate,
- I18n.t('activerecord.attributes.compliance_control.prerequisite') => @compliance_control.class.prerequisite \ No newline at end of file
+ I18n.t('activerecord.attributes.compliance_control.prerequisite') => @compliance_control.class.prerequisite
diff --git a/app/views/compliance_controls/select_type.html.slim b/app/views/compliance_controls/select_type.html.slim
index ec1c360cb..d1c518ecf 100644
--- a/app/views/compliance_controls/select_type.html.slim
+++ b/app/views/compliance_controls/select_type.html.slim
@@ -1,11 +1,4 @@
- breadcrumb :compliance_control_set, parent
-/ PageHeader
-- header_params = ['jeux-de-controle',
- t('compliance_controls.select_type.title'),
- '']
-= pageheader(*header_params) do
-
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/compliance_controls/show.html.slim b/app/views/compliance_controls/show.html.slim
index f7ec118b0..54b07abf1 100644
--- a/app/views/compliance_controls/show.html.slim
+++ b/app/views/compliance_controls/show.html.slim
@@ -1,11 +1,9 @@
- breadcrumb :compliance_control, @compliance_control
-/ PageHeader
-= pageheader 'jeux-de-controle',
- t('compliance_controls.show.title'),
- '',
- link_to(t('actions.edit'), edit_compliance_control_set_compliance_control_path(params[:compliance_control_set_id], params[:id]), class: 'btn btn-default') do
+- content_for :page_header_actions do
+ = link_to(t('actions.edit'), edit_compliance_control_set_compliance_control_path(params[:compliance_control_set_id], params[:id]), class: 'btn btn-default')
+- page_header_content_for @compliance_control
+
-/ PageContent
.page_content
.container-fluid
.row
@@ -29,4 +27,4 @@
- if @compliance_control.compliance_control_block
= definition_list t('compliance_controls.show.metadatas.compliance_control_block'),
I18n.t('activerecord.attributes.compliance_control_blocks.transport_mode') => I18n.t("enumerize.transport_mode.#{@compliance_control.compliance_control_block.transport_mode}"),
- I18n.t('activerecord.attributes.compliance_control_blocks.transport_submode') => I18n.t("enumerize.transport_submode.#{@compliance_control.compliance_control_block.transport_submode}") \ No newline at end of file
+ I18n.t('activerecord.attributes.compliance_control_blocks.transport_submode') => I18n.t("enumerize.transport_submode.#{@compliance_control.compliance_control_block.transport_submode}")
diff --git a/app/views/dashboards/_dashboard.html.slim b/app/views/dashboards/_dashboard.html.slim
index 0b5deffc6..f03301e23 100644
--- a/app/views/dashboards/_dashboard.html.slim
+++ b/app/views/dashboards/_dashboard.html.slim
@@ -19,6 +19,20 @@
.panel-body
em.small.text-muted = t('.offers.no_content')
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title.with_actions
+ = "Modèles de calendrier"
+ div
+ = link_to '', calendars_path, class: ' fa fa-chevron-right pull-right'
+ - if @dashboard.current_organisation.calendars.present?
+ .list-group
+ - @dashboard.current_organisation.calendars.order("updated_at desc").limit(5).each do |calendar|
+ = link_to calendar.name, calendar_path(calendar), class: 'list-group-item'
+ - else
+ .panel-body
+ em.small.text-muted Aucun modèle de calendrier défini
+
.col-lg-6.col-md-6.col-sm-6.col-xs-12
.panel.panel-default
.panel-heading
diff --git a/app/views/dashboards/show.html.slim b/app/views/dashboards/show.html.slim
index e86af55a6..8df880f89 100644
--- a/app/views/dashboards/show.html.slim
+++ b/app/views/dashboards/show.html.slim
@@ -1,16 +1,11 @@
- breadcrumb :root
-/ PageHeader
-= pageheader 'tableau-de-bord',
- t('.title', organisation: current_organisation.name)
-
- / Below is secundary actions & optional contents (filters, ...)
+- content_for :page_header_title, t('.title', organisation: current_organisation.name)
+- content_for :page_header_content do
.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/errors/forbidden.html.slim b/app/views/errors/forbidden.html.slim
index 4ca3a6dbf..23ea67eff 100644
--- a/app/views/errors/forbidden.html.slim
+++ b/app/views/errors/forbidden.html.slim
@@ -1,7 +1,4 @@
-/ PageHeader
-= pageheader 'bug',
- 'Erreur 403',
- ''
+- content_for :page_header_title, 'Erreur 403'
.page_content
.container-fluid
diff --git a/app/views/errors/not_found.html.slim b/app/views/errors/not_found.html.slim
index 6348ea1be..8821e9ec3 100644
--- a/app/views/errors/not_found.html.slim
+++ b/app/views/errors/not_found.html.slim
@@ -1,7 +1,4 @@
-/ PageHeader
-= pageheader 'bug',
- 'Erreur 404',
- ''
+- content_for :page_header_title, 'Erreur 404'
.page_content
.container-fluid
@@ -11,11 +8,11 @@
- if I18n.locale == :fr
p
strong = "Désolé, la page demandée n'existe pas."
-
+
p = "Vous pouvez néanmoins continuer à utiliser l'application IBOO."
-
+
- else
p
strong = "The page you were looking for doesn't exist."
-
+
p = "You can still continue the use the IBOO application. Thank you for understanding."
diff --git a/app/views/errors/server_error.html.slim b/app/views/errors/server_error.html.slim
index 09884dc29..189a48760 100644
--- a/app/views/errors/server_error.html.slim
+++ b/app/views/errors/server_error.html.slim
@@ -1,7 +1,4 @@
-/ PageHeader
-= pageheader 'bug',
- 'Erreur serveur',
- ''
+- content_for :page_header_title, 'Erreur serveur'
.page_content
.container-fluid
@@ -11,11 +8,11 @@
- if I18n.locale == :fr
p
strong = "Désolé, une erreur est survenue."
-
+
p = "Vous pouvez néanmoins continuer à utiliser l'application IBOO."
-
+
- else
p
strong = "We're sorry, but something went wrong."
-
+
p = "You can still continue the use the IBOO application. Thank you for understanding."
diff --git a/app/views/import_resources/index.html.slim b/app/views/import_resources/index.html.slim
index 57c83ce82..1c4a5a765 100644
--- a/app/views/import_resources/index.html.slim
+++ b/app/views/import_resources/index.html.slim
@@ -1,11 +1,4 @@
-/ PageHeader
-= pageheader 'importer',
- t('.title'),
- '',
- '',
- ''
-/ PageContent
.page_content.import_messages
.container-fluid
.row
@@ -38,7 +31,7 @@
), \
TableBuilderHelper::Column.new( \
name: 'Résultat des tests' , \
- attribute: Proc.new { |n| I18n.t('import_resources.index.metrics', import_resoruce_metrics(n.metrics) }, \
+ attribute: Proc.new { |n| I18n.t('import_resources.index.metrics', n.metrics.deep_symbolize_keys) }, \
sortable: false, \
), \
TableBuilderHelper::Column.new( \
diff --git a/app/views/imports/index.html.slim b/app/views/imports/index.html.slim
index 35cd666b1..79452bbfc 100644
--- a/app/views/imports/index.html.slim
+++ b/app/views/imports/index.html.slim
@@ -1,12 +1,7 @@
- breadcrumb :imports, @workbench
-/ PageHeader
-= pageheader 'importer',
- t('.title'),
- '',
- '',
- link_to(t('imports.actions.new'), new_workbench_import_path(workbench_id: @workbench), class: 'btn btn-primary')
+- content_for :page_header_actions do
+ = link_to(t('imports.actions.new'), new_workbench_import_path(workbench_id: @workbench), class: 'btn btn-primary')
-/ PageContent
.page_content
.container-fluid
- if params[:q].present? or @imports.any?
diff --git a/app/views/imports/new.html.slim b/app/views/imports/new.html.slim
index b74d8eaf2..3e35028f7 100644
--- a/app/views/imports/new.html.slim
+++ b/app/views/imports/new.html.slim
@@ -1,9 +1,5 @@
- breadcrumb :imports, @workbench
-/ PageHeader
-= pageheader 'importer',
- t('.title')
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/imports/show.html.slim b/app/views/imports/show.html.slim
index 775b09e8b..5e22e03e0 100644
--- a/app/views/imports/show.html.slim
+++ b/app/views/imports/show.html.slim
@@ -1,11 +1,5 @@
- breadcrumb :import, @workbench, @import
-/ PageHeader
-= pageheader 'importer',
- @import.name,
- '',
- t('last_update', time: l(@import.updated_at, format: :short)) do
-
- / Below is secundary actions & optional contents (filters, ...)
+- content_for :page_header_content do
.row
.col-lg-12.text-right.mb-sm
- @import.action_links.each do |link|
@@ -15,7 +9,8 @@
class: 'btn btn-primary' do
= link.content
-/ PageContent
+- page_header_content_for @import
+
.page_content
.container-fluid
.row
diff --git a/app/views/journey_patterns_collections/show.html.slim b/app/views/journey_patterns_collections/show.html.slim
index 7c62b69ee..834501da3 100644
--- a/app/views/journey_patterns_collections/show.html.slim
+++ b/app/views/journey_patterns_collections/show.html.slim
@@ -1,9 +1,7 @@
- breadcrumb :journey_patterns, @referential, @route
-/ pageheader
-= pageheader 'mission',
- "Missions de #{@route.try(:stop_points).first.try(:stop_area).name} vers #{@route.try(:stop_points).last.try(:stop_area).name}",
- 'Lorem ipsum dolor sit amet',
- ''
+- page_header_content_for @route
+- content_for :page_header_title, t('journey_patterns.index.title', route: @route.name), flush: true
+
- @journey_patterns.each do |jp|
- jp.errors.each do |error_message|
= error_message
diff --git a/app/views/layouts/application.html.slim b/app/views/layouts/application.html.slim
index 8c731007d..567e14ef0 100644
--- a/app/views/layouts/application.html.slim
+++ b/app/views/layouts/application.html.slim
@@ -17,6 +17,7 @@ html lang=I18n.locale
body
= render 'layouts/navigation/main_nav'
= render 'layouts/flash_messages', flash: flash
+ = render 'layouts/navigation/page_header'
= yield
#sidebar
= yield :sidebar
diff --git a/app/views/layouts/navigation/_page_header.html.slim b/app/views/layouts/navigation/_page_header.html.slim
new file mode 100644
index 000000000..90fd7d855
--- /dev/null
+++ b/app/views/layouts/navigation/_page_header.html.slim
@@ -0,0 +1,23 @@
+div.page_header
+ div.container-fluid
+ div.row
+ div.col-lg-9.col-md-8.col-sm-7.col-xs-7
+ - if defined?(resource_class)
+ div.page-icon
+ span.sb class="sb-#{resource_class.model_name.name.underscore}"
+ div.page-title
+ - if content_for? :page_header_title
+ h1 = yield :page_header_title
+ - else
+ - if defined?(resource_class)
+ h1 = t("#{resource_class.model_name.name.underscore.pluralize}.#{params[:action]}.title")
+
+ div.col-lg-3.col-md-4.col-sm-5.col-xs-5.text-right
+ div.page-action
+ - if content_for? :page_header_meta
+ = yield :page_header_meta
+ - if content_for? :page_header_actions
+ = yield :page_header_actions
+
+ - if content_for? :page_header_content
+ = yield :page_header_content
diff --git a/app/views/line_footnotes/edit.html.slim b/app/views/line_footnotes/edit.html.slim
index 4a0fbb931..203bdab94 100644
--- a/app/views/line_footnotes/edit.html.slim
+++ b/app/views/line_footnotes/edit.html.slim
@@ -1,10 +1,5 @@
-/ PageHeader
-= pageheader 'ligne',
- "Notes sur la ligne #{@line.name}",
- 'Lorem ipsum dolor sit amet',
- (@line.footnotes.any? ? t('last_update', time: l(@line.footnotes.last.updated_at, format: :short)) : '')
+- page_header_content_for @line
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/line_footnotes/show.html.slim b/app/views/line_footnotes/show.html.slim
index 0ed1d2958..e4f2a1d42 100644
--- a/app/views/line_footnotes/show.html.slim
+++ b/app/views/line_footnotes/show.html.slim
@@ -1,12 +1,11 @@
- breadcrumb :line_footnotes, @referential, @line
-/ PageHeader
-= pageheader 'ligne',
- "Notes sur la ligne #{@line.name}",
- 'Lorem ipsum dolor sit amet',
- '',
- (policy(@line).update_footnote? ? link_to(t('actions.edit'), edit_referential_line_footnotes_path(@referential, @line), class: 'btn btn-primary') : '')
-/ PageContent
+- content_for :page_header_actions do
+ - if policy(@line).update_footnote?
+ = link_to(t('actions.edit'), edit_referential_line_footnotes_path(@referential, @line), class: 'btn btn-primary')
+
+- page_header_content_for @line
+
.page_content
.container-fluid
.row
diff --git a/app/views/line_referentials/edit.html.slim b/app/views/line_referentials/edit.html.slim
index 820b788e5..374d34ed3 100644
--- a/app/views/line_referentials/edit.html.slim
+++ b/app/views/line_referentials/edit.html.slim
@@ -1,3 +1,2 @@
-= title_tag t('line_referentials.edit.title', line_referential: @line_referential.name)
-
-= render 'form' \ No newline at end of file
+- page_header_content_for @line_referential
+= render 'form'
diff --git a/app/views/line_referentials/show.html.slim b/app/views/line_referentials/show.html.slim
index b98e9d5bb..b4b32bc52 100644
--- a/app/views/line_referentials/show.html.slim
+++ b/app/views/line_referentials/show.html.slim
@@ -1,12 +1,9 @@
- breadcrumb :line_referential, @line_referential
-/ PageHeader
-= pageheader 'synchro-ilico',
- t('.title'),
- 'Lorem ipsum dolor sit amet',
- t('last_update', time: l(@line_referential.updated_at, format: :short)),
- link_to(t('actions.sync'), sync_line_referential_path(@line_referential), method: :post, class: 'btn btn-default') do
+- page_header_content_for @line_referential
+- content_for :page_header_actions do
+ = link_to(t('actions.sync'), sync_line_referential_path(@line_referential), method: :post, class: 'btn btn-default')
- / Below is secundary actions & opt. contents
+- content_for :page_header_content do
.row.mb-md
.col-lg-12.text-right
= link_to line_referential_companies_path(@line_referential), class: 'btn btn-primary' do
@@ -19,7 +16,6 @@
= Referential.human_attribute_name(:lines)
em.small = " (#{@line_referential.lines.size})"
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/lines/_filters.html.slim b/app/views/lines/_filters.html.slim
index 58f8f2431..e3674656a 100644
--- a/app/views/lines/_filters.html.slim
+++ b/app/views/lines/_filters.html.slim
@@ -8,11 +8,11 @@
.ffg-row
.form-group.togglable
- = f.label Chouette::Line.human_attribute_name(:network), required: false, class: 'control-label'
+ = f.label Chouette::Line.human_attribute_name(:network_id), required: false, class: 'control-label'
= f.input :network_id_eq_any, collection: @line_referential.networks.order(name: :asc), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l.name + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
.form-group.togglable
- = f.label Chouette::Line.human_attribute_name(:company), required: false, class: 'control-label'
+ = f.label Chouette::Line.human_attribute_name(:company_id), required: false, class: 'control-label'
= f.input :company_id_eq_any, collection: @line_referential.companies.order(name: :asc), as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + l.name + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
.form-group.togglable
diff --git a/app/views/lines/_form.html.slim b/app/views/lines/_form.html.slim
index d7b5a65ed..4952b72ff 100644
--- a/app/views/lines/_form.html.slim
+++ b/app/views/lines/_form.html.slim
@@ -1,45 +1,22 @@
-= semantic_form_for [@line_referential, @line] do |form|
- = form.inputs do
- / = form.input :network, as: :select, :collection => Chouette::Network.all, include_blank: false
- / = form.input :company, as: :select, :collection => Chouette::Company.all, include_blank: false
- / = form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.name") }
- / = form.input :published_name
- / = form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.registration_number")}
- / = form.input :number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.number") }
- / = form.input :transport_mode, include_blank: false
- / = form.input :color, as: :string
- / = form.input :text_color
- / = form.input :stable_id
- / = form.input :url
- / = form.input :mobility_restricted_suitability, as: :select, :collection => [[@line.human_attribute_name("accessible"), true], [@line.human_attribute_name("not_accessible"), false]], :include_blank => true
- / = form.input :flexible_service, as: :select, :collection => [[@line.human_attribute_name("on_demaond_fs"), true], [@line.human_attribute_name("regular_fs"), false]], :include_blank => true
- / = form.input :comment
- / = form.input :objectid, :required => !@line.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.line.objectid")}
- / = form.input :group_of_line_tokens, :label => t('.group_of_lines'), as: :text, :input_html => { :"data-pre" => ( @line.group_of_lines.map { |group_of_line| { :id => group_of_line.id, :name => group_of_line.name } } ).to_json }
+= simple_form_for [@line_referential, @line], html: {class: 'form-horizontal', id: 'lines_form'}, wrapper: :horizontal_form do |f|
+ .row
+ .col-lg-12
+ = f.input :name
+ = f.input :network_id, as: :select, :collection => @line_referential.networks, include_blank: false
+ = f.input :company_id, as: :select, :collection => @line_referential.companies, include_blank: false
+ = f.input :published_name
+ = f.input :registration_number
+ = f.input :number
+ = f.input :transport_mode, as: :select, collection: Chouette::Line.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}, required: true, :include_blank => false
+ = f.input :transport_submode, as: :select, collection: Chouette::Line.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}, :include_blank => true
+ = f.input :color, as: :string
+ = f.input :text_color
+ = f.input :stable_id
+ = f.input :url
+ = f.input :mobility_restricted_suitability, as: :select, :collection => [[@line.human_attribute_name("accessible"), true], [@line.human_attribute_name("not_accessible"), false]], :include_blank => true
+ = f.input :flexible_service, as: :select, :collection => [[@line.human_attribute_name("on_demaond_fs"), true], [@line.human_attribute_name("regular_fs"), false]], :include_blank => true
+ = f.input :comment
+ .separator
- .footnotes_block
- h3 = t("footnotes.index.title")
+ = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'lines_form'
- #footnotes
- = form.semantic_fields_for :footnotes do |f|
- = render "footnotes/footnote_fields", :f => f
-
- .add_footnote
- = link_to_add_association t("footnotes.actions.add_footnote"), form, :footnotes , :partial => "footnotes/footnote_fields", :"data-association-insertion-method" => "append", :"data-association-insertion-node" => "div#footnotes", class: 'add'
-
- = form.actions do
- = form.action :submit, as: :button
- = form.action :cancel, as: :link
-
-javascript:
- $(function() {
- $("#line_group_of_line_tokens").tokenInput("#{name_filter_referential_group_of_lines_path(@line_referential, format: :json)}", {
- crossDomain: false,
- prePopulate: $('#group_of_line_tokens').data('pre'),
- minChars: 3,
- preventDuplicates: true,
- hintText: "#{I18n.t('search_hint')}",
- noResultsText: "#{I18n.t('no_result_text')}",
- searchingText: "#{I18n.t('searching_term')}"
- });
- });
diff --git a/app/views/lines/edit.html.slim b/app/views/lines/edit.html.slim
index 3c2eee03f..efe674ba4 100644
--- a/app/views/lines/edit.html.slim
+++ b/app/views/lines/edit.html.slim
@@ -1,5 +1,8 @@
- breadcrumb :line, @line
+- page_header_content_for @line
-= title_tag t('lines.edit.title', line: @line.name)
-
-= render 'form'
+.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/lines/index.html.slim b/app/views/lines/index.html.slim
index 911c95e0c..8b035b477 100644
--- a/app/views/lines/index.html.slim
+++ b/app/views/lines/index.html.slim
@@ -1,12 +1,8 @@
- breadcrumb :lines, @line_referential
-/ PageHeader
-= pageheader 'ligne',
- t('lines.index.title'),
- 'Lorem ipsum dolor sit amet',
- '',
- ((policy(Chouette::Line).create? && @line_referential.organisations.include?(current_organisation)) ? link_to(t('lines.actions.new'), new_line_referential_line_path(@line_referential), class: 'btn btn-primary') : '')
+- content_for :page_header_actions do
+ - if (policy(Chouette::Line).create? && @line_referential.organisations.include?(current_organisation))
+ = link_to(t('lines.actions.new'), new_line_referential_line_path(@line_referential), class: 'btn btn-primary')
-/ PageContent
.page_content
.container-fluid
- if params[:q].present? or @lines.any?
diff --git a/app/views/lines/new.html.slim b/app/views/lines/new.html.slim
index f09a4b4aa..6eecf1e7d 100644
--- a/app/views/lines/new.html.slim
+++ b/app/views/lines/new.html.slim
@@ -1,5 +1,6 @@
- breadcrumb :lines, @line_referential
-
-= title_tag t('lines.new.title')
-
-= render 'form'
+.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/lines/show.html.slim b/app/views/lines/show.html.slim
index ccf237154..4969ca3cd 100644
--- a/app/views/lines/show.html.slim
+++ b/app/views/lines/show.html.slim
@@ -1,11 +1,5 @@
- breadcrumb :line, @line
-/ PageHeader
-= pageheader 'ligne',
- @line.name,
- 'Lorem ipsum dolor sit amet',
- t('last_update', time: l(@line.updated_at, format: :short)) do
-
- / Below is secundary actions & optional contents
+- content_for :page_header_content do
.row
.col-lg-12.text-right.mb-sm
- @line.action_links.each do |link|
@@ -15,7 +9,8 @@
class: 'btn btn-primary' do
= link.content
-/ PageContent
+- page_header_content_for @line
+
.page_content
.container-fluid
.row
@@ -23,8 +18,8 @@
= definition_list t('metadatas'),
{ 'ID Codif' => @line.get_objectid.short_id,
'Activé' => (@line.deactivated? ? t('false') : t('true')),
- @line.human_attribute_name(:network) => (@line.network.nil? ? t('lines.index.unset') : @line.network.name),
- @line.human_attribute_name(:company) => (@line.company.nil? ? t('lines.index.unset') : @line.company.name),
+ @line.human_attribute_name(:network_id) => (@line.network.nil? ? t('lines.index.unset') : @line.network.name),
+ @line.human_attribute_name(:company_id) => (@line.company.nil? ? t('lines.index.unset') : @line.company.name),
'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 : '-'),
diff --git a/app/views/networks/_form.html.slim b/app/views/networks/_form.html.slim
index 7b048edc9..362584f97 100644
--- a/app/views/networks/_form.html.slim
+++ b/app/views/networks/_form.html.slim
@@ -1,15 +1,14 @@
-= semantic_form_for [@line_referential, @network] do |form|
- = form.inputs do
- = form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.network.name")}
- = form.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.network.registration_number")}
- = form.input :comment
- = form.input :version_date, as: :date_picker
- = form.input :description
- = form.input :source_name
- = form.input :source_type_name, as: :select, :collection => source_type_name_label_pairs, :include_blank => true
- = form.input :source_identifier
- = form.input :objectid, :required => !@network.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.network.objectid")}
+= simple_form_for [@line_referential, @network], html: {class: 'form-horizontal', id: 'network_form'}, wrapper: :horizontal_form do |f|
+ .row
+ .col-lg-12
+ = f.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.network.name")}
+ = f.input :registration_number, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@line_referential)}.network.registration_number")}
+ = f.input :comment
+ = f.input :version_date, :label_html => { :class => 'string optional col-sm-4 col-xs-5 control-label' }, :wrapper => :multi_select_inline
+ = f.input :description
+ = f.input :source_name
+ = f.input :source_type_name, as: :select, :collection => Chouette::Network.source_type_name.options, :include_blank => true
+ = f.input :source_identifier
+ .separator
- = form.actions do
- = form.action :submit, as: :button
- = form.action :cancel, as: :link
+ = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'network_form'
diff --git a/app/views/networks/edit.html.slim b/app/views/networks/edit.html.slim
index 2d511e15d..64513d250 100644
--- a/app/views/networks/edit.html.slim
+++ b/app/views/networks/edit.html.slim
@@ -1,4 +1,7 @@
- breadcrumb :network, @network
-= title_tag t('networks.edit.title', network: @network.name)
-
-= render 'form'
+- page_header_content_for @network
+.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/networks/index.html.slim b/app/views/networks/index.html.slim
index 6004f5859..b13c73e9e 100644
--- a/app/views/networks/index.html.slim
+++ b/app/views/networks/index.html.slim
@@ -1,12 +1,8 @@
- breadcrumb :networks, @line_referential
-/ PageHeader
-= pageheader 'reseau',
- t('networks.index.title'),
- 'Lorem ipsum dolor sit amet',
- '',
- (policy(Chouette::Network).create? ? link_to(t('networks.actions.new'), new_line_referential_network_path(@line_referential), class: 'btn btn-primary') : '')
+- content_for :page_header_actions do
+ - if policy(Chouette::Network).create?
+ = link_to(t('networks.actions.new'), new_line_referential_network_path(@line_referential), class: 'btn btn-primary')
-/ PageContent
.page_content
.container-fluid
- if params[:q].present? or @networks.any?
@@ -27,7 +23,7 @@
[ \
TableBuilderHelper::Column.new( \
name: 'Oid', \
- attribute: Proc.new { |n| n.get_objectid.try(:short_id) }, \
+ attribute: Proc.new { |n| n.try(:get_objectid).try(:short_id) }, \
sortable: false \
),
TableBuilderHelper::Column.new( \
diff --git a/app/views/networks/new.html.slim b/app/views/networks/new.html.slim
index cf04ab03f..590d2b409 100644
--- a/app/views/networks/new.html.slim
+++ b/app/views/networks/new.html.slim
@@ -1,4 +1,6 @@
- breadcrumb :networks, @line_referential
-= title_tag t('networks.new.title')
-
-= render 'form'
+.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/networks/show.html.slim b/app/views/networks/show.html.slim
index 89aa1e50a..f7d40a049 100644
--- a/app/views/networks/show.html.slim
+++ b/app/views/networks/show.html.slim
@@ -1,11 +1,6 @@
- breadcrumb :network, @network
-/ PageHeader
-= pageheader 'reseau',
- @network.name,
- '',
- t('last_update', time: l(@network.updated_at, format: :short)) do
-
- / Below is secundary actions & optional contents (filters, ...)
+- page_header_content_for @network
+- content_for :page_header_content do
.row
.col-lg-12.text-right.mb-sm
- @network.action_links.each do |link|
@@ -14,8 +9,6 @@
data: link.data,
class: 'btn btn-primary' do
= link.content
-
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/referential_companies/edit.html.slim b/app/views/referential_companies/edit.html.slim
index d191d2a37..b3fcf6cd8 100644
--- a/app/views/referential_companies/edit.html.slim
+++ b/app/views/referential_companies/edit.html.slim
@@ -1,4 +1,3 @@
- breadcrumb :referential_company, @referential, @company
-
-= title_tag t('companies.edit.title', company: @company.name)
+- page_header_content_for @company
= render 'form'
diff --git a/app/views/referential_companies/index.html.slim b/app/views/referential_companies/index.html.slim
index 3348dc722..de0f7de69 100644
--- a/app/views/referential_companies/index.html.slim
+++ b/app/views/referential_companies/index.html.slim
@@ -1,12 +1,8 @@
- breadcrumb :referential_companies, @referential
-/ PageHeader
-= pageheader 'transporteur',
- t('companies.index.title'),
- '',
- '',
- (policy(Chouette::Company).create? ? link_to(t('companies.actions.new'), new_referential_company_path(@referential), class: 'btn btn-default') : '')
+- content_for :page_header_actions do
+ - if policy(Chouette::Company).create?
+ = link_to(t('companies.actions.new'), new_referential_company_path(@referential), class: 'btn btn-default')
-/ PageContent
.page_content
.container-fluid
- if params[:q].present? or @companies.any?
diff --git a/app/views/referential_companies/new.html.slim b/app/views/referential_companies/new.html.slim
index 1c7fc7297..5e59db139 100644
--- a/app/views/referential_companies/new.html.slim
+++ b/app/views/referential_companies/new.html.slim
@@ -1,3 +1,2 @@
- breadcrumb :referential_companies, @referential
-= title_tag t('companies.new.title')
= render 'form'
diff --git a/app/views/referential_companies/show.html.slim b/app/views/referential_companies/show.html.slim
index 0dbc3cdd0..1599145be 100644
--- a/app/views/referential_companies/show.html.slim
+++ b/app/views/referential_companies/show.html.slim
@@ -1,11 +1,5 @@
- breadcrumb :referential_company, @referential, @company
-/ PageHeader
-= pageheader 'transporteur',
- @company.name,
- 'Lorem ipsum dolor sit amet',
- t('last_update', time: l(@company.updated_at, format: :short)) do
-
- / Below is secundary actions & optional contents (filters, ...)
+- content_for :page_header_content do
.row
.col-lg-12.text-right.mb-sm
- if policy(Chouette::Company).create?
@@ -17,7 +11,8 @@
span.fa.fa-trash
span = t('companies.actions.destroy')
-/ PageContent
+- page_header_content_for @company
+
.page_content
.container-fluid
.row
diff --git a/app/views/referential_lines/edit.html.slim b/app/views/referential_lines/edit.html.slim
index 8c51715ba..45f26a05c 100644
--- a/app/views/referential_lines/edit.html.slim
+++ b/app/views/referential_lines/edit.html.slim
@@ -1,4 +1,3 @@
-- breadcrumb :referential_line, @line, @referential
-= title_tag t('lines.edit.title', line: @line.name)
-
+- breadcrumb :referential_line, @referential, @line
+- page_header_content_for @line
= render 'form'
diff --git a/app/views/referential_lines/new.html.slim b/app/views/referential_lines/new.html.slim
index 56da24d7c..bcc583279 100644
--- a/app/views/referential_lines/new.html.slim
+++ b/app/views/referential_lines/new.html.slim
@@ -1,3 +1 @@
-= title_tag t('lines.new.title')
-
-= render 'form' \ No newline at end of file
+= render 'form'
diff --git a/app/views/referential_lines/show.html.slim b/app/views/referential_lines/show.html.slim
index 7607c391b..cfba8cab3 100644
--- a/app/views/referential_lines/show.html.slim
+++ b/app/views/referential_lines/show.html.slim
@@ -1,11 +1,5 @@
- breadcrumb :referential_line, @referential, @line
-/ PageHeader
-= pageheader 'ligne',
- t('lines.index.line', line: @line.name),
- '',
- t('last_update', time: l(@line.updated_at, format: :short)) do
-
- / Below is secundary actions & optional contents
+- content_for :page_header_content do
.row
.col-lg-12.text-right.mb-sm
- @line.action_links.each do |link|
@@ -14,8 +8,8 @@
data: link.data,
class: 'btn btn-primary' do
= link.content
+- page_header_content_for @line
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/referential_networks/edit.html.slim b/app/views/referential_networks/edit.html.slim
index dded4b176..a77d2db34 100644
--- a/app/views/referential_networks/edit.html.slim
+++ b/app/views/referential_networks/edit.html.slim
@@ -1,4 +1,3 @@
- breadcrumb :referential_network, @referential, @network
-= title_tag t('networks.edit.title', network: @network.name)
-
+- page_header_content_for @network
= render 'form'
diff --git a/app/views/referential_networks/index.html.slim b/app/views/referential_networks/index.html.slim
index 6a2df6d16..d556e7e5e 100644
--- a/app/views/referential_networks/index.html.slim
+++ b/app/views/referential_networks/index.html.slim
@@ -1,12 +1,8 @@
- breadcrumb :referential_networks, @referential
-/ PageHeader
-= pageheader 'reseau',
- t('networks.index.title'),
- 'Lorem ipsum dolor sit amet',
- '',
- (policy(Chouette::Network).create? ? link_to(t('networks.actions.new'), new_referential_network_path(@referential), class: 'btn btn-default') : '')
+- if policy(Chouette::Network).create?
+ - content_for :page_header_actions do
+ = link_to(t('networks.actions.new'), new_referential_network_path(@referential), class: 'btn btn-default')
-/PageContent
.page_content
.container-fluid
- if params[:q].present? or @networks.any?
diff --git a/app/views/referential_networks/new.html.slim b/app/views/referential_networks/new.html.slim
index 4a737d9f7..9c2020eb3 100644
--- a/app/views/referential_networks/new.html.slim
+++ b/app/views/referential_networks/new.html.slim
@@ -1,5 +1,2 @@
- breadcrumb :referential_networks, @referential
-
-= title_tag t('networks.new.title')
-
= render 'form'
diff --git a/app/views/referential_networks/show.html.slim b/app/views/referential_networks/show.html.slim
index c2cc79e0d..7de304671 100644
--- a/app/views/referential_networks/show.html.slim
+++ b/app/views/referential_networks/show.html.slim
@@ -1,11 +1,6 @@
- breadcrumb :referential_network, @referential, @network
-/ PageHeader
-= pageheader 'reseau',
- @network.name,
- 'Lorem ipsum dolor sit amet',
- t('last_update', time: l(@network.updated_at, format: :short)) do
-
- / Below is secundary actions & optional contents (filters, ...)
+- page_header_content_for @network
+- content_for :page_header_content do
.row
.col-lg-12.text-right.mb-sm
- @network.action_links.each do |link|
diff --git a/app/views/referential_stop_areas/edit.html.slim b/app/views/referential_stop_areas/edit.html.slim
index fc7220095..d88230b58 100644
--- a/app/views/referential_stop_areas/edit.html.slim
+++ b/app/views/referential_stop_areas/edit.html.slim
@@ -1,4 +1,3 @@
- breadcrumb :referential_stop_area, @referential, @stop_area
-= title_tag t('stop_areas.edit.title', stop_area: @stop_area.name)
-
+- page_header_content_for @stop_area
= render 'form'
diff --git a/app/views/referential_stop_areas/index.html.slim b/app/views/referential_stop_areas/index.html.slim
index 718cbb472..ad04fb02e 100644
--- a/app/views/referential_stop_areas/index.html.slim
+++ b/app/views/referential_stop_areas/index.html.slim
@@ -1,5 +1,4 @@
- breadcrumb :referential_stop_areas, @referential
-= title_tag t('stop_areas.index.title')
= search_form_for @q, :url => referential_stop_areas_path(@referential), remote: true, :html => {:method => :get, class: "form-inline", :id => "search", role: "form"} do |f|
.panel.panel-default
diff --git a/app/views/referential_stop_areas/new.html.slim b/app/views/referential_stop_areas/new.html.slim
index 87ba9b657..9342b673b 100644
--- a/app/views/referential_stop_areas/new.html.slim
+++ b/app/views/referential_stop_areas/new.html.slim
@@ -1,4 +1,2 @@
- breadcrumb :referential_stop_areas, @referential
-= title_tag t('stop_areas.new.title')
-
= render 'form'
diff --git a/app/views/referential_stop_areas/show.html.slim b/app/views/referential_stop_areas/show.html.slim
index 7cc078ee0..0470b4654 100644
--- a/app/views/referential_stop_areas/show.html.slim
+++ b/app/views/referential_stop_areas/show.html.slim
@@ -1,9 +1,6 @@
- breadcrumb :referential_stop_area, @referential, @stop_area
-/ PageHeader
-= pageheader 'arret',
- @stop_area.name,
- 'Lorem ipsum dolor sit amet'
-
+- page_header_content_for @stop_area
+- content_for :page_header_content do
.row
.col-lg-12.text-right.mb-sm
- @stop_area.action_links.each do |link|
@@ -13,7 +10,6 @@
class: 'btn btn-primary' do
= link.content
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/referentials/edit.html.slim b/app/views/referentials/edit.html.slim
index 1fac626e6..904dc5439 100644
--- a/app/views/referentials/edit.html.slim
+++ b/app/views/referentials/edit.html.slim
@@ -1,10 +1,6 @@
-/ PageHeader
-= pageheader 'jeux-de-donnees',
- t('.title'),
- '',
- t('last_update', time: l(@referential.updated_at, format: :short))
+- breadcrumb @referential
+- page_header_content_for @referential
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/referentials/new.html.slim b/app/views/referentials/new.html.slim
index f4a7e4707..2bed9f912 100644
--- a/app/views/referentials/new.html.slim
+++ b/app/views/referentials/new.html.slim
@@ -1,12 +1,3 @@
-/ PageHeader
-- if @referential.created_from.present?
- = pageheader 'jeux-de-donnees',
- t('.duplicated.title')
-- else
- = pageheader 'jeux-de-donnees',
- t('.title')
-
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/referentials/select_compliance_control_set.html.slim b/app/views/referentials/select_compliance_control_set.html.slim
index 2d3f2344c..87a888c0a 100644
--- a/app/views/referentials/select_compliance_control_set.html.slim
+++ b/app/views/referentials/select_compliance_control_set.html.slim
@@ -1,10 +1,3 @@
-/ PageHeader
-- header_params = ['jeux-de-controle',
- t('referentials.select_compliance_control_set.title'),
- '']
-= pageheader(*header_params) do
-
-/ PageContent
.page_content
.container-fluid
.row
@@ -17,4 +10,4 @@
.col-sm-8.col-xs-7
= select_tag :compliance_control_set, options_from_collection_for_select(@compliance_control_sets, "id", "name"), class: 'select optional form-control'
.separator
- = button_tag t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'select_compliance_control_set' \ No newline at end of file
+ = button_tag t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'select_compliance_control_set'
diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim
index 0abeb0669..9852fb0a3 100644
--- a/app/views/referentials/show.html.slim
+++ b/app/views/referentials/show.html.slim
@@ -1,12 +1,10 @@
- breadcrumb @referential
-/ PageHeader
-= pageheader 'jeux-de-donnees',
- @referential.name,
- 'Lorem ipsum dolor sit amet',
- t('last_update', time: l(@referential.updated_at, format: :short)),
- ((@referential.archived? || !policy(@referential).edit?) ? '' : link_to(t('actions.edit'), edit_referential_path(@referential), class: 'btn btn-default')) do
+- page_header_content_for @referential
+- content_for :page_header_actions do
+ - unless (@referential.archived? || !policy(@referential).edit?)
+ = link_to(t('actions.edit'), edit_referential_path(@referential), class: 'btn btn-default')
- / Below is secondary actions & optional contents (filters, ...)
+- content_for :page_header_content do
.row.mb-sm
.col-lg-12.text-right
- @referential.action_links.each do |link|
@@ -19,7 +17,6 @@
class: 'btn btn-primary' do
= link.content
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/routes/edit.html.slim b/app/views/routes/edit.html.slim
index a69c5aeff..78f9a2e85 100644
--- a/app/views/routes/edit.html.slim
+++ b/app/views/routes/edit.html.slim
@@ -1,11 +1,6 @@
- breadcrumb :route, @referential, @route
-/ PageHeader
-= pageheader 'itineraire',
- @route.name,
- 'Lorem ipsum dolor sit amet',
- t('last_update', time: l(@route.updated_at, format: :short))
+- page_header_content_for @route
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/routes/new.html.slim b/app/views/routes/new.html.slim
index 3a8ceb963..9d5ca2e23 100644
--- a/app/views/routes/new.html.slim
+++ b/app/views/routes/new.html.slim
@@ -1,10 +1,4 @@
- breadcrumb :referential_line, @referential, @line
-/ PageHeader
-= pageheader 'itineraire',
- t('routes.new.title'),
- ''
-
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/routes/show.html.slim b/app/views/routes/show.html.slim
index 734d6ebf3..3adf3e2f6 100644
--- a/app/views/routes/show.html.slim
+++ b/app/views/routes/show.html.slim
@@ -1,12 +1,10 @@
- breadcrumb :route, @referential, @route
-/ PageHeader
-= pageheader 'itineraire',
- 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
+- page_header_content_for @route
+- content_for :page_header_actions do
+ - if policy(@route).edit?
+ = link_to(t('actions.edit'), edit_referential_line_route_path(@referential, @line, @route), class: 'btn btn-default')
- / Below is secundary actions & optional contents (filters, ...)
+- content_for :page_header_content do
.row.mb-sm
.col-lg-12.text-right
- @route.action_links.each do |link|
@@ -16,7 +14,6 @@
class: 'btn btn-primary' do
= link.content
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/routing_constraint_zones/edit.html.slim b/app/views/routing_constraint_zones/edit.html.slim
index c9b9b0c41..e971ee5dd 100644
--- a/app/views/routing_constraint_zones/edit.html.slim
+++ b/app/views/routing_constraint_zones/edit.html.slim
@@ -1,11 +1,6 @@
- breadcrumb :routing_constraint_zone, @referential, @line, @routing_constraint_zone
-/ PageHeader
-= pageheader 'itl',
- t('.title', routing_constraint_zone: @routing_constraint_zone.name),
- '',
- t('last_update', time: l(@routing_constraint_zone.updated_at, format: :short))
+- page_header_content_for @routing_constraint_zone
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/routing_constraint_zones/index.html.slim b/app/views/routing_constraint_zones/index.html.slim
index fcf904070..7c54fca68 100644
--- a/app/views/routing_constraint_zones/index.html.slim
+++ b/app/views/routing_constraint_zones/index.html.slim
@@ -1,12 +1,8 @@
- breadcrumb :routing_constraint_zones, @referential, @line
-/ PageHeader
-= pageheader 'itl',
- t('routing_constraint_zones.index.title'),
- '',
- '',
- ((policy(Chouette::RoutingConstraintZone).create? && @referential.organisation == current_organisation) ? link_to(t('actions.new'), new_referential_line_routing_constraint_zone_path(@referential, @line), class: 'btn btn-primary') : '')
+- content_for :page_header_actions do
+ - if (policy(Chouette::RoutingConstraintZone).create? && @referential.organisation == current_organisation)
+ = link_to(t('actions.new'), new_referential_line_routing_constraint_zone_path(@referential, @line), class: 'btn btn-primary')
-/ PageContent
.page_content
.container-fluid
- if params[:q].present? or @routing_constraint_zones.any?
diff --git a/app/views/routing_constraint_zones/new.html.slim b/app/views/routing_constraint_zones/new.html.slim
index d15de13a4..62ecf5e95 100644
--- a/app/views/routing_constraint_zones/new.html.slim
+++ b/app/views/routing_constraint_zones/new.html.slim
@@ -1,9 +1,5 @@
- breadcrumb :routing_constraint_zones, @referential, @line
-/ PageHeader
-= pageheader 'itl',
- t('.title')
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/routing_constraint_zones/show.html.slim b/app/views/routing_constraint_zones/show.html.slim
index d0c0619c3..6235ade68 100644
--- a/app/views/routing_constraint_zones/show.html.slim
+++ b/app/views/routing_constraint_zones/show.html.slim
@@ -1,11 +1,6 @@
- breadcrumb :routing_constraint_zone, @referential, @line, @routing_constraint_zone
-/ PageHeader
-= pageheader 'itl',
- @routing_constraint_zone.name,
- '',
- t('last_update', time: l(@routing_constraint_zone.updated_at, format: :short)) do
-
- / Below is secundary actions & optional contents
+- page_header_content_for @routing_constraint_zone
+- content_for :page_header_content do
.row
.col-lg-12.text-right.mb-sm
- @routing_constraint_zone.action_links.each do |link|
@@ -15,7 +10,6 @@
class: 'btn btn-primary' do
= link.content
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/stop_area_referentials/show.html.slim b/app/views/stop_area_referentials/show.html.slim
index 896ce756e..d43333fd9 100644
--- a/app/views/stop_area_referentials/show.html.slim
+++ b/app/views/stop_area_referentials/show.html.slim
@@ -1,18 +1,15 @@
- breadcrumb :stop_area_referential, @stop_area_referential
-/ PageHeader
-= pageheader 'synchro-icar',
- t('.title'),
- 'Lorem ipsum dolor sit amet',
- t('last_update', time: l(@stop_area_referential.updated_at, format: :short)),
- link_to(t('actions.sync'), sync_stop_area_referential_path(@stop_area_referential), method: :post, class: 'btn btn-default') do
+- content_for :page_header_actions do
+ = link_to(t('actions.sync'), sync_stop_area_referential_path(@stop_area_referential), method: :post, class: 'btn btn-default')
+- content_for :page_header_content do
.row.mb-md
.col-lg-12.text-right
= link_to stop_area_referential_stop_areas_path(@stop_area_referential), class: 'btn btn-primary' do
= Referential.human_attribute_name(:stop_areas)
em.small = " (#{@stop_area_referential.stop_areas.size})"
+- page_header_content_for @stop_area_referential
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/stop_areas/_form.html.slim b/app/views/stop_areas/_form.html.slim
index 546143393..20c7c0468 100644
--- a/app/views/stop_areas/_form.html.slim
+++ b/app/views/stop_areas/_form.html.slim
@@ -1,153 +1,45 @@
-= semantic_form_for [@stop_area_referential, @stop_area] do |form|
+= simple_form_for [@stop_area_referential, @stop_area], html: {class: 'form-horizontal', id: 'stop_area_form'}, wrapper: :horizontal_form do |f|
.row
- .container-fluid
- - if !manage_itl && @map
- = @map.to_html
-
- = form.inputs do
- = form.input :id, as: :hidden
- = form.input :name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.name")}
- = form.input :stop_area_type, as: :select, :input_html => { :disabled => !@stop_area.new_record? }, :collection => Chouette::StopArea.area_type.options, :include_blank => false
+ .col-lg-12
+ /- if !manage_itl && @map
+ - if !manage_itl
+ /= @map.to_html
+ = f.input :id, as: :hidden
+ = f.input :name, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.name")}
+ = f.input :area_type, as: :select, :input_html => {:disabled => !@stop_area.new_record?}, :collection => Chouette::StopArea.area_type.options, :include_blank => false
.location_info
h3 = t("stop_areas.stop_area.localisation")
- #prefetch
label = t('.geolocalize')
input.typeahead.form-control.input-lg maxlength="255" type="text" placeholder="#{t('.address')}"
- unless @stop_area.projection.blank? or @stop_area.projection_type_label.empty?
- = form.input :projection_xy, :label => t("activerecord.attributes.stop_area.projection_xy", :projection => @referential.projection_type_label), :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.projection_xy")}
-
- = form.input :coordinates, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.coordinates")}
- = form.input :street_name
- = form.input :country_code, required: format_restriction_for_locales(@referential) == '.hub'
- = form.input :zip_code, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.zip_code")}
- = form.input :city_name, required: format_restriction_for_locales(@referential) == '.hub', :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.city_name")}
-
- .stop_areas.stop_area.general_info
- h3 = t("stop_areas.stop_area.general")
-
- = form.inputs do
- = form.input :objectid, :required => !@stop_area.new_record?, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.objectid")}
- = form.input :registration_number, required: format_restriction_for_locales(@referential) == '.hub', :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.registration_number")}
- = form.input :fare_code, as: :number
- = form.input :nearest_topic_name, :input_html => { :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.nearest_topic_name")}
- = form.input :comment, as: :text, :input_html => { :rows => 5, :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.comment") }
- = form.input :time_zone, :include_blank => true
- = form.input :url
-
- .pmr_info
- h3 = t("stop_areas.stop_area.accessibility")
- = form.inputs do
- - if !manage_itl
- = form.input :mobility_restricted_suitability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true
- = form.input :stairs_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true
- = form.input :lift_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true
-
- = form.actions do
- = form.action :submit, as: :button
- = form.action :cancel, as: :link
-
-javascript:
- $(document).ready(function() {
- var address_display = function( address ) {
- var name = "";
- if ( address.house_number) {
- name += address.house_number+" ";
- }
- name += address.road+", ";
- if ( address.suburb) {
- name += address.suburb+", ";
- }
- if ( address.postcode) {
- name += address.postcode+" ";
- }
- if ( address.city) {
- name += address.city;
- } else if ( address.village) {
- name += address.village;
- } else if ( address.town) {
- name += address.town;
- } else if ( address.county ) {
- name += address.county;
- } else if ( address.country ) {
- name += address.country;
- }
-
-
- return name;
- };
- var filtering = function(list) {
- // update map view
- removeAddress();
-
- var selection = $.grep( list, function(item) {
- return (item.type == "house" || item.type == "residential" ||
- item.type == "tertiary" || item.type == "primary" ||
- item.type == "secondary") && item.address.road ;
- });
- return $.map( selection, function( d) {
- var city = "";
- if ( d.address.city) {
- city = d.address.city;
- } else if ( d.address.town) {
- city = d.address.town;
- } else if ( d.address.village) {
- city = d.address.village;
- }
- return { postcode: d.address.postcode,
- road: d.address.road,
- lon: d.lon, lat: d.lat,
- suburb: d.address.suburb,
- city: city,
- postcode: d.address.postcode,
- the_key: address_display( d.address)};
- });
- };
-
- var addressesEngine = new Bloodhound({
- datumTokenizer: function(d) {
- return Bloodhound.tokenizers.whitespace(d.id+" : "+d.road);
- },
- queryTokenizer: function(d) {
- return Bloodhound.tokenizers.whitespace(d.id+" :: "+d.road);
- },
- limit: 10,
- remote: {
- url: 'http://nominatim.openstreetmap.org/search?q=%QUERY&format=json&addressdetails=1&bounded=1&viewbox='+
- // FIXME #821
- //= @stop_area_referential.viewbox_left_top_right_bottom
- filter: filtering,
- }
- });
-
- // kicks off the loading/processing of `local` and `prefetch`
- var promise = addressesEngine.initialize();
-
- // passing in `null` for the `options` arguments will result in the default
- // options being used
- $('#prefetch .typeahead').typeahead(
- {
- hint: true,
- highlight: true,
- minLength: 1
- },
- {
- name: 'addresses',
- displayKey: 'the_key',
- source: addressesEngine.ttAdapter(),
- }
- );
-
- $('.typeahead').on('typeahead:selected', function($e, datum) {
- // update map view
- addAddress( datum.lon, datum.lat, datum.road);
- // update form fields
- <% if @stop_area.new_record? %>
- $('input[name="stop_area[street_name]"]').val(datum.road);
- $('input[name="stop_area[zip_code]"]').val(datum.postcode);
- $('input[name="stop_area[city_name]"]').val(datum.city);
- <% end %>
- })
- });
+ = f.input :projection_xy, :label => t("activerecord.attributes.stop_area.projection_xy", :projection => @referential.projection_type_label), :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.projection_xy")}
+
+ = f.input :coordinates, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.coordinates")}, required: true
+ = f.input :street_name
+ /= f.input :country_code, required: format_restriction_for_locales(@referential) == '.hub'
+ = f.input :zip_code, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.zip_code")}
+ = f.input :city_name, required: format_restriction_for_locales(@referential) == '.hub', :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.city_name")}
+
+ .stop_areas.stop_area.general_info
+ h3 = t("stop_areas.stop_area.general")
+
+ = f.input :registration_number, required: format_restriction_for_locales(@referential) == '.hub', :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.registration_number")}
+ = f.input :fare_code
+ = f.input :nearest_topic_name, :input_html => {:title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.nearest_topic_name")}
+ = f.input :comment, as: :text, :input_html => {:rows => 5, :title => t("formtastic.titles#{format_restriction_for_locales(@referential)}.stop_area.comment")}
+ = f.input :time_zone, :include_blank => true
+ = f.input :url
+
+ .pmr_info
+ h3 = t("stop_areas.stop_area.accessibility")
+ - if !manage_itl
+ = f.input :mobility_restricted_suitability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true
+ = f.input :stairs_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true
+ = f.input :lift_availability, as: :select, :collection => [[t("true"), true], [t("false"), false]], :include_blank => true
+
+ .separator
+
+ = f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'stop_area_form'
diff --git a/app/views/stop_areas/edit.html.slim b/app/views/stop_areas/edit.html.slim
index 8005f5a08..4f2b3f4de 100644
--- a/app/views/stop_areas/edit.html.slim
+++ b/app/views/stop_areas/edit.html.slim
@@ -1,4 +1,8 @@
- breadcrumb :stop_area, @stop_area_referential, @stop_area
-= title_tag t('stop_areas.edit.title', stop_area: @stop_area.name )
+- page_header_content_for @stop_area
-== render 'form'
+.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/stop_areas/index.html.slim b/app/views/stop_areas/index.html.slim
index 1b28f411e..c4d880081 100644
--- a/app/views/stop_areas/index.html.slim
+++ b/app/views/stop_areas/index.html.slim
@@ -1,18 +1,14 @@
- breadcrumb :stop_areas, @stop_area_referential
-/ PageHeader
-= pageheader 'arret',
- t('stop_areas.index.title'),
- '',
- '',
- (policy(Chouette::StopArea).create? ? link_to(t('stop_areas.actions.new'), new_stop_area_referential_stop_area_path(@stop_area_referential), class: 'btn btn-primary') : '')
+- content_for :page_header_actions do
+ - if policy(Chouette::StopArea).create?
+ = link_to(t('stop_areas.actions.new'), new_stop_area_referential_stop_area_path(@stop_area_referential), class: 'btn btn-primary')
-/ PageContent
.page_content
.container-fluid
- if params[:q].present? or @stop_areas.any?
.row
.col-lg-12
- = render 'filters'
+ = render 'filters'
- if @stop_areas.any?
.row
diff --git a/app/views/stop_areas/new.html.slim b/app/views/stop_areas/new.html.slim
index e0c5b7a61..69d78c533 100644
--- a/app/views/stop_areas/new.html.slim
+++ b/app/views/stop_areas/new.html.slim
@@ -1,4 +1,7 @@
- breadcrumb :stop_areas, @stop_area_referential
-= title_tag t('stop_areas.new.title')
-== render 'form'
+.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/stop_areas/select_parent.html.slim b/app/views/stop_areas/select_parent.html.slim
index 1289eafef..e387e83b8 100644
--- a/app/views/stop_areas/select_parent.html.slim
+++ b/app/views/stop_areas/select_parent.html.slim
@@ -1,5 +1,3 @@
-= title_tag t('stop_areas.select_parent.title', stop_area: @stop_area.name )
-
= semantic_form_for [@referential, @stop_area] do |form|
div
= form.inputs do
@@ -10,4 +8,4 @@
= form.action :cancel, as: :link
- content_for :sidebar do
- ul.actions \ No newline at end of file
+ ul.actions
diff --git a/app/views/stop_areas/show.html.slim b/app/views/stop_areas/show.html.slim
index 7f7c2e07f..af673bb25 100644
--- a/app/views/stop_areas/show.html.slim
+++ b/app/views/stop_areas/show.html.slim
@@ -1,9 +1,6 @@
- breadcrumb :stop_area, @stop_area_referential, @stop_area
-/ PageHeader
-= pageheader 'arret',
- @stop_area.name,
- 'Lorem ipsum dolor sit amet'
-
+- page_header_content_for @stop_area
+- content_for :page_header_content do
.row
.col-lg-12.text-right.mb-sm
- @stop_area.action_links.each do |link|
diff --git a/app/views/time_table_combinations/new.html.slim b/app/views/time_table_combinations/new.html.slim
index e49a10bc6..f18553081 100644
--- a/app/views/time_table_combinations/new.html.slim
+++ b/app/views/time_table_combinations/new.html.slim
@@ -1,10 +1,4 @@
-/ PageHeader
-= pageheader 'map-marker',
- t('time_tables.show.combine_form'),
- '',
- ''
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/time_tables/edit.html.slim b/app/views/time_tables/edit.html.slim
index a1ebb2c72..6ad572906 100644
--- a/app/views/time_tables/edit.html.slim
+++ b/app/views/time_tables/edit.html.slim
@@ -1,11 +1,6 @@
- breadcrumb :time_table, @referential, @time_table
-/ PageHeader
-= pageheader 'calendrier-application',
- @time_table.comment,
- '',
- ''
+- page_header_content_for @time_table
-/ PageContent
.page_content
.container-fluid
#periods
diff --git a/app/views/time_tables/index.html.slim b/app/views/time_tables/index.html.slim
index edbf89c43..b684b0bcb 100644
--- a/app/views/time_tables/index.html.slim
+++ b/app/views/time_tables/index.html.slim
@@ -1,11 +1,8 @@
- breadcrumb :time_tables, @referential
-/ PageHeader
-= pageheader 'calendrier-application',
- t('time_tables.index.title'),
- '',
- ((policy(Chouette::TimeTable).create? && @referential.organisation == current_organisation) ? link_to(t('actions.add'), new_referential_time_table_path(@referential), class: 'btn btn-default') : '')
+- content_for :page_header_actions do
+ - if (policy(Chouette::TimeTable).create? && @referential.organisation == current_organisation)
+ = link_to(t('actions.add'), new_referential_time_table_path(@referential), class: 'btn btn-default')
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/time_tables/new.html.slim b/app/views/time_tables/new.html.slim
index c8c2658ba..ddb34e0b7 100644
--- a/app/views/time_tables/new.html.slim
+++ b/app/views/time_tables/new.html.slim
@@ -1,11 +1,4 @@
- breadcrumb :time_tables, @referential
-/ PageHeader
-= pageheader 'calendrier-application',
- t("time_tables.#{params[:action]}.title"),
- '',
- ''
-
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/time_tables/show.html.slim b/app/views/time_tables/show.html.slim
index 85de7f8ec..036581268 100644
--- a/app/views/time_tables/show.html.slim
+++ b/app/views/time_tables/show.html.slim
@@ -1,14 +1,14 @@
- require 'calendar_helper'
- breadcrumb :time_table, @referential, @time_table
-/ PageHeader
+- page_header_content_for @time_table
-= pageheader 'calendrier-application',
- @time_table.comment,
- '',
- t('last_update', time: l(@time_table.updated_at, format: :short)),
- (policy(@time_table).edit? ? link_to(t('actions.edit'), edit_referential_time_table_path(@referential, @time_table), class: 'btn btn-default') : '')
+- content_for :page_header_title, t('time_tables.show.title', name: @time_table.comment), flush: true
- / Below is secundary actions & optional contents (filters, ...)
+- content_for :page_header_actions do
+ - if policy(@time_table).edit?
+ = link_to(t('actions.edit'), edit_referential_time_table_path(@referential, @time_table), class: 'btn btn-default')
+
+- content_for :page_header_content do
.row.mb-sm
.col-lg-12.text-right
- @time_table.action_links.each do |link|
@@ -18,7 +18,7 @@
class: 'btn btn-primary' do
= link.content
-/ PageContent
+
.page_content
.container-fluid
.row
diff --git a/app/views/vehicle_journeys/index.html.slim b/app/views/vehicle_journeys/index.html.slim
index 2046ecca6..52c1a9728 100644
--- a/app/views/vehicle_journeys/index.html.slim
+++ b/app/views/vehicle_journeys/index.html.slim
@@ -1,11 +1,6 @@
- breadcrumb :vehicle_journeys, @referential, @route
-/ PageHeader
-= pageheader 'horaires-des-courses',
- t('vehicle_journeys.index.title', route: @route.name ),
- 'Lorem ipsum dolor sit amet',
- '' do
+- content_for :page_header_title, t('vehicle_journeys.index.title', route: @route.name)
-/ PageContent
.page_content
.container-fluid
.row
diff --git a/app/views/vehicle_journeys/show.html.slim b/app/views/vehicle_journeys/show.html.slim
index 8ff4b188d..c67632864 100644
--- a/app/views/vehicle_journeys/show.html.slim
+++ b/app/views/vehicle_journeys/show.html.slim
@@ -1,2 +1,3 @@
+- page_header_content_for @vehicle_journey
== render 'show_details', vehicle_journey: @vehicle_journey
-== render 'show_sidebar' \ No newline at end of file
+== render 'show_sidebar'
diff --git a/app/views/workbenches/index.html.slim b/app/views/workbenches/index.html.slim
index d35ed8121..14fc79222 100644
--- a/app/views/workbenches/index.html.slim
+++ b/app/views/workbenches/index.html.slim
@@ -1,8 +1,5 @@
-/ PageHeader
-= pageheader 'tableau-de-bord',
- t('.title', organisation: current_organisation.name)
- / Below is secundary actions & optional contents (filters, ...)
+- content_for :page_header_content do
.row.mb-sm
.col-lg-12.text-right
- if policy(Api::V1::ApiKey).create?
diff --git a/app/views/workbenches/show.html.slim b/app/views/workbenches/show.html.slim
index 66eedb68d..22869b2d7 100644
--- a/app/views/workbenches/show.html.slim
+++ b/app/views/workbenches/show.html.slim
@@ -1,17 +1,12 @@
- breadcrumb @workbench
-/ PageHeader
-= pageheader 'jeux-de-donnees',
- t('referentials.index.title'),
- '',
- '' do
- / Below is secundary actions & optional contents (filters, ...)
+- page_header_content_for @workbench
+- content_for :page_header_content do
.row.mb-sm
.col-lg-12.text-right
- if policy(Referential).create?
= link_to t('actions.import'), workbench_imports_path(@workbench), class: 'btn btn-primary'
= link_to t('actions.add'), new_referential_path(workbench_id: @workbench), class: 'btn btn-primary'
-/ PageContent
.page_content
.container-fluid
- if params[:q].present? or @wbench_refs.any?
diff --git a/config/breadcrumbs.rb b/config/breadcrumbs.rb
index 4ef16059f..970f933f0 100644
--- a/config/breadcrumbs.rb
+++ b/config/breadcrumbs.rb
@@ -81,6 +81,11 @@ crumb :import do |workbench, import|
parent :imports, workbench
end
+crumb :import_resources do |import, import_resources|
+ link I18n.t('import_resources.index.title'), workbench_import_import_resources_path(import.workbench, import)
+ parent :import, import.workbench, import
+end
+
crumb :organisation do |organisation|
link breadcrumb_name(organisation), organisation_path(organisation)
end
@@ -192,7 +197,7 @@ crumb :route do |referential, route|
end
crumb :journey_patterns do |referential, route|
- link I18n.t('journey_patterns.index.title'), referential_line_route_journey_patterns_collection_path(referential, route.line, route)
+ link I18n.t('journey_patterns.index.title', route: route.name), referential_line_route_journey_patterns_collection_path(referential, route.line, route)
parent :route, referential, route
end
diff --git a/config/initializers/simple_form_bootstrap.rb b/config/initializers/simple_form_bootstrap.rb
index d90ea6398..4b9bd320d 100644
--- a/config/initializers/simple_form_bootstrap.rb
+++ b/config/initializers/simple_form_bootstrap.rb
@@ -132,6 +132,17 @@ SimpleForm.setup do |config|
ba.use :hint, wrap_with: { tag: 'p', class: 'help-block small' }
end
end
+
+ config.wrappers :multi_select_inline, tag: 'div', class: 'form-group', error_class: 'has-error' do |b|
+ b.use :html5
+ b.optional :readonly
+ b.use :label, class: 'control-label'
+ b.wrapper tag: 'div', class: 'form-inline col-sm-8 col-xs-7' do |ba|
+ ba.use :input, class: 'form-control'
+ ba.use :error, wrap_with: {tag: 'span', class: 'help-block small'}
+ ba.use :hint, wrap_with: {tag: 'p', class: 'help-block small'}
+ end
+ end
# Wrappers for forms and inputs using the Bootstrap toolkit.
# Check the Bootstrap docs (http://getbootstrap.com)
# to learn about the different styles for forms and inputs,
diff --git a/config/locales/calendars.en.yml b/config/locales/calendars.en.yml
index 3b015ff08..0076e5207 100644
--- a/config/locales/calendars.en.yml
+++ b/config/locales/calendars.en.yml
@@ -42,9 +42,9 @@ en:
new:
title: Add a new calendar
edit:
- title: Update calendar %{calendar}
+ title: Update calendar %{name}
show:
- title: Calendar %{calendar}
+ title: Calendar %{name}
simple_form:
labels:
calendar:
diff --git a/config/locales/calendars.fr.yml b/config/locales/calendars.fr.yml
index 55ec9c620..fddb47d64 100644
--- a/config/locales/calendars.fr.yml
+++ b/config/locales/calendars.fr.yml
@@ -42,9 +42,9 @@ fr:
new:
title: Ajouter un calendrier
edit:
- title: Editer le calendrier %{calendar}
+ title: Editer le calendrier %{name}
show:
- title: Calendrier %{calendar}
+ title: Calendrier %{name}
simple_form:
labels:
calendar:
diff --git a/config/locales/companies.en.yml b/config/locales/companies.en.yml
index 301f4d68d..a3cd520cb 100644
--- a/config/locales/companies.en.yml
+++ b/config/locales/companies.en.yml
@@ -9,9 +9,9 @@ en:
new:
title: "Add a new company"
edit:
- title: "Update company %{company}"
+ title: "Update company %{name}"
show:
- title: "Company %{company}"
+ title: "Company %{name}"
index:
title: "Companies"
name: "Search by name..."
diff --git a/config/locales/companies.fr.yml b/config/locales/companies.fr.yml
index 58fcc2ed7..0cf729c35 100644
--- a/config/locales/companies.fr.yml
+++ b/config/locales/companies.fr.yml
@@ -9,9 +9,9 @@ fr:
new:
title: "Ajouter un transporteur"
edit:
- title: "Editer le transporteur %{company}"
+ title: "Editer le transporteur %{name}"
show:
- title: "Transporteur %{company}"
+ title: "Transporteur %{name}"
index:
title: "Transporteurs"
name: "Recherche par nom..."
diff --git a/config/locales/compliance_check_sets.en.yml b/config/locales/compliance_check_sets.en.yml
index 1631ab06f..8023da0f7 100644
--- a/config/locales/compliance_check_sets.en.yml
+++ b/config/locales/compliance_check_sets.en.yml
@@ -7,6 +7,7 @@ en:
destroy_confirm: Are you sure you want to delete this control report?
filters:
name: Specify a control report name...
+ name_compliance_control_set: Specify a compliance control set name...
error_period_filter: End date must be greater than or equal to begin date
index:
title: Compliance control set
@@ -17,6 +18,10 @@ en:
search_no_results: No control reports match your search
executed:
title: Executed control report %{name}
+ show:
+ table_state: "%{lines_status} lines imported on %{lines_in_compliance_check_set} in the archive"
+ table_explanation: "These controls apply to all imported data and condition the construction of your organization's offer."
+ metrics: "%{ok_count} ok, %{error_count} errors, %{warning_count} warnings, %{uncheck_count} n/a"
errors:
no_parent: "The compliance check set doesn't any parent"
activerecord:
@@ -28,6 +33,11 @@ en:
assigned_to: Assigned to
compliance_control_set: Compliance control set
name: Name
+ compliance_check_resources:
+ name: Name of the line
+ status: Status
+ metrics: Test results
+ download: Download
models:
compliance_check_block:
one: compliance_control_set
diff --git a/config/locales/compliance_check_sets.fr.yml b/config/locales/compliance_check_sets.fr.yml
index b915d044a..0382f2937 100644
--- a/config/locales/compliance_check_sets.fr.yml
+++ b/config/locales/compliance_check_sets.fr.yml
@@ -7,12 +7,17 @@ fr:
destroy_confirm: Etes vous sûr de supprimer ce rapport de contrôle ?
filters:
name: Indiquez un nom d'un objet associé...
+ name_compliance_control_set: Indiquez le nom d'un jeu de contrôle
error_period_filter: La date de fin doit être supérieure ou égale à la date de début0
index:
title: "Liste des jeux de contrôles"
search_no_results: Aucun rapport de contrôle ne correspond à votre recherche
executed:
title: Jeu de contrôles exécutés %{name}
+ show:
+ table_state: "%{lines_status} lignes importées sur %{lines_in_compliance_check_set} présentes dans l'archive"
+ table_explanation: Ces contrôles s’appliquent pour toutes les données importées et conditionnent la construction de l’offre de votre organisation
+ metrics: "%{ok_count} ok, %{error_count} errors, %{warning_count} warnings, %{uncheck_count} n/a"
errors:
no_parent: "Le jeux de contrôle n'a pas de parent"
activerecord:
@@ -24,6 +29,11 @@ fr:
assigned_to: Affectation
compliance_control_set: jeu de contrôle
name: Nom
+ compliance_check_resource:
+ name: Nom de la ligne
+ status: État
+ metrics: Résultat des tests
+ download: Télécharger
models:
compliance_check_block:
zero: "Groupe de contrôle"
diff --git a/config/locales/en.yml b/config/locales/en.yml
index b65484bc2..e59960f95 100644
--- a/config/locales/en.yml
+++ b/config/locales/en.yml
@@ -47,7 +47,9 @@ en:
errors:
format: "%{message}"
- last_update: 'Last update on<br>%{time}'
+ last_update: 'Last update on %{time}'
+ whodunnit: 'By %{author}'
+ default_whodunnit: 'web service'
last_sync: 'Last sync on %{time}'
validity_range: '%{debut} > %{end}'
bounding_dates: '%{debut} > %{end}'
diff --git a/config/locales/enumerize.en.yml b/config/locales/enumerize.en.yml
index f5e51171b..bfd7b8c22 100644
--- a/config/locales/enumerize.en.yml
+++ b/config/locales/enumerize.en.yml
@@ -244,3 +244,15 @@ en:
streetCableCar: 'Street cable car'
allFunicularServices: 'All funicular services'
undefinedFunicular: 'Undefined funicular'
+ source_type_name:
+ name: "Source types"
+ public_and_private_utilities: "Public and private utilities"
+ road_authorities: "Road authorities"
+ transit_operator: "Transit operator"
+ public_transport: "Public transport"
+ passenger_transport_coordinating_authority: "Passenger transport coordinating authority"
+ travel_information_service_provider: "Travel information service provider"
+ travel_agency: "Travel_agency"
+ individual_subject_of_travel_itinerary: "Individual subject of travel itinerary"
+ other_information: "Other information"
+
diff --git a/config/locales/enumerize.fr.yml b/config/locales/enumerize.fr.yml
index a5845971b..b2eab665d 100644
--- a/config/locales/enumerize.fr.yml
+++ b/config/locales/enumerize.fr.yml
@@ -242,3 +242,14 @@ fr:
streetCableCar: 'Tramway (2)'
allFunicularServices: 'Tous services de funiculaire'
undefinedFunicular: 'Funiculaire non défini'
+ source_type_name:
+ name: "Type de source"
+ public_and_private_utilities: "Service public ou privé"
+ road_authorities: "Autorité routière"
+ transit_operator: "Exploitant de transport public"
+ public_transport: "Transport public"
+ passenger_transport_coordinating_authority: "Autorité organisatrice de transport public"
+ travel_information_service_provider: "Opérateur de voyage (voyagiste/tour operator ...)"
+ travel_agency: "Agence de voyage"
+ individual_subject_of_travel_itinerary: "Voyageur individuel"
+ other_information: "Autre source d'information"
diff --git a/config/locales/fr.yml b/config/locales/fr.yml
index 49e41a570..175b71ebc 100644
--- a/config/locales/fr.yml
+++ b/config/locales/fr.yml
@@ -47,7 +47,9 @@ fr:
errors:
format: "%{message}"
- last_update: 'Dernière mise à jour<br>le %{time}'
+ last_update: 'Dernière mise à jour le %{time}'
+ whodunnit: 'Par %{author}'
+ default_whodunnit: 'web service'
last_sync: 'Dernière mise à jour le %{time}'
validity_range: '%{debut} > %{end}'
bounding_dates: '%{debut} > %{end}'
diff --git a/config/locales/imports.en.yml b/config/locales/imports.en.yml
index 97574007c..926201150 100644
--- a/config/locales/imports.en.yml
+++ b/config/locales/imports.en.yml
@@ -17,6 +17,7 @@ en:
new:
title: "Imports"
show:
+ title: "Import %{name}"
report: "Report"
imported_file: "Original file"
compliance_check: "Validation report"
diff --git a/config/locales/imports.fr.yml b/config/locales/imports.fr.yml
index 59107cccb..207f5cc31 100644
--- a/config/locales/imports.fr.yml
+++ b/config/locales/imports.fr.yml
@@ -17,6 +17,7 @@ fr:
new:
title: "Imports"
show:
+ title: "Import %{name}"
report: "Rapport"
imported_file: "Fichier source"
compliance_check: "Test de conformité"
diff --git a/config/locales/journey_patterns.en.yml b/config/locales/journey_patterns.en.yml
index effac5569..e5248c29c 100644
--- a/config/locales/journey_patterns.en.yml
+++ b/config/locales/journey_patterns.en.yml
@@ -19,7 +19,7 @@ en:
title: "Journey Pattern %{journey_pattern}"
stop_points: "Stop point on journey pattern list"
index:
- title: "Journey Patterns"
+ title: "Journey Patterns of %{route}"
form:
warning: "Be careful, selection is also applied to the %{count} vehicle journeys associated to this journey pattern"
activerecord:
diff --git a/config/locales/journey_patterns.fr.yml b/config/locales/journey_patterns.fr.yml
index 23c43e2a7..e989d5820 100644
--- a/config/locales/journey_patterns.fr.yml
+++ b/config/locales/journey_patterns.fr.yml
@@ -19,7 +19,7 @@ fr:
title: "Mission %{journey_pattern}"
stop_points: "Liste des arrêts de la mission"
index:
- title: "Missions"
+ title: "Missions de %{route}"
form:
warning: "Attention, la sélection s'applique aussi aux %{count} courses de la mission"
activerecord:
diff --git a/config/locales/line_referentials.en.yml b/config/locales/line_referentials.en.yml
index c6e498b50..5663ed691 100644
--- a/config/locales/line_referentials.en.yml
+++ b/config/locales/line_referentials.en.yml
@@ -5,7 +5,7 @@ en:
sync: "Launch a new codifligne synchronization"
cancel_sync: "Cancel codifligne synchronization"
edit:
- title: "Edit %{line_referential} referential"
+ title: "Edit %{name} referential"
show:
title: "iLICO synchronization"
synchronized: Synchronized
diff --git a/config/locales/line_referentials.fr.yml b/config/locales/line_referentials.fr.yml
index 1711fdf9c..630a3e170 100644
--- a/config/locales/line_referentials.fr.yml
+++ b/config/locales/line_referentials.fr.yml
@@ -5,7 +5,7 @@ fr:
sync: "Lancer une synchronisation Codifligne"
cancel_sync: "Annuler la synchronisation Codifligne"
edit:
- title: "Editer le référentiel %{line_referential}"
+ title: "Editer le référentiel %{name}"
show:
title: 'Synchronisation iLICO'
synchronized: Synchronisé
diff --git a/config/locales/lines.en.yml b/config/locales/lines.en.yml
index 15e08290d..a69c3b0ba 100644
--- a/config/locales/lines.en.yml
+++ b/config/locales/lines.en.yml
@@ -18,9 +18,9 @@ en:
new:
title: "Add a new line"
edit:
- title: "Update line %{line}"
+ title: "Update line %{name}"
show:
- title: "Line %{line}"
+ title: "Line %{name}"
routes:
title: "Routes list"
group_of_lines: "Groups of lines"
@@ -62,10 +62,10 @@ en:
attributes:
line:
id: "ID"
- network: "Network"
+ network_id: "Network"
networks:
name: "Network"
- company: "Company"
+ company_id: "Company"
companies:
name: "Company"
registration_number: "Registration number"
diff --git a/config/locales/lines.fr.yml b/config/locales/lines.fr.yml
index c459eb51b..160cc4ab4 100644
--- a/config/locales/lines.fr.yml
+++ b/config/locales/lines.fr.yml
@@ -18,9 +18,9 @@ fr:
new:
title: "Ajouter une ligne"
edit:
- title: "Editer la ligne %{line}"
+ title: "Editer la ligne %{name}"
show:
- title: "Ligne %{line}"
+ title: "Ligne %{name}"
routes:
title: "Liste des Itinéraires"
itineraries: "Liste des séquences d'arrêts de la ligne"
@@ -63,10 +63,10 @@ fr:
attributes:
line:
id: "ID"
- network: "Réseau"
+ network_id: "Réseau"
networks:
name: "Réseau"
- company: "Transporteur principal"
+ company_id: "Transporteur principal"
companies:
name: "Transporteur principal"
registration_number: "Nom court"
diff --git a/config/locales/networks.en.yml b/config/locales/networks.en.yml
index 86be535e4..94a8d9df0 100644
--- a/config/locales/networks.en.yml
+++ b/config/locales/networks.en.yml
@@ -9,7 +9,7 @@ en:
new:
title: "Add a new network"
edit:
- title: "Update network %{network}"
+ title: "Update network %{name}"
show:
title: "Network"
index:
diff --git a/config/locales/networks.fr.yml b/config/locales/networks.fr.yml
index 30d061968..48c32e7c1 100644
--- a/config/locales/networks.fr.yml
+++ b/config/locales/networks.fr.yml
@@ -9,9 +9,9 @@ fr:
new:
title: "Ajouter un réseau"
edit:
- title: "Editer le réseau %{network}"
+ title: "Editer le réseau %{name}"
show:
- title: "Réseau %{network}"
+ title: "Réseau %{name}"
index:
title: "Réseaux"
name: "Recherche par nom..."
diff --git a/config/locales/routes.en.yml b/config/locales/routes.en.yml
index ba4f76daa..d82ba98dd 100644
--- a/config/locales/routes.en.yml
+++ b/config/locales/routes.en.yml
@@ -16,7 +16,7 @@ en:
new:
title: "Add a new route"
edit:
- title: "Update route %{route}"
+ title: "Update route %{name}"
select2:
placeholder: "Select a stop point..."
map:
@@ -37,7 +37,7 @@ en:
normal: Normal alighting
forbidden: Forbidden alighting
show:
- title: "Route %{route}"
+ title: "Route %{name}"
stop_points: "Stop point on route list"
stop_areas:
title: "Stop area list"
@@ -45,7 +45,7 @@ en:
no_opposite_route: "No reversed route associated"
undefined: "Undefined"
index:
- title: "Routes %{route}"
+ title: "Routes"
selection: "Selection"
selection_all: "All"
edit_boarding_alighting:
diff --git a/config/locales/routes.fr.yml b/config/locales/routes.fr.yml
index 3bcc33320..457345ae8 100644
--- a/config/locales/routes.fr.yml
+++ b/config/locales/routes.fr.yml
@@ -16,7 +16,7 @@ fr:
new:
title: "Ajouter un itinéraire"
edit:
- title: "Editer l'itinéraire %{route}"
+ title: "Editer l'itinéraire %{name}"
select2:
placeholder: "Sélectionnez un arrêt existant..."
map:
@@ -37,7 +37,7 @@ fr:
normal: Descente autorisée
forbidden: Descente interdite
show:
- title: "Itinéraire %{route} de la ligne %{line}"
+ title: "Itinéraire %{name}"
stop_points: "Liste des arrêts de l'itinéraire"
stop_areas:
title: "Liste des arrêts"
@@ -45,7 +45,7 @@ fr:
no_opposite_route: "Aucun itinéraire associé"
undefined: "Non défini"
index:
- title: "Itinéraire %{route}"
+ title: "Itinéraire"
selection: "Sélection"
selection_all: "Tous"
edit_boarding_alighting:
diff --git a/config/locales/routing_constraint_zones.en.yml b/config/locales/routing_constraint_zones.en.yml
index cc0a15e0c..34a10ac67 100644
--- a/config/locales/routing_constraint_zones.en.yml
+++ b/config/locales/routing_constraint_zones.en.yml
@@ -31,8 +31,8 @@ en:
new:
title: Add a new routings constraint zone
edit:
- title: "Update routing constraint zone %{routing_constraint_zone}"
+ title: "Update routing constraint zone %{name}"
show:
- title: "Routing constraint zone %{routing_constraint_zone}"
+ title: "Routing constraint zone %{name}"
index:
title: "Interdictions of local trafficous"
diff --git a/config/locales/routing_constraint_zones.fr.yml b/config/locales/routing_constraint_zones.fr.yml
index 10c6d37f7..80bbad8cf 100644
--- a/config/locales/routing_constraint_zones.fr.yml
+++ b/config/locales/routing_constraint_zones.fr.yml
@@ -31,8 +31,8 @@ fr:
new:
title: Créer une ITL
edit:
- title: "Editer l'ITL : %{routing_constraint_zone}"
+ title: "Editer l'ITL : %{name}"
show:
- title: "Zone de contrainte %{routing_constraint_zone}"
+ title: "Zone de contrainte %{name}"
index:
title: "Interdictions de trafic local"
diff --git a/config/locales/source_types.en.yml b/config/locales/source_types.en.yml
deleted file mode 100644
index 1cea5ed2c..000000000
--- a/config/locales/source_types.en.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-en:
- source_types:
- name: "Source type"
- label:
- public_and_private_utilities: "public and private utilities"
- road_authorities: "road authorities"
- transit_operator: "transit operator"
- public_transport: "public transport"
- passenger_transport_coordinating_authority: "passenger transport coordinating authority"
- travel_information_service_provider: "travel information service provider"
- travel_agency: "travel_agency"
- individual_subject_of_travel_itinerary: "individual subject of travel itinerary"
- other_information: "other information"
diff --git a/config/locales/source_types.fr.yml b/config/locales/source_types.fr.yml
deleted file mode 100644
index 6979a14b7..000000000
--- a/config/locales/source_types.fr.yml
+++ /dev/null
@@ -1,13 +0,0 @@
-fr:
- source_types:
- name: "Type de source"
- label:
- public_and_private_utilities: "Service public ou privé"
- road_authorities: "Autorité routière"
- transit_operator: "Exploitant de transport public"
- public_transport: "Transport public"
- passenger_transport_coordinating_authority: "Autorité organisatrice de transport public"
- travel_information_service_provider: "Opérateur de voyage (voyagiste/tour operator ...)"
- travel_agency: "Agence de voyage"
- individual_subject_of_travel_itinerary: "Voyageur individuel"
- other_information: "Autre source d'information"
diff --git a/config/locales/stop_areas.fr.yml b/config/locales/stop_areas.fr.yml
index 216516e5b..bf4dd832f 100644
--- a/config/locales/stop_areas.fr.yml
+++ b/config/locales/stop_areas.fr.yml
@@ -44,9 +44,9 @@ fr:
address: "246 Boulevard Saint-Germain, 75007 Paris"
geolocalize: "Géolocalisez "
edit:
- title: "Editer l'arrêt %{stop_area}"
+ title: "Editer l'arrêt %{name}"
show:
- title: "Arrêt %{stop_area}"
+ title: "Arrêt %{name}"
geographic_data: "Données géographiques"
no_geographic_data: "Aucune"
itl_managment: "Gestion des liens de l'ITL"
diff --git a/config/locales/time_tables.en.yml b/config/locales/time_tables.en.yml
index e68836f99..ff36a6d7d 100644
--- a/config/locales/time_tables.en.yml
+++ b/config/locales/time_tables.en.yml
@@ -36,7 +36,7 @@ en:
error_modal:
title: "Error"
withoutPeriodsWithDaysTypes: "A timetable can't have day type(s) without period(s)."
- withPeriodsWithoutDayTypes: "A tiemetable can't have period(s) swithout day type(s)."
+ withPeriodsWithoutDayTypes: "A tiemetable can't have period(s) swithout day type(s)."
error_submit:
periods_overlaps: "Periods cannot overlap in a timetable"
dates_overlaps: "A period cannot overlap a date in a timetable"
@@ -63,7 +63,7 @@ en:
begin: Period start
end: Period end
show:
- title: "Timetable %{time_table}"
+ title: "Timetable %{name}"
dates: "Application dates"
periods: "Application periods"
from: "from"
diff --git a/config/locales/time_tables.fr.yml b/config/locales/time_tables.fr.yml
index b85f7ca33..631ecca95 100644
--- a/config/locales/time_tables.fr.yml
+++ b/config/locales/time_tables.fr.yml
@@ -63,7 +63,7 @@ fr:
begin: Début de période
end: Fin de période
show:
- title: Calendrier %{time_table}
+ title: Calendrier %{name}
dates: "Dates d'application"
periods: "Périodes d'application"
from: "du"
diff --git a/config/locales/workbenches.en.yml b/config/locales/workbenches.en.yml
index 3a2fcd598..7f21f47a0 100644
--- a/config/locales/workbenches.en.yml
+++ b/config/locales/workbenches.en.yml
@@ -1,5 +1,7 @@
en:
workbenches:
+ show:
+ title: "%{name}"
index:
title: "%{organisation} dashboard"
offers:
diff --git a/config/locales/workbenches.fr.yml b/config/locales/workbenches.fr.yml
index 0f8a516e3..d76255e86 100644
--- a/config/locales/workbenches.fr.yml
+++ b/config/locales/workbenches.fr.yml
@@ -1,5 +1,7 @@
fr:
workbenches:
+ show:
+ title: "%{name}"
referential_count:
zero: "Aucun jeu de données dans cet espace de travail"
one: "1 jeu de données dans cet espace de travail"
diff --git a/db/migrate/20171109100955_add_object_id_format_to_workbenches.rb b/db/migrate/20171109100955_add_object_id_format_to_workbenches.rb
index 0e5e57643..f7e7452e1 100644
--- a/db/migrate/20171109100955_add_object_id_format_to_workbenches.rb
+++ b/db/migrate/20171109100955_add_object_id_format_to_workbenches.rb
@@ -1,5 +1,5 @@
class AddObjectIdFormatToWorkbenches < ActiveRecord::Migration
def change
- add_column :workbenches, :objectid_format, :string
+ add_column :workbenches, :objectid_format, :string unless column_exists? :workbenches, :objectid_format
end
end
diff --git a/db/migrate/20171109101523_add_object_id_format_to_referential.rb b/db/migrate/20171109101523_add_object_id_format_to_referential.rb
index fed630b75..0a28fb10a 100644
--- a/db/migrate/20171109101523_add_object_id_format_to_referential.rb
+++ b/db/migrate/20171109101523_add_object_id_format_to_referential.rb
@@ -1,5 +1,5 @@
class AddObjectIdFormatToReferential < ActiveRecord::Migration
def change
- add_column :referentials, :objectid_format, :string
+ add_column :referentials, :objectid_format, :string unless column_exists? :referentials, :objectid_format
end
end
diff --git a/db/migrate/20171109101545_add_object_id_format_to_line_referential.rb b/db/migrate/20171109101545_add_object_id_format_to_line_referential.rb
index 5d2fc9f4f..6578de73f 100644
--- a/db/migrate/20171109101545_add_object_id_format_to_line_referential.rb
+++ b/db/migrate/20171109101545_add_object_id_format_to_line_referential.rb
@@ -1,5 +1,5 @@
class AddObjectIdFormatToLineReferential < ActiveRecord::Migration
def change
- add_column :line_referentials, :objectid_format, :string
+ add_column :line_referentials, :objectid_format, :string unless column_exists? :line_referentials, :objectid_format
end
end
diff --git a/db/migrate/20171109101605_add_object_id_format_to_stop_area_referential.rb b/db/migrate/20171109101605_add_object_id_format_to_stop_area_referential.rb
index ffa77e2ed..71c7d662a 100644
--- a/db/migrate/20171109101605_add_object_id_format_to_stop_area_referential.rb
+++ b/db/migrate/20171109101605_add_object_id_format_to_stop_area_referential.rb
@@ -1,5 +1,5 @@
class AddObjectIdFormatToStopAreaReferential < ActiveRecord::Migration
def change
- add_column :stop_area_referentials, :objectid_format, :string
+ add_column :stop_area_referentials, :objectid_format, :string unless column_exists? :stop_area_referentials, :objectid_format
end
end
diff --git a/db/migrate/20171121142536_create_versions.rb b/db/migrate/20171121142536_create_versions.rb
new file mode 100644
index 000000000..ff794f9e1
--- /dev/null
+++ b/db/migrate/20171121142536_create_versions.rb
@@ -0,0 +1,34 @@
+class CreateVersions < ActiveRecord::Migration
+
+ # The largest text column available in all supported RDBMS is
+ # 1024^3 - 1 bytes, roughly one gibibyte. We specify a size
+ # so that MySQL will use `longtext` instead of `text`. Otherwise,
+ # when serializing very large objects, `text` might not be big enough.
+ TEXT_BYTES = 1_073_741_823
+
+ def change
+ create_table :versions do |t|
+ t.string :item_type, :null => false
+ t.integer :item_id, :null => false
+ t.string :event, :null => false
+ t.string :whodunnit
+ t.text :object, :limit => TEXT_BYTES
+
+ # Known issue in MySQL: fractional second precision
+ # -------------------------------------------------
+ #
+ # MySQL timestamp columns do not support fractional seconds unless
+ # defined with "fractional seconds precision". MySQL users should manually
+ # add fractional seconds precision to this migration, specifically, to
+ # the `created_at` column.
+ # (https://dev.mysql.com/doc/refman/5.6/en/fractional-seconds.html)
+ #
+ # MySQL users should also upgrade to rails 4.2, which is the first
+ # version of ActiveRecord with support for fractional seconds in MySQL.
+ # (https://github.com/rails/rails/pull/14359)
+ #
+ t.datetime :created_at
+ end
+ add_index :versions, [:item_type, :item_id]
+ end
+end
diff --git a/db/migrate/20171121153506_remove_creator_id.rb b/db/migrate/20171121153506_remove_creator_id.rb
new file mode 100644
index 000000000..520941841
--- /dev/null
+++ b/db/migrate/20171121153506_remove_creator_id.rb
@@ -0,0 +1,11 @@
+class RemoveCreatorId < ActiveRecord::Migration
+ def change
+ [
+ 'companies', 'connection_links', 'facilities', 'group_of_lines',
+ 'journey_patterns', 'lines', 'networks', 'pt_links', 'routes', 'routing_constraint_zones',
+ 'stop_areas', 'stop_points', 'time_tables', 'timebands', 'vehicle_journeys', 'access_links', 'access_points'
+ ].each do |table_name|
+ remove_column table_name, :creator_id, :string
+ end
+ end
+end
diff --git a/db/migrate/20171121163631_remove_creator_from_compliance_check_sets.rb b/db/migrate/20171121163631_remove_creator_from_compliance_check_sets.rb
new file mode 100644
index 000000000..0798b2040
--- /dev/null
+++ b/db/migrate/20171121163631_remove_creator_from_compliance_check_sets.rb
@@ -0,0 +1,5 @@
+class RemoveCreatorFromComplianceCheckSets < ActiveRecord::Migration
+ def change
+ remove_column :compliance_check_sets, :creator, :string
+ end
+end
diff --git a/db/migrate/20171128112629_delete_referential_foreign_key_for_compliance_check_set.rb b/db/migrate/20171128112629_delete_referential_foreign_key_for_compliance_check_set.rb
new file mode 100644
index 000000000..724bdbb61
--- /dev/null
+++ b/db/migrate/20171128112629_delete_referential_foreign_key_for_compliance_check_set.rb
@@ -0,0 +1,9 @@
+class DeleteReferentialForeignKeyForComplianceCheckSet < ActiveRecord::Migration
+ def up
+ remove_foreign_key :compliance_check_sets, :referentials
+ end
+
+ def down
+ add_foreign_key :compliance_check_sets, :referentials
+ end
+end
diff --git a/db/migrate/20171130172926_delete_compliance_control_set_foreign_key_for_compliance_check_set.rb b/db/migrate/20171130172926_delete_compliance_control_set_foreign_key_for_compliance_check_set.rb
new file mode 100644
index 000000000..ea94a01c1
--- /dev/null
+++ b/db/migrate/20171130172926_delete_compliance_control_set_foreign_key_for_compliance_check_set.rb
@@ -0,0 +1,10 @@
+class DeleteComplianceControlSetForeignKeyForComplianceCheckSet < ActiveRecord::Migration
+
+ def up
+ remove_foreign_key :compliance_check_sets, :compliance_control_sets
+ end
+
+ def down
+ add_foreign_key :compliance_check_sets, :compliance_control_sets
+ end
+end
diff --git a/db/migrate/20171130180144_change_item_id_in_versions_to_bigint.rb b/db/migrate/20171130180144_change_item_id_in_versions_to_bigint.rb
new file mode 100644
index 000000000..b1e6ca0a6
--- /dev/null
+++ b/db/migrate/20171130180144_change_item_id_in_versions_to_bigint.rb
@@ -0,0 +1,8 @@
+class ChangeItemIdInVersionsToBigint < ActiveRecord::Migration
+ def up
+ change_column :versions, :item_id, :integer, limit: 8, null: false
+ end
+ def down
+ change_column :versions, :item_id, :integer, null: false
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 7eafd0460..c94b43da1 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,7 @@
#
# It's strongly recommended that you check this file into your version control system.
-ActiveRecord::Schema.define(version: 20171130131328) do
+ActiveRecord::Schema.define(version: 20171128112629) do
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -23,7 +23,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
t.integer "stop_area_id", limit: 8
t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.string "name"
t.string "comment"
t.decimal "link_distance", precision: 19, scale: 2
@@ -46,7 +45,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
create_table "access_points", id: :bigserial, force: :cascade do |t|
t.string "objectid"
t.integer "object_version", limit: 8
- t.string "creator_id"
t.string "name"
t.string "comment"
t.decimal "longitude", precision: 19, scale: 16
@@ -123,7 +121,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
create_table "companies", id: :bigserial, force: :cascade do |t|
t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.string "name"
t.string "short_name"
t.string "organizational_unit"
@@ -188,7 +185,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
t.integer "referential_id", limit: 8
t.integer "compliance_control_set_id", limit: 8
t.integer "workbench_id", limit: 8
- t.string "creator"
t.string "status"
t.integer "parent_id", limit: 8
t.string "parent_type"
@@ -266,7 +262,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
t.integer "arrival_id", limit: 8
t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.string "name"
t.string "comment"
t.decimal "link_distance", precision: 19, scale: 2
@@ -285,6 +280,22 @@ ActiveRecord::Schema.define(version: 20171130131328) do
add_index "connection_links", ["objectid"], name: "connection_links_objectid_key", unique: true, using: :btree
+ create_table "delayed_jobs", id: :bigserial, force: :cascade do |t|
+ t.integer "priority", default: 0
+ t.integer "attempts", default: 0
+ t.text "handler"
+ t.text "last_error"
+ t.datetime "run_at"
+ t.datetime "locked_at"
+ t.datetime "failed_at"
+ t.string "locked_by", limit: 255
+ t.string "queue", limit: 255
+ t.datetime "created_at"
+ t.datetime "updated_at"
+ end
+
+ add_index "delayed_jobs", ["priority", "run_at"], name: "delayed_jobs_priority", using: :btree
+
create_table "exports", id: :bigserial, force: :cascade do |t|
t.integer "referential_id", limit: 8
t.string "status"
@@ -306,7 +317,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
t.string "objectid", null: false
t.integer "object_version", limit: 8
t.datetime "creation_time"
- t.string "creator_id"
t.string "name"
t.string "comment"
t.string "description"
@@ -348,7 +358,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
create_table "group_of_lines", id: :bigserial, force: :cascade do |t|
t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.string "name"
t.string "comment"
t.string "registration_number"
@@ -406,12 +415,12 @@ ActiveRecord::Schema.define(version: 20171130131328) do
t.datetime "started_at"
t.datetime "ended_at"
t.string "token_download"
- t.string "type"
+ t.string "type", limit: 255
t.integer "parent_id", limit: 8
t.string "parent_type"
+ t.datetime "notified_parent_at"
t.integer "current_step", default: 0
t.integer "total_steps", default: 0
- t.datetime "notified_parent_at"
t.string "creator"
end
@@ -436,7 +445,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
t.integer "route_id", limit: 8
t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.string "name"
t.string "comment"
t.string "registration_number"
@@ -501,7 +509,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
t.integer "company_id", limit: 8
t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.string "name"
t.string "number"
t.string "published_name"
@@ -533,7 +540,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
create_table "networks", id: :bigserial, force: :cascade do |t|
t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.date "version_date"
t.string "description"
t.string "name"
@@ -552,6 +558,11 @@ ActiveRecord::Schema.define(version: 20171130131328) do
add_index "networks", ["objectid"], name: "networks_objectid_key", unique: true, using: :btree
add_index "networks", ["registration_number"], name: "networks_registration_number_key", using: :btree
+ create_table "object_id_factories", id: :bigserial, force: :cascade do |t|
+ t.datetime "created_at", null: false
+ t.datetime "updated_at", null: false
+ end
+
create_table "organisations", id: :bigserial, force: :cascade do |t|
t.string "name"
t.datetime "created_at"
@@ -571,7 +582,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
t.integer "route_id", limit: 8
t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.string "name"
t.string "comment"
t.decimal "link_distance", precision: 19, scale: 2
@@ -648,7 +658,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
t.integer "line_id", limit: 8
t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.string "name"
t.string "comment"
t.integer "opposite_route_id", limit: 8
@@ -671,7 +680,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
t.datetime "updated_at"
t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.integer "route_id", limit: 8
t.integer "stop_point_ids", limit: 8, array: true
t.string "checksum"
@@ -721,17 +729,16 @@ ActiveRecord::Schema.define(version: 20171130131328) do
create_table "stop_areas", id: :bigserial, force: :cascade do |t|
t.integer "parent_id", limit: 8
- t.string "objectid", null: false
+ t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.string "name"
t.string "comment"
t.string "area_type"
t.string "registration_number"
t.string "nearest_topic_name"
t.integer "fare_code"
- t.decimal "longitude", precision: 19, scale: 16
- t.decimal "latitude", precision: 19, scale: 16
+ t.decimal "longitude", precision: 19, scale: 16
+ t.decimal "latitude", precision: 19, scale: 16
t.string "long_lat_type"
t.string "country_code"
t.string "street_name"
@@ -749,7 +756,7 @@ ActiveRecord::Schema.define(version: 20171130131328) do
t.datetime "deleted_at"
t.datetime "created_at"
t.datetime "updated_at"
- t.string "stif_type"
+ t.string "stif_type", limit: 255
end
add_index "stop_areas", ["name"], name: "index_stop_areas_on_name", using: :btree
@@ -767,7 +774,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
t.integer "stop_area_id", limit: 8
t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.integer "position"
t.string "for_boarding"
t.string "for_alighting"
@@ -820,18 +826,17 @@ ActiveRecord::Schema.define(version: 20171130131328) do
add_index "time_table_periods", ["time_table_id"], name: "index_time_table_periods_on_time_table_id", using: :btree
create_table "time_tables", id: :bigserial, force: :cascade do |t|
- t.string "objectid", null: false
- t.integer "object_version", limit: 8, default: 1
- t.string "creator_id"
+ t.string "objectid", null: false
+ t.integer "object_version", limit: 8, default: 1
t.string "version"
t.string "comment"
- t.integer "int_day_types", default: 0
+ t.integer "int_day_types", default: 0
t.date "start_date"
t.date "end_date"
t.integer "calendar_id", limit: 8
t.datetime "created_at"
t.datetime "updated_at"
- t.string "color"
+ t.string "color", limit: 255
t.integer "created_from_id", limit: 8
t.string "checksum"
t.text "checksum_source"
@@ -853,7 +858,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
create_table "timebands", id: :bigserial, force: :cascade do |t|
t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.string "name"
t.time "start_time", null: false
t.time "end_time", null: false
@@ -925,7 +929,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
t.integer "company_id", limit: 8
t.string "objectid", null: false
t.integer "object_version", limit: 8
- t.string "creator_id"
t.string "comment"
t.string "status_value"
t.string "transport_mode"
@@ -947,6 +950,17 @@ ActiveRecord::Schema.define(version: 20171130131328) do
add_index "vehicle_journeys", ["objectid"], name: "vehicle_journeys_objectid_key", unique: true, using: :btree
add_index "vehicle_journeys", ["route_id"], name: "index_vehicle_journeys_on_route_id", using: :btree
+ create_table "versions", id: :bigserial, force: :cascade do |t|
+ t.string "item_type", null: false
+ t.integer "item_id", limit: 8, null: false
+ t.string "event", null: false
+ t.string "whodunnit"
+ t.text "object"
+ t.datetime "created_at"
+ end
+
+ add_index "versions", ["item_type", "item_id"], name: "index_versions_on_item_type_and_item_id", using: :btree
+
create_table "workbenches", id: :bigserial, force: :cascade do |t|
t.string "name"
t.integer "organisation_id", limit: 8
@@ -969,8 +983,6 @@ ActiveRecord::Schema.define(version: 20171130131328) do
add_foreign_key "compliance_check_messages", "compliance_check_sets"
add_foreign_key "compliance_check_messages", "compliance_checks"
add_foreign_key "compliance_check_resources", "compliance_check_sets"
- add_foreign_key "compliance_check_sets", "compliance_control_sets"
- add_foreign_key "compliance_check_sets", "referentials"
add_foreign_key "compliance_check_sets", "workbenches"
add_foreign_key "compliance_checks", "compliance_check_blocks"
add_foreign_key "compliance_checks", "compliance_check_sets"
@@ -979,7 +991,9 @@ ActiveRecord::Schema.define(version: 20171130131328) do
add_foreign_key "compliance_controls", "compliance_control_blocks"
add_foreign_key "compliance_controls", "compliance_control_sets"
add_foreign_key "group_of_lines_lines", "group_of_lines", name: "groupofline_group_fkey", on_delete: :cascade
+ add_foreign_key "journey_frequencies", "timebands", name: "journey_frequencies_timeband_id_fk", on_delete: :nullify
add_foreign_key "journey_frequencies", "timebands", on_delete: :nullify
+ add_foreign_key "journey_frequencies", "vehicle_journeys", name: "journey_frequencies_vehicle_journey_id_fk", on_delete: :nullify
add_foreign_key "journey_frequencies", "vehicle_journeys", on_delete: :nullify
add_foreign_key "journey_patterns", "routes", name: "jp_route_fkey", on_delete: :cascade
add_foreign_key "journey_patterns", "stop_points", column: "arrival_stop_point_id", name: "arrival_point_fkey", on_delete: :nullify
diff --git a/db/seeds.rb b/db/seeds.rb
new file mode 100644
index 000000000..b7db25411
--- /dev/null
+++ b/db/seeds.rb
@@ -0,0 +1 @@
+# Empty
diff --git a/db/seeds/chouette.seeds.rb b/db/seeds/chouette.seeds.rb
deleted file mode 100644
index 1cbdb584d..000000000
--- a/db/seeds/chouette.seeds.rb
+++ /dev/null
@@ -1,6 +0,0 @@
-path = File.join(File.expand_path('../seeds', __FILE__), "*.rb")
-
-Dir.glob(path).sort.each do |file|
- puts "Seed #{file}"
- load file
-end
diff --git a/db/seeds/stif.rb b/db/seeds/stif.rb
deleted file mode 100644
index d31a35cfc..000000000
--- a/db/seeds/stif.rb
+++ /dev/null
@@ -1,38 +0,0 @@
-# coding: utf-8
-# This file should contain all the record creation needed to seed the database with its default values.
-# The data can then be loaded with the rake db:seed (or created alongside the db with db:setup).
-
-stop_area_referential = StopAreaReferential.find_or_create_by!(name: "Reflex")
-line_referential = LineReferential.find_or_create_by!(name: "CodifLigne")
-
-# Organisations
-stif = Organisation.find_or_create_by!(code: "STIF") do |org|
- org.name = 'STIF'
-end
-operator = Organisation.find_or_create_by!(code: 'transporteur-a') do |organisation|
- organisation.name = "Transporteur A"
-end
-
-# Member
-line_referential.add_member stif, owner: true
-line_referential.add_member operator
-
-stop_area_referential.add_member stif, owner: true
-stop_area_referential.add_member operator
-
-# Users
-stif.users.find_or_create_by!(username: "admin") do |user|
- user.email = 'stif-boiv@af83.com'
- user.password = "secret"
- user.name = "STIF Administrateur"
-end
-
-operator.users.find_or_create_by!(username: "transporteur") do |user|
- user.email = 'stif-boiv+transporteur@af83.com'
- user.password = "secret"
- user.name = "Martin Lejeune"
-end
-
-# Include all Lines in organisation functional_scope
-stif.update sso_attributes: { functional_scope: line_referential.lines.pluck(:objectid) }
-operator.update sso_attributes: { functional_scope: line_referential.lines.limit(3).pluck(:objectid) }
diff --git a/spec/db/schema_spec.rb b/spec/db/schema_spec.rb
index a7fe0a162..585636124 100644
--- a/spec/db/schema_spec.rb
+++ b/spec/db/schema_spec.rb
@@ -44,6 +44,6 @@ Diff: #{diff}
def diff
RSpec::Support::Differ.new(
color: RSpec::Matchers.configuration.color?
- ).diff_as_string(@original, @expected)
+ ).diff_as_string(@expected, @original)
end
end
diff --git a/spec/models/api/v1/api_key_spec.rb b/spec/models/api/v1/api_key_spec.rb
index b700429d3..cc483a118 100644
--- a/spec/models/api/v1/api_key_spec.rb
+++ b/spec/models/api/v1/api_key_spec.rb
@@ -4,6 +4,7 @@ RSpec.describe Api::V1::ApiKey, type: :model do
subject { create(:api_key) }
it { should validate_presence_of :organisation }
+ it { is_expected.to be_versioned }
it 'should have a valid factory' do
expect(build(:api_key)).to be_valid
diff --git a/spec/models/calendar_spec.rb b/spec/models/calendar_spec.rb
index f5020ebf8..e71c2b081 100644
--- a/spec/models/calendar_spec.rb
+++ b/spec/models/calendar_spec.rb
@@ -6,6 +6,7 @@ RSpec.describe Calendar, :type => :model do
it { is_expected.to validate_presence_of(:name) }
it { is_expected.to validate_presence_of(:short_name) }
it { is_expected.to validate_uniqueness_of(:short_name) }
+ it { is_expected.to be_versioned }
describe '#to_time_table' do
let(:calendar) { create(:calendar, date_ranges: [Date.today...(Date.today + 1.month)]) }
@@ -29,7 +30,6 @@ RSpec.describe Calendar, :type => :model do
end
end
-
describe 'before_validation' do
let(:calendar) { create(:calendar, date_ranges: []) }
diff --git a/spec/models/chouette/access_link_spec.rb b/spec/models/chouette/access_link_spec.rb
index d0f351480..ced99eb1d 100644
--- a/spec/models/chouette/access_link_spec.rb
+++ b/spec/models/chouette/access_link_spec.rb
@@ -4,6 +4,7 @@ describe Chouette::AccessLink, :type => :model do
subject { create(:access_link) }
it { is_expected.to validate_uniqueness_of :objectid }
+ it { is_expected.to be_versioned }
describe '#get_objectid' do
subject { super().get_objectid }
diff --git a/spec/models/chouette/access_point_spec.rb b/spec/models/chouette/access_point_spec.rb
index a6798ec3b..c734ecedf 100644
--- a/spec/models/chouette/access_point_spec.rb
+++ b/spec/models/chouette/access_point_spec.rb
@@ -12,6 +12,7 @@ describe Chouette::AccessPoint, :type => :model do
it { is_expected.to validate_presence_of :name }
it { is_expected.to validate_numericality_of :latitude }
it { is_expected.to validate_numericality_of :longitude }
+ it { is_expected.to be_versioned }
describe ".latitude" do
it "should accept -90 value" do
diff --git a/spec/models/chouette/company_spec.rb b/spec/models/chouette/company_spec.rb
index a3101d79c..34b19eeda 100644
--- a/spec/models/chouette/company_spec.rb
+++ b/spec/models/chouette/company_spec.rb
@@ -3,6 +3,7 @@ require 'spec_helper'
describe Chouette::Company, :type => :model do
subject { create(:company) }
it { should validate_presence_of :name }
+ it { is_expected.to be_versioned }
describe "#nullables empty" do
it "should set null empty nullable attributes" do
diff --git a/spec/models/chouette/connection_link_spec.rb b/spec/models/chouette/connection_link_spec.rb
index 04c15b42e..4ab67d007 100644
--- a/spec/models/chouette/connection_link_spec.rb
+++ b/spec/models/chouette/connection_link_spec.rb
@@ -8,6 +8,7 @@ describe Chouette::ConnectionLink, :type => :model do
subject { create(:connection_link) }
it { is_expected.to validate_uniqueness_of :objectid }
+ it { is_expected.to be_versioned }
describe '#get_objectid' do
subject { super().get_objectid }
diff --git a/spec/models/chouette/group_of_line_spec.rb b/spec/models/chouette/group_of_line_spec.rb
index 29b4433c5..d43d75374 100644
--- a/spec/models/chouette/group_of_line_spec.rb
+++ b/spec/models/chouette/group_of_line_spec.rb
@@ -4,6 +4,7 @@ describe Chouette::GroupOfLine, :type => :model do
subject { create(:group_of_line) }
it { should validate_presence_of :name }
+ it { is_expected.to be_versioned }
describe "#stop_areas" do
let!(:line){create(:line, :group_of_lines => [subject])}
diff --git a/spec/models/chouette/journey_pattern_spec.rb b/spec/models/chouette/journey_pattern_spec.rb
index 047022ade..ea7c2a2e9 100644
--- a/spec/models/chouette/journey_pattern_spec.rb
+++ b/spec/models/chouette/journey_pattern_spec.rb
@@ -1,6 +1,8 @@
require 'spec_helper'
describe Chouette::JourneyPattern, :type => :model do
+ it { is_expected.to be_versioned }
+
describe 'checksum' do
it_behaves_like 'checksum support', :journey_pattern
end
diff --git a/spec/models/chouette/line_spec.rb b/spec/models/chouette/line_spec.rb
index bc7b6e0c7..056d5da9e 100644
--- a/spec/models/chouette/line_spec.rb
+++ b/spec/models/chouette/line_spec.rb
@@ -7,6 +7,7 @@ describe Chouette::Line, :type => :model do
# it { is_expected.to validate_presence_of :network }
# it { is_expected.to validate_presence_of :company }
it { should validate_presence_of :name }
+ it { is_expected.to be_versioned }
describe '#display_name' do
it 'should display local_id, number, name and company name' do
diff --git a/spec/models/chouette/network_spec.rb b/spec/models/chouette/network_spec.rb
index 32bacc512..78a4150df 100644
--- a/spec/models/chouette/network_spec.rb
+++ b/spec/models/chouette/network_spec.rb
@@ -3,6 +3,7 @@ require 'spec_helper'
describe Chouette::Network, :type => :model do
subject { create(:network) }
it { should validate_presence_of :name }
+ it { is_expected.to be_versioned }
describe "#stop_areas" do
let!(:line){create(:line, :network => subject)}
diff --git a/spec/models/chouette/route/route_base_spec.rb b/spec/models/chouette/route/route_base_spec.rb
index 79daeb6c2..26f57eae5 100644
--- a/spec/models/chouette/route/route_base_spec.rb
+++ b/spec/models/chouette/route/route_base_spec.rb
@@ -15,6 +15,7 @@ RSpec.describe Chouette::Route, :type => :model do
#it { is_expected.to validate_presence_of :direction_code }
it { is_expected.to validate_inclusion_of(:direction).in_array(%i(straight_forward backward clockwise counter_clockwise north north_west west south_west south south_east east north_east)) }
it { is_expected.to validate_inclusion_of(:wayback).in_array(%i(outbound inbound)) }
+ it { is_expected.to be_versioned }
context "reordering methods" do
let(:bad_stop_point_ids){subject.stop_points.map { |sp| sp.id + 1}}
diff --git a/spec/models/chouette/routing_constraint_zone_spec.rb b/spec/models/chouette/routing_constraint_zone_spec.rb
index c344642e6..8ebd8695c 100644
--- a/spec/models/chouette/routing_constraint_zone_spec.rb
+++ b/spec/models/chouette/routing_constraint_zone_spec.rb
@@ -7,6 +7,7 @@ describe Chouette::RoutingConstraintZone, type: :model do
it { is_expected.to validate_presence_of :name }
# shoulda matcher to validate length of array ?
xit { is_expected.to validate_length_of(:stop_point_ids).is_at_least(2) }
+ it { is_expected.to be_versioned }
describe 'checksum' do
it_behaves_like 'checksum support', :routing_constraint_zone
diff --git a/spec/models/chouette/stop_area_spec.rb b/spec/models/chouette/stop_area_spec.rb
index 1e0b4af84..c6aeafaf8 100644
--- a/spec/models/chouette/stop_area_spec.rb
+++ b/spec/models/chouette/stop_area_spec.rb
@@ -11,6 +11,7 @@ describe Chouette::StopArea, :type => :model do
it { should validate_presence_of :name }
it { should validate_numericality_of :latitude }
it { should validate_numericality_of :longitude }
+ it { is_expected.to be_versioned }
# describe ".latitude" do
# it "should accept -90 value" do
diff --git a/spec/models/chouette/stop_point_spec.rb b/spec/models/chouette/stop_point_spec.rb
index 264fd26fc..6b9e7727f 100644
--- a/spec/models/chouette/stop_point_spec.rb
+++ b/spec/models/chouette/stop_point_spec.rb
@@ -4,6 +4,7 @@ describe Chouette::StopPoint, :type => :model do
it { is_expected.to validate_uniqueness_of :objectid }
it { is_expected.to validate_presence_of :stop_area }
+ it { is_expected.to be_versioned }
describe '#objectid' do
subject { super().get_objectid }
diff --git a/spec/models/chouette/time_table_spec.rb b/spec/models/chouette/time_table_spec.rb
index 761c39e5b..677308fc8 100644
--- a/spec/models/chouette/time_table_spec.rb
+++ b/spec/models/chouette/time_table_spec.rb
@@ -6,6 +6,7 @@ describe Chouette::TimeTable, :type => :model do
it { is_expected.to validate_presence_of :comment }
it { is_expected.to validate_uniqueness_of :objectid }
+ it { is_expected.to be_versioned }
def create_time_table_periode time_table, start_date, end_date
create(:time_table_period, time_table: time_table, :period_start => start_date, :period_end => end_date)
diff --git a/spec/models/chouette/timeband_spec.rb b/spec/models/chouette/timeband_spec.rb
index 1f812a6e2..b960c203f 100644
--- a/spec/models/chouette/timeband_spec.rb
+++ b/spec/models/chouette/timeband_spec.rb
@@ -1,6 +1,7 @@
require 'spec_helper'
describe Chouette::Timeband, :type => :model do
+ it { is_expected.to be_versioned }
describe '#create' do
context 'when valid' do
diff --git a/spec/models/chouette/vehicle_journey_spec.rb b/spec/models/chouette/vehicle_journey_spec.rb
index 86aa475f0..ac9b21ceb 100644
--- a/spec/models/chouette/vehicle_journey_spec.rb
+++ b/spec/models/chouette/vehicle_journey_spec.rb
@@ -1,6 +1,7 @@
require 'spec_helper'
describe Chouette::VehicleJourney, :type => :model do
+ it { is_expected.to be_versioned }
it "must be valid with an at-stop day offset of 1" do
vehicle_journey = create(
diff --git a/spec/models/compliance_check_set_spec.rb b/spec/models/compliance_check_set_spec.rb
index 0159d1c6b..b981a68bb 100644
--- a/spec/models/compliance_check_set_spec.rb
+++ b/spec/models/compliance_check_set_spec.rb
@@ -12,6 +12,7 @@ RSpec.describe ComplianceCheckSet, type: :model do
it { should have_many :compliance_checks }
it { should have_many :compliance_check_blocks }
+ it { is_expected.to be_versioned }
describe "#update_status" do
it "updates :status to successful when all resources are OK" do
@@ -89,4 +90,13 @@ RSpec.describe ComplianceCheckSet, type: :model do
expect(check_set.update_status).to be true
end
end
+
+ describe 'possibility to delete the associated compliance_control_set' do
+ let!(:compliance_check_set) { create :compliance_check_set }
+
+ it do
+ expect{ compliance_check_set.compliance_control_set.delete }
+ .to change{ ComplianceControlSet.count }.by(-1)
+ end
+ end
end
diff --git a/spec/models/compliance_check_spec.rb b/spec/models/compliance_check_spec.rb
index bd797ab09..f83d78c29 100644
--- a/spec/models/compliance_check_spec.rb
+++ b/spec/models/compliance_check_spec.rb
@@ -1,4 +1,5 @@
RSpec.describe ComplianceCheck, type: :model do
+
it 'should have a valid factory' do
expect(FactoryGirl.build(:compliance_check)).to be_valid
end
diff --git a/spec/models/compliance_control_set_spec.rb b/spec/models/compliance_control_set_spec.rb
index 04d1c418c..c157dcaf3 100644
--- a/spec/models/compliance_control_set_spec.rb
+++ b/spec/models/compliance_control_set_spec.rb
@@ -10,4 +10,5 @@ RSpec.describe ComplianceControlSet, type: :model do
it { should have_many(:compliance_control_blocks).dependent(:destroy) }
it { should validate_presence_of :name }
+ it { is_expected.to be_versioned }
end
diff --git a/spec/policies/company_policy_spec.rb b/spec/policies/company_policy_spec.rb
index 2d249a2be..e018902ca 100644
--- a/spec/policies/company_policy_spec.rb
+++ b/spec/policies/company_policy_spec.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
RSpec.describe CompanyPolicy, type: :policy do
let( :record ){ build_stubbed :company }
@@ -24,19 +25,19 @@ RSpec.describe CompanyPolicy, type: :policy do
context 'Destructive actions →' do
permissions :create? do
- it_behaves_like 'always forbidden', 'companies.create', archived: true
+ it_behaves_like 'permitted policy', 'companies.create'
end
permissions :destroy? do
- it_behaves_like 'always forbidden', 'companies.destroy', archived: true
+ it_behaves_like 'permitted policy', 'companies.destroy'
end
permissions :edit? do
- it_behaves_like 'always forbidden', 'companies.update', archived: true
+ it_behaves_like 'permitted policy', 'companies.update'
end
permissions :new? do
- it_behaves_like 'always forbidden', 'companies.create', archived: true
+ it_behaves_like 'permitted policy', 'companies.create'
end
permissions :update? do
- it_behaves_like 'always forbidden', 'companies.update', archived: true
+ it_behaves_like 'permitted policy', 'companies.update'
end
end
end
diff --git a/spec/policies/import_policy_spec.rb b/spec/policies/import_policy_spec.rb
index fd9f3172c..9c7fca8a5 100644
--- a/spec/policies/import_policy_spec.rb
+++ b/spec/policies/import_policy_spec.rb
@@ -9,10 +9,10 @@ RSpec.describe ImportPolicy, type: :policy do
context 'Non Destructive actions →' do
permissions :index? do
- it_behaves_like 'always allowed', 'anything', archived: true
+ it_behaves_like 'always allowed', 'anything'
end
permissions :show? do
- it_behaves_like 'always allowed', 'anything', archived: true
+ it_behaves_like 'always allowed', 'anything'
end
end
@@ -23,19 +23,19 @@ RSpec.describe ImportPolicy, type: :policy do
context 'Destructive actions →' do
permissions :create? do
- it_behaves_like 'permitted policy', 'imports.create', archived: true
+ it_behaves_like 'permitted policy', 'imports.create'
end
permissions :destroy? do
- it_behaves_like 'permitted policy', 'imports.destroy', archived: true
+ it_behaves_like 'always forbidden', 'imports.destroy'
end
permissions :edit? do
- it_behaves_like 'permitted policy', 'imports.update', archived: true
+ it_behaves_like 'permitted policy', 'imports.update'
end
permissions :new? do
- it_behaves_like 'permitted policy', 'imports.create', archived: true
+ it_behaves_like 'permitted policy', 'imports.create'
end
permissions :update? do
- it_behaves_like 'permitted policy', 'imports.update', archived: true
+ it_behaves_like 'permitted policy', 'imports.update'
end
end
end
diff --git a/spec/policies/line_policy_spec.rb b/spec/policies/line_policy_spec.rb
index 334073506..452606bcf 100644
--- a/spec/policies/line_policy_spec.rb
+++ b/spec/policies/line_policy_spec.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
RSpec.describe LinePolicy, type: :policy do
let( :record ){ build_stubbed :line }
@@ -24,19 +25,19 @@ RSpec.describe LinePolicy, type: :policy do
context 'Destructive actions →' do
permissions :create? do
- it_behaves_like 'always forbidden', 'lines.create', archived: true
+ it_behaves_like 'permitted policy', 'lines.create'
end
permissions :destroy? do
- it_behaves_like 'always forbidden', 'lines.destroy', archived: true
+ it_behaves_like 'permitted policy', 'lines.destroy'
end
permissions :edit? do
- it_behaves_like 'always forbidden', 'lines.update', archived: true
+ it_behaves_like 'permitted policy', 'lines.update'
end
permissions :new? do
- it_behaves_like 'always forbidden', 'lines.create', archived: true
+ it_behaves_like 'permitted policy', 'lines.create'
end
permissions :update? do
- it_behaves_like 'always forbidden', 'lines.update', archived: true
+ it_behaves_like 'permitted policy', 'lines.update'
end
end
diff --git a/spec/policies/stop_area_policy_spec.rb b/spec/policies/stop_area_policy_spec.rb
index 8fe59c8e3..90835d1d8 100644
--- a/spec/policies/stop_area_policy_spec.rb
+++ b/spec/policies/stop_area_policy_spec.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
RSpec.describe StopAreaPolicy, type: :policy do
let( :record ){ build_stubbed :stop_area }
@@ -24,19 +25,19 @@ RSpec.describe StopAreaPolicy, type: :policy do
context 'Destructive actions →' do
permissions :create? do
- it_behaves_like 'always forbidden', 'stop_areas.create', archived: true
+ it_behaves_like 'permitted policy', 'stop_areas.create'
end
permissions :destroy? do
- it_behaves_like 'always forbidden', 'stop_areas.destroy', archived: true
+ it_behaves_like 'permitted policy', 'stop_areas.destroy'
end
permissions :edit? do
- it_behaves_like 'always forbidden', 'stop_areas.update', archived: true
+ it_behaves_like 'permitted policy', 'stop_areas.update'
end
permissions :new? do
- it_behaves_like 'always forbidden', 'stop_areas.create', archived: true
+ it_behaves_like 'permitted policy', 'stop_areas.create'
end
permissions :update? do
- it_behaves_like 'always forbidden', 'stop_areas.update', archived: true
+ it_behaves_like 'permitted policy', 'stop_areas.update'
end
end
end
diff --git a/spec/rails_helper.rb b/spec/rails_helper.rb
index 6d9f4a4a2..47578405e 100644
--- a/spec/rails_helper.rb
+++ b/spec/rails_helper.rb
@@ -3,6 +3,7 @@ ENV["RAILS_ENV"] ||= 'test'
require 'spec_helper'
require File.expand_path("../../config/environment", __FILE__)
require 'rspec/rails'
+
# Add additional requires below this line. Rails is not loaded until this point!
# Requires supporting ruby files with custom matchers and macros, etc, in
diff --git a/spec/spec_helper.rb b/spec/spec_helper.rb
index 6b37b9fa8..9679952df 100644
--- a/spec/spec_helper.rb
+++ b/spec/spec_helper.rb
@@ -34,6 +34,7 @@ require 'webmock/rspec'
require 'simplecov'
require 'sidekiq/testing'
Sidekiq::Testing.fake!
+require 'paper_trail/frameworks/rspec'
# Requires supporting ruby files with custom matchers and macros, etc, in
# spec/support/ and its subdirectories. Files matching `spec/**/*_spec.rb` are
diff --git a/spec/views/companies/edit.html.erb_spec.rb b/spec/views/companies/edit.html.erb_spec.rb
index 4566ed64c..8aaf705ab 100644
--- a/spec/views/companies/edit.html.erb_spec.rb
+++ b/spec/views/companies/edit.html.erb_spec.rb
@@ -6,13 +6,6 @@ describe "/companies/edit", :type => :view do
let!(:companies) { Array.new(2) { create(:company) } }
let!(:line_referential) { assign :line_referential, company.line_referential }
- describe "test" do
- it "should render h2 with the company name" do
- render
- expect(rendered).to have_selector("h2", :text => Regexp.new(company.name))
- end
- end
-
describe "form" do
it "should render input for name" do
render
@@ -21,5 +14,4 @@ describe "/companies/edit", :type => :view do
end
end
end
-
end
diff --git a/spec/views/companies/show.html.erb_spec.rb b/spec/views/companies/show.html.erb_spec.rb
index dbc544f63..aeb93aebb 100644
--- a/spec/views/companies/show.html.erb_spec.rb
+++ b/spec/views/companies/show.html.erb_spec.rb
@@ -5,24 +5,8 @@ describe "/companies/show", :type => :view do
let!(:company) { assign(:company, create(:company)) }
let!(:line_referential) { assign :line_referential, company.line_referential }
- it "should render h1 with the company name" do
- render
- expect(rendered).to have_selector("h1", :text => Regexp.new(company.name))
- end
-
# it "should display a map with class 'company'" do
# render
# expect(rendered).to have_selector("#map", :class => 'company')
# end
-
- it "should render a link to edit the company" do
- render
- expect(rendered).to have_selector("a[href='#{view.edit_line_referential_company_path(line_referential, company)}']")
- end
-
- it "should render a link to remove the company" do
- render
- expect(rendered).to have_selector("a[href='#{view.line_referential_company_path(line_referential, company)}']")
- end
-
end
diff --git a/spec/views/lines/edit.html.erb_spec.rb b/spec/views/lines/edit.html.erb_spec.rb
index 6cd2940f5..2af4df10a 100644
--- a/spec/views/lines/edit.html.erb_spec.rb
+++ b/spec/views/lines/edit.html.erb_spec.rb
@@ -8,13 +8,6 @@ describe "/lines/edit", :type => :view do
let!(:lines) { Array.new(2) { create(:line, :network => network, :company => company) } }
let!(:line_referential) { assign :line_referential, line.line_referential }
- describe "test" do
- it "should render h2 with the group name" do
- render
- expect(rendered).to have_selector("h2", :text => Regexp.new(line.name))
- end
- end
-
describe "form" do
it "should render input for name" do
render
diff --git a/spec/views/lines/show.html.erb_spec.rb b/spec/views/lines/show.html.erb_spec.rb
index 7bc120f1a..9649d9c8e 100644
--- a/spec/views/lines/show.html.erb_spec.rb
+++ b/spec/views/lines/show.html.erb_spec.rb
@@ -17,25 +17,4 @@ describe "/lines/show", :type => :view do
before do
allow(view).to receive_messages(current_organisation: referential.organisation)
end
-
- it "should render h1 with the line name" do
- render
- expect(rendered).to have_selector("h1", :text => Regexp.new(line.name))
- end
-
- # it "should display a map with class 'line'" do
- # render
- # expect(rendered).to have_selector("#map", :class => 'line')
- # end
- # FIXME #2018
- xit "should render a link to edit the line" do
- render
- expect(rendered).to have_selector("a[href='#{view.edit_line_referential_line_path(line_referential, line)}']")
- end
-
- it "should render a link to remove the line" do
- render
- expect(rendered).to have_selector("a[href='#{view.line_referential_line_path(line_referential, line)}']")
- end
-
end
diff --git a/spec/views/networks/edit.html.erb_spec.rb b/spec/views/networks/edit.html.erb_spec.rb
index f77459837..aac6d4d28 100644
--- a/spec/views/networks/edit.html.erb_spec.rb
+++ b/spec/views/networks/edit.html.erb_spec.rb
@@ -5,13 +5,6 @@ describe "/networks/edit", :type => :view do
let!(:network) { assign(:network, create(:network) ) }
let!(:line_referential) { assign :line_referential, network.line_referential }
- describe "test" do
- it "should render h2 with the group name" do
- render
- expect(rendered).to have_selector("h2", :text => Regexp.new(network.name))
- end
- end
-
describe "form" do
it "should render input for name" do
render
diff --git a/spec/views/networks/show.html.erb_spec.rb b/spec/views/networks/show.html.erb_spec.rb
index 72605fb46..3926ead14 100644
--- a/spec/views/networks/show.html.erb_spec.rb
+++ b/spec/views/networks/show.html.erb_spec.rb
@@ -11,24 +11,8 @@ describe "/networks/show", :type => :view do
let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) }
let!(:line_referential) { assign :line_referential, network.line_referential }
- it "should render h1 with the network name" do
- render
- expect(rendered).to have_selector("h1", :text => Regexp.new(network.name))
- end
-
# it "should display a map with class 'network'" do
# render
# expect(rendered).to have_selector("#map")
# end
-
- it "should render a link to edit the network" do
- render
- expect(rendered).to have_selector("a[href='#{view.edit_line_referential_network_path(line_referential, network)}']")
- end
-
- it "should render a link to remove the network" do
- render
- expect(rendered).to have_selector("a[href='#{view.line_referential_network_path(line_referential, network)}']")
- end
-
end
diff --git a/spec/views/routes/show.html.erb_spec.rb b/spec/views/routes/show.html.erb_spec.rb
index dae8c9ed3..3bbfaa799 100644
--- a/spec/views/routes/show.html.erb_spec.rb
+++ b/spec/views/routes/show.html.erb_spec.rb
@@ -22,20 +22,4 @@ RSpec.describe "/routes/show", type: :view do
referential
))
end
-
- it "should render h1 with the route name" do
- render
- expect(rendered).to have_selector("h1", :text => Regexp.new(route.name))
- end
-
- it "should render a link to edit the route" do
- render
- expect(rendered).to have_selector("a[href='#{view.edit_referential_line_route_path(referential, line, route)}']")
- end
-
- it "should render a link to remove the route" do
- render
- expect(rendered).to have_selector("a[href='#{view.referential_line_route_path(referential, line, route)}']")
- end
-
end
diff --git a/spec/views/stop_areas/edit.html.erb_spec.rb b/spec/views/stop_areas/edit.html.erb_spec.rb
index 664225203..5105bff4b 100644
--- a/spec/views/stop_areas/edit.html.erb_spec.rb
+++ b/spec/views/stop_areas/edit.html.erb_spec.rb
@@ -6,13 +6,6 @@ describe "/stop_areas/edit", :type => :view do
let!(:stop_area) { assign(:stop_area, create(:stop_area)) }
let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) }
- describe "test" do
- it "should render h2 with the group name" do
- render
- expect(rendered).to have_selector("h2", :text => Regexp.new(stop_area.name))
- end
- end
-
describe "form" do
it "should render input for name" do
render
diff --git a/spec/views/stop_areas/show.html.erb_spec.rb b/spec/views/stop_areas/show.html.erb_spec.rb
index 6fd416128..693d9cf1f 100644
--- a/spec/views/stop_areas/show.html.erb_spec.rb
+++ b/spec/views/stop_areas/show.html.erb_spec.rb
@@ -7,24 +7,8 @@ describe "/stop_areas/show", :type => :view do
let!(:access_points) { assign :access_points, [] }
let!(:map) { assign(:map, double(:to_html => '<div id="map"/>'.html_safe)) }
- it "should render h1 with the stop_area name" do
- render
- expect(rendered).to have_selector("h1", :text => Regexp.new(stop_area.name))
- end
-
# it "should display a map with class 'stop_area'" do
# render
# expect(rendered).to have_selector("#map", :class => 'stop_area')
# end
-
- it "should render a link to edit the stop_area" do
- render
- expect(rendered).to have_selector("a[href='#{view.edit_stop_area_referential_stop_area_path(stop_area_referential, stop_area)}']")
- end
-
- it "should render a link to remove the stop_area" do
- render
- expect(rendered).to have_selector("a[href='#{view.stop_area_referential_stop_area_path(stop_area_referential, stop_area)}']")
- end
-
end
diff --git a/spec/views/time_tables/edit.html.erb_spec.rb b/spec/views/time_tables/edit.html.erb_spec.rb
index c84c5eb74..f431eab7b 100644
--- a/spec/views/time_tables/edit.html.erb_spec.rb
+++ b/spec/views/time_tables/edit.html.erb_spec.rb
@@ -3,13 +3,5 @@ require 'spec_helper'
describe "/time_tables/edit", :type => :view do
assign_referential
let!(:time_table) { assign(:time_table, create(:time_table) ) }
-
- describe "test" do
- it "should render h1 with the group comment" do
- render
- expect(rendered).to have_selector("h1", :text => Regexp.new(time_table.comment))
- end
- end
-
# No more test for the form, as it is now managed by React/Redux.
end
diff --git a/spec/views/time_tables/show.html.erb_spec.rb b/spec/views/time_tables/show.html.erb_spec.rb
index edfb3f3cc..100c74b90 100644
--- a/spec/views/time_tables/show.html.erb_spec.rb
+++ b/spec/views/time_tables/show.html.erb_spec.rb
@@ -17,20 +17,4 @@ describe "/time_tables/show", :type => :view do
before do
allow(view).to receive_messages(current_organisation: referential.organisation)
end
-
- it "should render h2 with the time_table comment" do
- render
- expect(rendered).to have_selector("h1", :text => Regexp.new(time_table.comment))
- end
-
- it "should render a link to edit the time_table" do
- render
- expect(rendered).to have_selector(" a[href='#{view.edit_referential_time_table_path(referential, time_table)}']")
- end
-
- it "should render a link to remove the time_table" do
- render
- expect(rendered).to have_selector(" a[href='#{view.referential_time_table_path(referential, time_table)}']")
- end
-
end