aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert2017-10-02 10:51:34 +0200
committerRobert2017-10-02 10:51:34 +0200
commit8f11900221be0837e0ee9717746cd4d952a64794 (patch)
tree50654b0b7f2bf29bd8853cac425e5394570509ce
parent6898e54925c93cf44e7d5581d2213d4d3a9ab3c8 (diff)
parenteaf5b3fd868d68856ef94e18656dac39096d866b (diff)
downloadchouette-core-8f11900221be0837e0ee9717746cd4d952a64794.tar.bz2
Merge branch 'master' of github.com:af83/stif-boiv
-rw-r--r--app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/EditVehicleJourney.js4
-rw-r--r--app/controllers/api_keys_controller.rb6
-rw-r--r--app/controllers/compliance_control_blocks_controller.rb33
-rw-r--r--app/controllers/dashboards_controller.rb13
-rw-r--r--app/controllers/workbenches_controller.rb5
-rw-r--r--app/decorators/compliance_control_set_decorator.rb6
-rw-r--r--app/helpers/breadcrumb_helper.rb10
-rw-r--r--app/helpers/lines_helper.rb4
-rw-r--r--app/models/chouette/line.rb4
-rw-r--r--app/models/chouette/transport_mode.rb71
-rw-r--r--app/models/compliance_check_message.rb3
-rw-r--r--app/models/compliance_check_set.rb3
-rw-r--r--app/models/compliance_control_block.rb12
-rw-r--r--app/models/concerns/stif_transport_mode_enumerations.rb (renamed from app/models/stif_transport_mode_enumerations.rb)5
-rw-r--r--app/models/concerns/stif_transport_submode_enumerations.rb10
-rw-r--r--app/models/dashboard.rb27
-rw-r--r--app/models/line_referential.rb6
-rw-r--r--app/models/organisation.rb10
-rw-r--r--app/models/rule_parameter_set.rb21
-rw-r--r--app/models/workbench.rb1
-rw-r--r--app/views/compliance_check_sets/_filters.html.slim3
-rw-r--r--app/views/compliance_control_blocks/_form.html.slim5
-rw-r--r--app/views/compliance_control_blocks/edit.html.slim2
-rw-r--r--app/views/compliance_control_sets/show.html.slim8
-rw-r--r--app/views/dashboards/show.html.slim15
-rw-r--r--app/views/lines/_filters.html.slim4
-rw-r--r--app/views/lines/index.html.slim4
-rw-r--r--app/views/lines/show.html.slim4
-rw-r--r--app/views/referential_lines/show.html.slim4
-rw-r--r--app/views/referentials/_filters.html.slim2
-rw-r--r--app/views/referentials/show.html.slim2
-rw-r--r--app/views/rule_parameter_sets/_mode_selection.html.slim8
-rw-r--r--app/views/shared/_lines_search_form.html.slim4
-rw-r--r--app/views/stif/dashboards/_dashboard.html.slim73
-rw-r--r--config/initializers/stif.rb4
-rw-r--r--config/locales/breadcrumbs.fr.yml2
-rw-r--r--config/locales/compliance_control_blocks.en.yml5
-rw-r--r--config/locales/compliance_control_blocks.fr.yml7
-rw-r--r--config/locales/dashboard.fr.yml4
-rw-r--r--config/locales/enumerize.en.yml269
-rw-r--r--config/locales/enumerize.fr.yml268
-rw-r--r--config/locales/stif.fr.yml12
-rw-r--r--config/locales/workbenches.fr.yml11
-rw-r--r--config/routes.rb4
-rw-r--r--db/migrate/20171002080526_add_compliance_check_set_to_compliance_check_message.rb5
-rw-r--r--db/schema.rb12
-rw-r--r--lib/stif/dashboard.rb15
-rw-r--r--spec/controllers/rule_parameter_sets_controller_spec.rb32
-rw-r--r--spec/factories/compliance_check_messages.rb1
-rw-r--r--spec/factories/compliance_control_blocks.rb1
-rw-r--r--spec/features/api_keys/delete_api_key_feature_spec.rb5
-rw-r--r--spec/features/api_keys/edit_api_key_feature_spec.rb8
-rw-r--r--spec/features/api_keys/new_api_key_feature_spec.rb10
-rw-r--r--spec/models/chouette/transport_mode_spec.rb64
-rw-r--r--spec/models/compliance_check_message_spec.rb1
-rw-r--r--spec/models/compliance_control_block_spec.rb1
-rw-r--r--spec/models/line_referential_spec.rb2
-rw-r--r--spec/models/organisation_spec.rb8
-rw-r--r--spec/models/vehicle_translation_spec.rb2
59 files changed, 598 insertions, 547 deletions
diff --git a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/EditVehicleJourney.js b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/EditVehicleJourney.js
index 2ff4999c6..d9f81d399 100644
--- a/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/EditVehicleJourney.js
+++ b/app/assets/javascripts/es6_browserified/vehicle_journeys/components/tools/EditVehicleJourney.js
@@ -111,7 +111,7 @@ class EditVehicleJourney extends Component {
<input
type='text'
className='form-control'
- value={window.I18n.fr.enumerize.line.transport_mode[this.props.modal.modalProps.vehicleJourney.transport_mode]}
+ value={window.I18n.fr.enumerize.transport_mode[this.props.modal.modalProps.vehicleJourney.transport_mode]}
disabled={true}
/>
</div>
@@ -122,7 +122,7 @@ class EditVehicleJourney extends Component {
<input
type='text'
className='form-control'
- value={window.I18n.fr.enumerize.line.transport_submode[this.props.modal.modalProps.vehicleJourney.transport_submode]}
+ value={window.I18n.fr.enumerize.transport_submode[this.props.modal.modalProps.vehicleJourney.transport_submode]}
disabled={true}
/>
</div>
diff --git a/app/controllers/api_keys_controller.rb b/app/controllers/api_keys_controller.rb
index f8b96afdc..7ae8d4732 100644
--- a/app/controllers/api_keys_controller.rb
+++ b/app/controllers/api_keys_controller.rb
@@ -6,7 +6,7 @@ class ApiKeysController < BreadcrumbController
@api_key = Api::V1::ApiKey.new(api_key_params.merge(organisation: current_organisation))
create! do |format|
format.html {
- redirect_to workbenches_path
+ redirect_to dashboard_path
}
end
end
@@ -14,7 +14,7 @@ class ApiKeysController < BreadcrumbController
def update
update! do |format|
format.html {
- redirect_to workbenches_path
+ redirect_to dashboard_path
}
end
end
@@ -22,7 +22,7 @@ class ApiKeysController < BreadcrumbController
def destroy
destroy! do |format|
format.html {
- redirect_to workbenches_path
+ redirect_to dashboard_path
}
end
end
diff --git a/app/controllers/compliance_control_blocks_controller.rb b/app/controllers/compliance_control_blocks_controller.rb
index 2456eceba..2dd69a865 100644
--- a/app/controllers/compliance_control_blocks_controller.rb
+++ b/app/controllers/compliance_control_blocks_controller.rb
@@ -1,41 +1,12 @@
class ComplianceControlBlocksController < BreadcrumbController
defaults resource_class: ComplianceControlBlock
belongs_to :compliance_control_set
-
- def new
- @compliance_control_set = parent
- @compliance_control_block = ComplianceControlBlock.new(compliance_control_set: @compliance_control_set)
- end
-
- def create
- create! do |success, failure|
- success.html { redirect_to compliance_control_set_path(@compliance_control_set) }
- failure.html { render :action => :new }
- end
- end
-
- def update
- update! do |success, failure|
- success.html { redirect_to compliance_control_set_path(@compliance_control_set) }
- failure.html { render :action => :edit }
- end
- end
-
- def destroy
- destroy! do |format|
- format.html { redirect_to compliance_control_set_path(@compliance_control_set) }
- end
- end
+ actions :all, :except => [:show, :index]
private
- def create_resource compliance_control_block
- compliance_control_block.transport_mode = params[:compliance_control_block][:transport_mode]
- super
- end
-
def compliance_control_block_params
- params.require(:compliance_control_block).permit(:transport_mode)
+ params.require(:compliance_control_block).permit(:transport_mode, :transport_submode)
end
end \ No newline at end of file
diff --git a/app/controllers/dashboards_controller.rb b/app/controllers/dashboards_controller.rb
new file mode 100644
index 000000000..2585dafca
--- /dev/null
+++ b/app/controllers/dashboards_controller.rb
@@ -0,0 +1,13 @@
+#
+# If you changed the default Dashboard implementation (see Dashboard),
+# this controller will use a custom partial like
+# custom/dashboards/_dashboard.html.slim for Custom::Dashboard
+#
+class DashboardsController < BreadcrumbController
+ respond_to :html, only: [:show]
+
+ def show
+ @dashboard = Dashboard.create self
+ end
+
+end
diff --git a/app/controllers/workbenches_controller.rb b/app/controllers/workbenches_controller.rb
index 54ddb8be1..d597ba371 100644
--- a/app/controllers/workbenches_controller.rb
+++ b/app/controllers/workbenches_controller.rb
@@ -5,10 +5,7 @@ class WorkbenchesController < BreadcrumbController
respond_to :html, only: [:show, :index]
def index
- # Only display Wb with selected name, according to #4108
- @workbench = current_organisation.workbenches.find_by(name: "Gestion de l'offre")
- @referentials = @workbench.all_referentials
- @calendars = Calendar.where('organisation_id = ? OR shared = ?', current_organisation.id, true)
+ redirect_to dashboard_path
end
def show
diff --git a/app/decorators/compliance_control_set_decorator.rb b/app/decorators/compliance_control_set_decorator.rb
index 6a9040358..f4aa607e1 100644
--- a/app/decorators/compliance_control_set_decorator.rb
+++ b/app/decorators/compliance_control_set_decorator.rb
@@ -20,12 +20,6 @@ class ComplianceControlSetDecorator < Draper::Decorator
)
# end
- # if h.policy(ComplianceControl).create?
- links << Link.new(
- content: h.t('compliance_control_sets.actions.add_compliance_control'),
- href: h.select_type_compliance_control_set_compliance_controls_path(object.id)
- )
- # end
links
end
diff --git a/app/helpers/breadcrumb_helper.rb b/app/helpers/breadcrumb_helper.rb
index a3ee9de72..da1f270ab 100644
--- a/app/helpers/breadcrumb_helper.rb
+++ b/app/helpers/breadcrumb_helper.rb
@@ -75,13 +75,13 @@ module BreadcrumbHelper
end
def calendar_breadcrumb(action)
- add_breadcrumb I18n.t('breadcrumbs.referentials'), workbenches_path
+ add_breadcrumb I18n.t('breadcrumbs.root'), root_path
add_breadcrumb I18n.t('calendars.index.title'), calendars_path
add_breadcrumb @calendar.name if %i(show edit).include? action
end
def workbench_breadcrumb(action)
- add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path
+ add_breadcrumb I18n.t("breadcrumbs.root"), root_path
add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench)
end
@@ -217,7 +217,7 @@ module BreadcrumbHelper
end
def import_breadcrumb (action)
- add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path
+ add_breadcrumb I18n.t("breadcrumbs.root"), root_path
add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench)
add_breadcrumb I18n.t("breadcrumbs.imports"), workbench_imports_path(@workbench)
@@ -242,7 +242,7 @@ module BreadcrumbHelper
end
def compliance_control_sets_breadcrumb (action)
- add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path
+ add_breadcrumb I18n.t("breadcrumbs.root"), root_path
#add_breadcrumb breadcrumb_label(@workbench), workbench_path(@workbench), :title => breadcrumb_tooltip(@workbench)
end
@@ -264,7 +264,7 @@ module BreadcrumbHelper
end
def organisation_breadcrumb (action = :index)
- add_breadcrumb I18n.t("breadcrumbs.referentials"), workbenches_path
+ add_breadcrumb I18n.t("breadcrumbs.root"), root_path
add_breadcrumb breadcrumb_label(@organisation), organisation_path,:title => breadcrumb_tooltip(@organisation) unless action == :index
end
diff --git a/app/helpers/lines_helper.rb b/app/helpers/lines_helper.rb
index ccf3a12a2..1a7f567c7 100644
--- a/app/helpers/lines_helper.rb
+++ b/app/helpers/lines_helper.rb
@@ -6,11 +6,11 @@ module LinesHelper
end
def sorted_transport_submode
- Chouette::Line.transport_submode.values.sort_by{|m| t("enumerize.line.transport_submode.#{m}").parameterize }
+ Chouette::Line.transport_submode.values.sort_by{|m| t("enumerize.transport_submode.#{m}").parameterize }
end
def sorted_transport_mode
- Chouette::Line.transport_mode.values.sort_by{|m| t("enumerize.line.transport_mode.#{m}").parameterize }
+ Chouette::Line.transport_mode.values.sort_by{|m| t("enumerize.transport_mode.#{m}").parameterize }
end
def colors?(line)
diff --git a/app/models/chouette/line.rb b/app/models/chouette/line.rb
index 63d2d1606..6f87a5d08 100644
--- a/app/models/chouette/line.rb
+++ b/app/models/chouette/line.rb
@@ -3,12 +3,10 @@ class Chouette::Line < Chouette::ActiveRecord
include LineRestrictions
include LineReferentialSupport
include StifTransportModeEnumerations
+ include StifTransportSubmodeEnumerations
- extend Enumerize
extend ActiveModel::Naming
- enumerize :transport_submode, in: %i(unknown undefined internationalFlight domesticFlight intercontinentalFlight domesticScheduledFlight shuttleFlight intercontinentalCharterFlight internationalCharterFlight roundTripCharterFlight sightseeingFlight helicopterService domesticCharterFlight SchengenAreaFlight airshipService shortHaulInternationalFlight canalBarge localBus regionalBus expressBus nightBus postBus specialNeedsBus mobilityBus mobilityBusForRegisteredDisabled sightseeingBus shuttleBus highFrequencyBus dedicatedLaneBus schoolBus schoolAndPublicServiceBus railReplacementBus demandAndResponseBus airportLinkBus internationalCoach nationalCoach shuttleCoach regionalCoach specialCoach schoolCoach sightseeingCoach touristCoach commuterCoach metro tube urbanRailway local highSpeedRail suburbanRailway regionalRail interregionalRail longDistance intermational sleeperRailService nightRail carTransportRailService touristRailway railShuttle replacementRailService specialTrain crossCountryRail rackAndPinionRailway cityTram localTram regionalTram sightseeingTram shuttleTram trainTram internationalCarFerry nationalCarFerry regionalCarFerry localCarFerry internationalPassengerFerry nationalPassengerFerry regionalPassengerFerry localPassengerFerry postBoat trainFerry roadFerryLink airportBoatLink highSpeedVehicleService highSpeedPassengerService sightseeingService schoolBoat cableFerry riverBus scheduledFerry shuttleFerryService telecabin cableCar lift chairLift dragLift telecabinLink funicular streetCableCar allFunicularServices undefinedFunicular)
-
# FIXME http://jira.codehaus.org/browse/JRUBY-6358
self.primary_key = "id"
diff --git a/app/models/chouette/transport_mode.rb b/app/models/chouette/transport_mode.rb
deleted file mode 100644
index 825ef15b8..000000000
--- a/app/models/chouette/transport_mode.rb
+++ /dev/null
@@ -1,71 +0,0 @@
-class Chouette::TransportMode < ActiveSupport::StringInquirer
-
- def initialize(text_code, numerical_code)
- super text_code.to_s
- @numerical_code = numerical_code
- end
-
- def self.new(text_code, numerical_code = nil)
- if text_code and numerical_code
- super
- elsif self === text_code
- text_code
- else
- if Fixnum === text_code
- text_code, numerical_code = definitions.rassoc(text_code)
- else
- text_code, numerical_code = definitions.assoc(text_code.to_s)
- end
-
- super text_code, numerical_code
- end
- end
-
- def to_i
- @numerical_code
- end
-
- def inspect
- "#{to_s}/#{to_i}"
- end
-
- def name
- camelize
- end
-
- @@definitions = [
- ["interchange", -1],
- ["unknown", 0],
- ["coach", 1],
- ["air", 2],
- ["waterborne", 3],
- ["bus", 4],
- ["ferry", 5],
- ["walk", 6],
- ["metro", 7],
- ["shuttle", 8],
- ["rapid_transit", 9],
- ["taxi", 10],
- ["local_train", 11],
- ["train", 12],
- ["long_distance_train", 13],
- ["tramway", 14],
- ["trolleybus", 15],
- ["private_vehicle", 16],
- ["bicycle", 17],
- ["other", 18]
- ]
- cattr_reader :definitions
-
- @@all = nil
- def self.all
- @@all ||= definitions.collect do |text_code, numerical_code|
- new(text_code, numerical_code)
- end
- end
-
- def public_transport?
- not interchange?
- end
-
-end
diff --git a/app/models/compliance_check_message.rb b/app/models/compliance_check_message.rb
index 562c09c0e..738bd4a4b 100644
--- a/app/models/compliance_check_message.rb
+++ b/app/models/compliance_check_message.rb
@@ -1,8 +1,11 @@
class ComplianceCheckMessage < ActiveRecord::Base
extend Enumerize
+ belongs_to :compliance_check_set
belongs_to :compliance_check
belongs_to :compliance_check_resource
enumerize :status, in: %i(OK ERROR WARNING IGNORED), scope: true
+
+ validates_presence_of :compliance_check_set
end
diff --git a/app/models/compliance_check_set.rb b/app/models/compliance_check_set.rb
index f1f4a9f94..4c00c3516 100644
--- a/app/models/compliance_check_set.rb
+++ b/app/models/compliance_check_set.rb
@@ -6,7 +6,8 @@ class ComplianceCheckSet < ActiveRecord::Base
belongs_to :workbench
belongs_to :parent, polymorphic: true
- has_many :compliance_check_set
+ has_many :compliance_check_resources
+ has_many :compliance_check_messages
enumerize :status, in: %w[new pending successful warning failed running aborted canceled]
diff --git a/app/models/compliance_control_block.rb b/app/models/compliance_control_block.rb
index e03c4ce85..05952e9e2 100644
--- a/app/models/compliance_control_block.rb
+++ b/app/models/compliance_control_block.rb
@@ -2,9 +2,17 @@ class ComplianceControlBlock < ActiveRecord::Base
belongs_to :compliance_control_set
has_many :compliance_controls, dependent: :destroy
- hstore_accessor :condition_attributes, transport_mode: :string
+ hstore_accessor :condition_attributes,
+ transport_mode: :string,
+ transport_submode: :string
+
+ validates_presence_of :transport_mode
def self.transport_modes
- ["all"] + StifTransportModeEnumerations.transport_mode.values
+ StifTransportModeEnumerations.transport_modes
+ end
+
+ def self.transport_submodes
+ StifTransportSubmodeEnumerations.transport_submodes
end
end
diff --git a/app/models/stif_transport_mode_enumerations.rb b/app/models/concerns/stif_transport_mode_enumerations.rb
index a9a3fc3e0..dc573b3a0 100644
--- a/app/models/stif_transport_mode_enumerations.rb
+++ b/app/models/concerns/stif_transport_mode_enumerations.rb
@@ -1,5 +1,10 @@
module StifTransportModeEnumerations
+ extend ActiveSupport::Concern
extend Enumerize
enumerize :transport_mode, in: %w(air bus coach ferry metro rail trolleyBus tram water cableway funicular other)
+
+ def transport_modes
+ StifTransportModeEnumerations.transport_mode.options.map(&:first)
+ end
end
diff --git a/app/models/concerns/stif_transport_submode_enumerations.rb b/app/models/concerns/stif_transport_submode_enumerations.rb
new file mode 100644
index 000000000..a150381f3
--- /dev/null
+++ b/app/models/concerns/stif_transport_submode_enumerations.rb
@@ -0,0 +1,10 @@
+module StifTransportSubmodeEnumerations
+ extend ActiveSupport::Concern
+ extend Enumerize
+
+ enumerize :transport_submode, in: %w(unknown undefined internationalFlight domesticFlight intercontinentalFlight domesticScheduledFlight shuttleFlight intercontinentalCharterFlight internationalCharterFlight roundTripCharterFlight sightseeingFlight helicopterService domesticCharterFlight SchengenAreaFlight airshipService shortHaulInternationalFlight canalBarge localBus regionalBus expressBus nightBus postBus specialNeedsBus mobilityBus mobilityBusForRegisteredDisabled sightseeingBus shuttleBus highFrequencyBus dedicatedLaneBus schoolBus schoolAndPublicServiceBus railReplacementBus demandAndResponseBus airportLinkBus internationalCoach nationalCoach shuttleCoach regionalCoach specialCoach schoolCoach sightseeingCoach touristCoach commuterCoach metro tube urbanRailway local highSpeedRail suburbanRailway regionalRail interregionalRail longDistance intermational sleeperRailService nightRail carTransportRailService touristRailway railShuttle replacementRailService specialTrain crossCountryRail rackAndPinionRailway cityTram localTram regionalTram sightseeingTram shuttleTram trainTram internationalCarFerry nationalCarFerry regionalCarFerry localCarFerry internationalPassengerFerry nationalPassengerFerry regionalPassengerFerry localPassengerFerry postBoat trainFerry roadFerryLink airportBoatLink highSpeedVehicleService highSpeedPassengerService sightseeingService schoolBoat cableFerry riverBus scheduledFerry shuttleFerryService telecabin cableCar lift chairLift dragLift telecabinLink funicular streetCableCar allFunicularServices undefinedFunicular)
+
+ def transport_submodes
+ StifTransportSubmodeEnumerations.transport_submode.options.map(&:first)
+ end
+end
diff --git a/app/models/dashboard.rb b/app/models/dashboard.rb
new file mode 100644
index 000000000..a53267db5
--- /dev/null
+++ b/app/models/dashboard.rb
@@ -0,0 +1,27 @@
+#
+# The default Dashboard implementation can be customized in an initializer :
+#
+# Rails.application.config.to_prepare do
+# Dashboard.default_class = Custom::Dashboard
+# end
+#
+class Dashboard
+ include ActiveModel::Conversion
+
+ @@default_class = self
+ mattr_accessor :default_class
+
+ attr_reader :context
+
+ def initialize(context)
+ @context = context
+ end
+
+ def self.create(context)
+ default_class.new context
+ end
+
+ def current_organisation
+ context.send(:current_organisation)
+ end
+end
diff --git a/app/models/line_referential.rb b/app/models/line_referential.rb
index 8bbc32993..7ab892b53 100644
--- a/app/models/line_referential.rb
+++ b/app/models/line_referential.rb
@@ -1,4 +1,6 @@
class LineReferential < ActiveRecord::Base
+ include StifTransportModeEnumerations
+
has_many :line_referential_memberships
has_many :organisations, through: :line_referential_memberships
has_many :lines, class_name: 'Chouette::Line'
@@ -25,8 +27,4 @@ class LineReferential < ActiveRecord::Base
def last_sync
line_referential_syncs.last
end
-
- def transport_modes
- Chouette::TransportMode.all.select { |tm| tm.to_i > 0 }
- end
end
diff --git a/app/models/organisation.rb b/app/models/organisation.rb
index ba65ad375..6104b4431 100644
--- a/app/models/organisation.rb
+++ b/app/models/organisation.rb
@@ -3,7 +3,7 @@ class Organisation < ActiveRecord::Base
has_many :users, :dependent => :destroy
has_many :referentials, :dependent => :destroy
- has_many :rule_parameter_sets, :dependent => :destroy
+ # has_many :rule_parameter_sets, :dependent => :destroy
has_many :compliance_control_sets, :dependent => :destroy
has_many :stop_area_referential_memberships
@@ -19,11 +19,11 @@ class Organisation < ActiveRecord::Base
validates_presence_of :name
validates_uniqueness_of :code
- after_create :add_rule_parameter_set
+ # after_create :add_rule_parameter_set
- def add_rule_parameter_set
- RuleParameterSet.default_for_all_modes( self).save
- end
+ # def add_rule_parameter_set
+ # RuleParameterSet.default_for_all_modes( self).save
+ # end
def self.portail_api_request
conf = Rails.application.config.try(:stif_portail_api)
diff --git a/app/models/rule_parameter_set.rb b/app/models/rule_parameter_set.rb
index db78a2f8a..91e575822 100644
--- a/app/models/rule_parameter_set.rb
+++ b/app/models/rule_parameter_set.rb
@@ -65,7 +65,26 @@ class RuleParameterSet < ActiveRecord::Base
end
def self.all_modes
- Chouette::TransportMode.all.map { |m| m.to_s}
+ ["interchange",
+ "unknown",
+ "coach",
+ "air",
+ "waterborne",
+ "bus",
+ "ferry",
+ "walk",
+ "metro",
+ "shuttle",
+ "rapid_transit",
+ "taxi",
+ "local_train",
+ "train",
+ "long_distance_train",
+ "tramway",
+ "trolleybus",
+ "private_vehicle",
+ "bicycle",
+ "other"]
end
def self.mode_attribute?( method_name )
diff --git a/app/models/workbench.rb b/app/models/workbench.rb
index ae111a9c5..c304e8ba9 100644
--- a/app/models/workbench.rb
+++ b/app/models/workbench.rb
@@ -12,6 +12,7 @@ class Workbench < ActiveRecord::Base
has_many :imports
has_many :workbench_imports
has_many :compliance_check_sets
+ has_many :compliance_control_sets
validates :name, presence: true
validates :organisation, presence: true
diff --git a/app/views/compliance_check_sets/_filters.html.slim b/app/views/compliance_check_sets/_filters.html.slim
index 609754eec..a9467a7fe 100644
--- a/app/views/compliance_check_sets/_filters.html.slim
+++ b/app/views/compliance_check_sets/_filters.html.slim
@@ -1,4 +1,4 @@
-= search_form_for @q_for_form, url: workbench_compliance_check_sets_path(current_offer_workbench), builder: SimpleForm::FormBuilder, class: 'form form-filter' do |f|
+= search_form_for @q_for_form, url: workbench_compliance_check_sets_path(@workbench), builder: SimpleForm::FormBuilder, class: 'form form-filter' do |f|
.ffg-row
.input-group.search_bar
= f.search_field :referential_name_cont, class: 'form-control', placeholder: t('compliance_check_sets.filters.name')
@@ -21,4 +21,3 @@
.actions
= link_to t('actions.erase'), @compliance_checks_sets, class: 'btn btn-link'
= f.submit t('actions.filter'), class: 'btn btn-default', id: 'referential_filter_btn'
-
diff --git a/app/views/compliance_control_blocks/_form.html.slim b/app/views/compliance_control_blocks/_form.html.slim
index b20b5d0cc..88fa7e98b 100644
--- a/app/views/compliance_control_blocks/_form.html.slim
+++ b/app/views/compliance_control_blocks/_form.html.slim
@@ -1,8 +1,9 @@
= simple_form_for [@compliance_control_set, @compliance_control_block], html: { class: 'form-horizontal', id: 'compliance_control_block_form' }, wrapper: :horizontal_form do |f|
.row
.col-lg-12
- = f.input :transport_mode, as: :select, collection: ComplianceControlBlock.transport_modes
- / = f.input :sub_transport_mode
+ .form-group
+ = f.input :transport_mode, as: :select, collection: ComplianceControlBlock.transport_modes, label: t('activerecord.attributes.compliance_control_blocks.transport_mode')
+ = f.input :transport_submode, as: :select, collection: ComplianceControlBlock.transport_submodes, label: t('activerecord.attributes.compliance_control_blocks.transport_submode')
.separator
diff --git a/app/views/compliance_control_blocks/edit.html.slim b/app/views/compliance_control_blocks/edit.html.slim
index fbd42e7f3..0ac507ece 100644
--- a/app/views/compliance_control_blocks/edit.html.slim
+++ b/app/views/compliance_control_blocks/edit.html.slim
@@ -1,6 +1,6 @@
/ PageHeader
= pageheader 'modele-calendrier',
- t('compliance_control_blocks.edit.title')
+ t('compliance_control_blocks.edit.title', compliance_control_block: @compliance_control_block.id)
/ PageContent
diff --git a/app/views/compliance_control_sets/show.html.slim b/app/views/compliance_control_sets/show.html.slim
index d7d4678ba..3b0a123aa 100644
--- a/app/views/compliance_control_sets/show.html.slim
+++ b/app/views/compliance_control_sets/show.html.slim
@@ -56,4 +56,12 @@
sortable: true,
cls: 'table has-filter has-search'
+ .select_toolbox
+ ul
+ li.st_action
+ = link_to select_type_compliance_control_set_compliance_controls_path(@compliance_control_set.id)
+ span.fa.fa-plus
+ li.st_action
+ = link_to new_compliance_control_set_compliance_control_block_path(@compliance_control_set.id)
+ span.fa.fa-plus-square
diff --git a/app/views/dashboards/show.html.slim b/app/views/dashboards/show.html.slim
new file mode 100644
index 000000000..66154712d
--- /dev/null
+++ b/app/views/dashboards/show.html.slim
@@ -0,0 +1,15 @@
+/ PageHeader
+= pageheader 'tableau-de-bord',
+ t('.title', organisation: current_organisation.name)
+
+ / Below is secundary actions & optional contents (filters, ...)
+ .row.mb-sm
+ .col-lg-12.text-right
+ - if policy(Api::V1::ApiKey).create?
+ = link_to t('actions.create_api_key'), new_api_key_path, class: 'btn btn-primary'
+
+
+/ PageContent
+.page_content
+ .container-fluid
+ = render partial: @dashboard
diff --git a/app/views/lines/_filters.html.slim b/app/views/lines/_filters.html.slim
index 0e34b2e4c..01c2da58f 100644
--- a/app/views/lines/_filters.html.slim
+++ b/app/views/lines/_filters.html.slim
@@ -17,11 +17,11 @@
.form-group.togglable
= f.label Chouette::Line.human_attribute_name(:transport_mode), required: false, class: 'control-label'
- = f.input :transport_mode_eq_any, collection: sorted_transport_mode, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.line.transport_mode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
+ = f.input :transport_mode_eq_any, collection: sorted_transport_mode, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.transport_mode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
.form-group.togglable
= f.label Chouette::Line.human_attribute_name(:transport_submode), required: false, class: 'control-label'
- = f.input :transport_submode_eq_any, collection: sorted_transport_submode, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.line.transport_submode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
+ = f.input :transport_submode_eq_any, collection: sorted_transport_submode, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.transport_submode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list'}
.actions
= link_to 'Effacer', @workbench, class: 'btn btn-link'
diff --git a/app/views/lines/index.html.slim b/app/views/lines/index.html.slim
index fb07c45a2..4ee91e8f8 100644
--- a/app/views/lines/index.html.slim
+++ b/app/views/lines/index.html.slim
@@ -48,11 +48,11 @@
), \
TableBuilderHelper::Column.new( \
key: :transport_mode, \
- attribute: Proc.new { |n| n.transport_mode.nil? ? '-' : t("enumerize.line.transport_mode.#{n.try(:transport_mode)}") } \
+ attribute: Proc.new { |n| n.transport_mode.nil? ? '-' : t("enumerize.transport_mode.#{n.try(:transport_mode)}") } \
), \
TableBuilderHelper::Column.new( \
key: :transport_submode, \
- attribute: Proc.new { |n| n.transport_submode.nil? ? '-' : t("enumerize.line.transport_submode.#{n.try(:transport_submode)}") } \
+ attribute: Proc.new { |n| n.transport_submode.nil? ? '-' : t("enumerize.transport_submode.#{n.try(:transport_submode)}") } \
) \
],
links: [:show],
diff --git a/app/views/lines/show.html.slim b/app/views/lines/show.html.slim
index 0779a0f5a..201aa2ae4 100644
--- a/app/views/lines/show.html.slim
+++ b/app/views/lines/show.html.slim
@@ -27,7 +27,7 @@
'Transporteur(s) secondaire(s)' => (@line.secondary_companies.nil? ? t('lines.index.unset') : @line.secondary_companies.collect(&:name).join(', ')),
'Nom court' => @line.number,
'Code public' => (@line.registration_number ? @line.registration_number : '-'),
- @line.human_attribute_name(:transport_mode) => (@line.transport_mode ? t("enumerize.line.transport_mode.#{@line.transport_mode}") : '-'),
- @line.human_attribute_name(:transport_submode) => (@line.transport_submode ? t("enumerize.line.transport_submode.#{@line.transport_submode}") : '-'),
+ @line.human_attribute_name(:transport_mode) => (@line.transport_mode ? t("enumerize.transport_mode.#{@line.transport_mode}") : '-'),
+ @line.human_attribute_name(:transport_submode) => (@line.transport_submode ? t("enumerize.transport_submode.#{@line.transport_submode}") : '-'),
@line.human_attribute_name(:url) => (@line.url ? @line.url : '-'),
@line.human_attribute_name(:seasonal) => (@line.seasonal? ? t('true') : t('false')),}
diff --git a/app/views/referential_lines/show.html.slim b/app/views/referential_lines/show.html.slim
index 6e59d83b3..06a52a45d 100644
--- a/app/views/referential_lines/show.html.slim
+++ b/app/views/referential_lines/show.html.slim
@@ -27,8 +27,8 @@
'Transporteur(s) secondaire(s)' => (@line.secondary_companies.nil? ? t('lines.index.unset') : @line.secondary_companies.collect(&:name).join(', ')),
'Nom court' => @line.number,
'Code public' => (@line.registration_number ? @line.registration_number : '-'),
- @line.human_attribute_name(:transport_mode) => (@line.transport_mode ? t("enumerize.line.transport_mode.#{@line.transport_mode}") : '-'),
- @line.human_attribute_name(:transport_submode) => (@line.transport_submode ? t("enumerize.line.transport_submode.#{@line.transport_submode}") : '-'),
+ @line.human_attribute_name(:transport_mode) => (@line.transport_mode ? t("enumerize.transport_mode.#{@line.transport_mode}") : '-'),
+ @line.human_attribute_name(:transport_submode) => (@line.transport_submode ? t("enumerize.transport_submode.#{@line.transport_submode}") : '-'),
@line.human_attribute_name(:url) => (@line.url ? @line.url : '-'),
@line.human_attribute_name(:seasonal) => (@line.seasonal? ? t('true') : t('false')),}
diff --git a/app/views/referentials/_filters.html.slim b/app/views/referentials/_filters.html.slim
index 1cc6bb410..c5b6042f0 100644
--- a/app/views/referentials/_filters.html.slim
+++ b/app/views/referentials/_filters.html.slim
@@ -9,7 +9,7 @@
.ffg-row
.form-group.togglable
= f.label Chouette::Line.human_attribute_name(:transport_mode), required: false, class: 'control-label'
- = f.input :transport_mode_eq_any, collection: @referential.lines.pluck(:transport_mode).uniq.compact, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.line.transport_mode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' }
+ = f.input :transport_mode_eq_any, collection: @referential.lines.pluck(:transport_mode).uniq.compact, as: :check_boxes, label: false, label_method: lambda{|l| ("<span>" + t("enumerize.transport_mode.#{l}") + "</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' }
.form-group.togglable
= f.label Chouette::Line.human_attribute_name(:network), required: false, class: 'control-label'
diff --git a/app/views/referentials/show.html.slim b/app/views/referentials/show.html.slim
index 0fdd79e14..26ce0acbb 100644
--- a/app/views/referentials/show.html.slim
+++ b/app/views/referentials/show.html.slim
@@ -62,7 +62,7 @@
), \
TableBuilderHelper::Column.new( \
key: :transport_mode, \
- attribute: Proc.new { |n| n.transport_mode ? t("enumerize.line.transport_mode.#{n.transport_mode}") : '' }, \
+ attribute: Proc.new { |n| n.transport_mode ? t("enumerize.transport_mode.#{n.transport_mode}") : '' }, \
), \
TableBuilderHelper::Column.new( \
key: 'networks.name', \
diff --git a/app/views/rule_parameter_sets/_mode_selection.html.slim b/app/views/rule_parameter_sets/_mode_selection.html.slim
index a2a8a16e5..b9afd10b6 100644
--- a/app/views/rule_parameter_sets/_mode_selection.html.slim
+++ b/app/views/rule_parameter_sets/_mode_selection.html.slim
@@ -1,4 +1,4 @@
-select.undescribed_modes
- - Chouette::TransportMode.all.map { |m| m.name.downcase}.each do |mode|
- option value="#{mode}"
- = t("transport_modes.label.#{mode}") \ No newline at end of file
+/ select.undescribed_modes
+/ - Chouette::TransportMode.all.map { |m| m.name.downcase}.each do |mode|
+/ option value="#{mode}"
+/ = t("transport_modes.label.#{mode}") \ No newline at end of file
diff --git a/app/views/shared/_lines_search_form.html.slim b/app/views/shared/_lines_search_form.html.slim
index 3bc84a3ad..8a59412a4 100644
--- a/app/views/shared/_lines_search_form.html.slim
+++ b/app/views/shared/_lines_search_form.html.slim
@@ -19,6 +19,6 @@
.col-xs-3
= f.select(:company_id_eq, referential.companies.collect { |c| [c.name, c.id] }.unshift([t("lines.index.no_networks"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_companies") })
.col-xs-3
- = f.select(:transport_mode_eq, Chouette::Line.transport_mode.values.collect { |v| [ I18n.t("enumerize.line.transport_mode.#{v}"), v] }.sort.unshift([t("lines.index.no_transport_modes"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_transport_modes") })
+ = f.select(:transport_mode_eq, Chouette::Line.transport_mode.values.collect { |v| [ I18n.t("enumerize.transport_mode.#{v}"), v] }.sort.unshift([t("lines.index.no_transport_modes"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_transport_modes") })
.col-xs-3
- = f.select(:transport_submode_eq, Chouette::Line.transport_submode.values.collect { |v| [ I18n.t("enumerize.line.transport_submode.#{v}"), v] }.sort.unshift([t("lines.index.no_transport_submodes"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_transport_submodes") })
+ = f.select(:transport_submode_eq, Chouette::Line.transport_submode.values.collect { |v| [ I18n.t("enumerize.transport_submode.#{v}"), v] }.sort.unshift([t("lines.index.no_transport_submodes"), -1]), { include_blank: '' }, { class: 'form-control', style: 'width: 100%', 'data-select2ed': 'true', 'data-select2ed-placeholder': t("lines.index.all_transport_submodes") })
diff --git a/app/views/stif/dashboards/_dashboard.html.slim b/app/views/stif/dashboards/_dashboard.html.slim
new file mode 100644
index 000000000..3142ecd5b
--- /dev/null
+++ b/app/views/stif/dashboards/_dashboard.html.slim
@@ -0,0 +1,73 @@
+.row
+ .col-lg-12
+ h2.content_header = t('.subtitle')
+
+.row
+ .col-lg-6.col-md-6.col-sm-6.col-xs-12
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title
+ = t('.organisation')
+
+ .panel-body
+ em.small.text-muted = t('.no_content')
+
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title
+ = t('.idf')
+
+ .panel-body
+ em.small.text-muted = t('.no_content')
+
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title
+ = t('.api_keys')
+ span.badge.ml-xs = current_organisation.api_keys.count if current_organisation.api_keys.present?
+ - if current_organisation.api_keys.present?
+ - current_organisation.api_keys.each do |api_key|
+ .list-group
+ = policy(api_key).edit? ? link_to( "#{api_key.name} : #{api_key.token}", edit_api_key_path(api_key), class: 'list-group-item') : "#{api_key.name} : #{api_key.token}"
+ - else
+ .panel-body
+ em.small.text-muted = t('.no_content')
+
+ .col-lg-6.col-md-6.col-sm-6.col-xs-12
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title.with_actions
+ div
+ = t('.referentials')
+ span.badge.ml-xs = @referentials.count if @referentials.present?
+
+ div
+ = link_to '', workbench_path(@dashboard.workbench), class: ' fa fa-chevron-right pull-right', title: t('.see')
+
+ - if @referentials.present?
+ .list-group
+ - @referentials.each_with_index do |referential, i|
+ = link_to referential.name, referential_path(referential, workbench_id: referential.workbench_id, current_workbench_id: @dashboard.workbench.id), class: 'list-group-item' if i < 6
+
+ - else
+ .panel-body
+ em.small.text-muted = t('.no_content')
+
+ .panel.panel-default
+ .panel-heading
+ h3.panel-title.with_actions
+ div
+ = t('.calendars')
+ span.badge.ml-xs = @dashboard.calendars.count if @dashboard.calendars.present?
+
+ div
+ = link_to '', calendars_path, class: ' fa fa-chevron-right pull-right', title: t('.see')
+
+ - if @dashboard.calendars.present?
+ .list-group
+ - @dashboard.calendars.each_with_index do |calendar, i|
+ = link_to calendar.name, calendar_path(calendar), class: 'list-group-item' if i < 6
+
+ - else
+ .panel-body
+ em.small.text-muted = t('.no_content')
diff --git a/config/initializers/stif.rb b/config/initializers/stif.rb
index 6a79cadc8..f20429575 100644
--- a/config/initializers/stif.rb
+++ b/config/initializers/stif.rb
@@ -11,3 +11,7 @@ Rails.application.config.to_prepare do
end
end
end unless Rails.env.test?
+
+Rails.application.config.to_prepare do
+ Dashboard.default_class = Stif::Dashboard
+end
diff --git a/config/locales/breadcrumbs.fr.yml b/config/locales/breadcrumbs.fr.yml
index b941138c7..725549f14 100644
--- a/config/locales/breadcrumbs.fr.yml
+++ b/config/locales/breadcrumbs.fr.yml
@@ -2,6 +2,6 @@ fr:
breadcrumbs:
vehicle_journeys: "Horaires"
vehicle_journey_frequencies: "Créneaux horaires"
- referentials: "Accueil"
+ root: "Accueil"
users: "Utilisateurs"
imports: Imports
diff --git a/config/locales/compliance_control_blocks.en.yml b/config/locales/compliance_control_blocks.en.yml
index 8d5667df4..a37b41db5 100644
--- a/config/locales/compliance_control_blocks.en.yml
+++ b/config/locales/compliance_control_blocks.en.yml
@@ -1,7 +1,10 @@
fr:
activerecord:
models:
- compliance_control_blocks: Control blocks
+ compliance_control_block:
+ zero: Control blocks
+ one: Control block
+ other: Control blocks
attributes:
compliance_control_blocks:
transport_mode: Transport mode
diff --git a/config/locales/compliance_control_blocks.fr.yml b/config/locales/compliance_control_blocks.fr.yml
index beb2497b2..f93cafa54 100644
--- a/config/locales/compliance_control_blocks.fr.yml
+++ b/config/locales/compliance_control_blocks.fr.yml
@@ -1,11 +1,14 @@
fr:
activerecord:
models:
- compliance_control_blocks: Groupes de contrôles
+ compliance_control_block:
+ zero: "Groupe de contrôle"
+ one: "Groupe de contrôle"
+ other: "Groupes de contrôles"
attributes:
compliance_control_blocks:
transport_mode: Mode de transport
- sub_transport_mode: Sous-mode de transport
+ transport_submode: Sous-mode de transport
compliance_control_blocks:
actions:
destroy_confirm: Etes vous sûr de supprimer ce bloc ?
diff --git a/config/locales/dashboard.fr.yml b/config/locales/dashboard.fr.yml
new file mode 100644
index 000000000..fffb36cd1
--- /dev/null
+++ b/config/locales/dashboard.fr.yml
@@ -0,0 +1,4 @@
+fr:
+ dashboards:
+ show:
+ title: "Tableau de bord %{organisation}"
diff --git a/config/locales/enumerize.en.yml b/config/locales/enumerize.en.yml
index addf64dbd..f5e51171b 100644
--- a/config/locales/enumerize.en.yml
+++ b/config/locales/enumerize.en.yml
@@ -110,138 +110,137 @@ en:
between: Between two dates
before: Before date
after: After date
- line:
- transport_mode:
- interchange: Interchange
- unknown: "unknown"
- undefined: "undefined"
- air: "Air"
- train: "Train"
- long_distance_train: "Long distance train"
- local_train: "Local train"
- rapid_transit: "Rapid transit"
- metro: "Metro"
- tramway: "Tramway"
- coach: "Coach"
- bus: "Bus"
- ferry: "Ferry"
- waterborne: "Waterborne"
- private_vehicle: "Private vehicle"
- walk: "Walk"
- trolleyBus: "Trolleybus"
- bicycle: "Bicycle"
- shuttle: "Shuttle"
- taxi: "Taxi"
- val: "VAL"
- other: "Other"
- air: Air
- bus: Bus
- coach: Coach
- ferry: Ferry
- metro: Metro
- rail: Rail
- trolleybus: Trolleybus
- tram: Tramway
- water: Water
- cableway: Cableway
- funicular: Funicular
- other: Other
- transport_submode:
- unknown: 'Unknown'
- undefined: 'Undefined'
- internationalFlight: 'International flight'
- domesticFlight: 'Domestic flight'
- intercontinentalFlight: 'Intercontinental flight'
- domesticScheduledFlight: 'Domestic scheduled flight'
- shuttleFlight: 'Shuttle flight'
- intercontinentalCharterFlight: "Intercontinental charter flight"
- internationalCharterFlight: "International charter flight"
- roundTripCharterFlight: "Roundtrip charter flight"
- sightseeingFlight: 'Sightseeing flight'
- helicopterService: "Helicopter service"
- domesticCharterFlight: "Domestic charter flight"
- SchengenAreaFlight: 'Schengen area flight'
- airshipService: 'Airship service'
- shortHaulInternationalFlight: 'Short haul international flight'
- canalBarge: 'Canal barge'
- localBus: 'Local bus'
- regionalBus: 'Regional bus'
- expressBus: 'Express bus'
- nightBus: 'Night bus'
- postBus: 'Post but'
- specialNeedsBus: 'Special needs bus'
- mobilityBus: 'Mobility bus'
- mobilityBusForRegisteredDisabled: 'Mobility bus for registered disabled'
- sightseeingBus: 'sightseeingBus'
- shuttleBus: 'Shuttle bus'
- highFrequencyBus: 'High frequency bus'
- dedicatedLaneBus: 'Dedicated lane bus'
- schoolBus: 'School bus'
- schoolAndPublicServiceBus: 'School and public service bus'
- railReplacementBus: 'Rail replacement bus'
- demandAndResponseBus: 'Demand and response bus'
- airportLinkBus: 'Airport link bus'
- internationalCoach: 'International coach'
- nationalCoach: 'National coach'
- shuttleCoach: 'Shuttle coach'
- regionalCoach: 'Regional coach'
- specialCoach: 'Special coach'
- schoolCoach: 'School coach'
- sightseeingCoach: 'Sightseeing coach'
- touristCoach: 'Tourist coach'
- commuterCoach: 'Commuter coach'
- metro: 'Metro'
- tube: 'Tube'
- urbanRailway: 'Urban railway'
- local: 'Local'
- highSpeedRail: 'High speed rail'
- suburbanRailway: 'Suburban railway'
- regionalRail: 'Regional rail'
- interregionalRail: 'Interregional rail'
- longDistance: 'Long distance'
- intermational: 'International'
- sleeperRailService: 'Sleeper rail service'
- nightRail: 'Night rail'
- carTransportRailService: 'Car transport rail service'
- touristRailway: 'Tourist railway'
- railShuttle: 'Rail shuttle'
- replacementRailService: 'Replacement rail service'
- specialTrain: 'Special train'
- crossCountryRail: 'Cross country rail'
- rackAndPinionRailway: 'Rack and pinion railway'
- cityTram: 'City tram'
- localTram: 'Local tram'
- regionalTram: 'Regional tram'
- sightseeingTram: 'Sightseeing tram'
- shuttleTram: 'Shuttle tram'
- trainTram: 'Train tram'
- internationalCarFerry: 'International car ferry'
- nationalCarFerry: 'National car ferry'
- regionalCarFerry: 'Regional car ferry'
- localCarFerry: 'Local car ferry'
- internationalPassengerFerry: 'International passenger ferry'
- nationalPassengerFerry: 'National passenger ferry'
- regionalPassengerFerry: 'Regional passenger ferry'
- localPassengerFerry: 'Local passenger ferry'
- postBoat: 'Post boat'
- trainFerry: 'Train ferry'
- roadFerryLink: 'Road ferry link'
- airportBoatLink: "Airport boat link"
- highSpeedVehicleService: 'High speed vehicle service'
- highSpeedPassengerService: 'High speed passenger service'
- sightseeingService: 'Sightseeing service'
- schoolBoat: 'School boat'
- cableFerry: 'Cable ferry'
- riverBus: 'River bus'
- scheduledFerry: 'Scheduled ferry'
- shuttleFerryService: 'Shuttle ferry service'
- telecabin: 'Telecabin'
- cableCar: 'Cable car'
- lift: 'Lift'
- chairLift: 'Chair lift'
- dragLift: 'Drag lift'
- telecabinLink: 'Telecabin link'
- funicular: 'Funicular'
- streetCableCar: 'Street cable car'
- allFunicularServices: 'All funicular services'
- undefinedFunicular: 'Undefined funicular'
+ transport_mode:
+ interchange: Interchange
+ unknown: "unknown"
+ undefined: "undefined"
+ air: "Air"
+ train: "Train"
+ long_distance_train: "Long distance train"
+ local_train: "Local train"
+ rapid_transit: "Rapid transit"
+ metro: "Metro"
+ tramway: "Tramway"
+ coach: "Coach"
+ bus: "Bus"
+ ferry: "Ferry"
+ waterborne: "Waterborne"
+ private_vehicle: "Private vehicle"
+ walk: "Walk"
+ trolleyBus: "Trolleybus"
+ bicycle: "Bicycle"
+ shuttle: "Shuttle"
+ taxi: "Taxi"
+ val: "VAL"
+ other: "Other"
+ air: Air
+ bus: Bus
+ coach: Coach
+ ferry: Ferry
+ metro: Metro
+ rail: Rail
+ trolleybus: Trolleybus
+ tram: Tramway
+ water: Water
+ cableway: Cableway
+ funicular: Funicular
+ other: Other
+ transport_submode:
+ unknown: 'Unknown'
+ undefined: 'Undefined'
+ internationalFlight: 'International flight'
+ domesticFlight: 'Domestic flight'
+ intercontinentalFlight: 'Intercontinental flight'
+ domesticScheduledFlight: 'Domestic scheduled flight'
+ shuttleFlight: 'Shuttle flight'
+ intercontinentalCharterFlight: "Intercontinental charter flight"
+ internationalCharterFlight: "International charter flight"
+ roundTripCharterFlight: "Roundtrip charter flight"
+ sightseeingFlight: 'Sightseeing flight'
+ helicopterService: "Helicopter service"
+ domesticCharterFlight: "Domestic charter flight"
+ SchengenAreaFlight: 'Schengen area flight'
+ airshipService: 'Airship service'
+ shortHaulInternationalFlight: 'Short haul international flight'
+ canalBarge: 'Canal barge'
+ localBus: 'Local bus'
+ regionalBus: 'Regional bus'
+ expressBus: 'Express bus'
+ nightBus: 'Night bus'
+ postBus: 'Post but'
+ specialNeedsBus: 'Special needs bus'
+ mobilityBus: 'Mobility bus'
+ mobilityBusForRegisteredDisabled: 'Mobility bus for registered disabled'
+ sightseeingBus: 'sightseeingBus'
+ shuttleBus: 'Shuttle bus'
+ highFrequencyBus: 'High frequency bus'
+ dedicatedLaneBus: 'Dedicated lane bus'
+ schoolBus: 'School bus'
+ schoolAndPublicServiceBus: 'School and public service bus'
+ railReplacementBus: 'Rail replacement bus'
+ demandAndResponseBus: 'Demand and response bus'
+ airportLinkBus: 'Airport link bus'
+ internationalCoach: 'International coach'
+ nationalCoach: 'National coach'
+ shuttleCoach: 'Shuttle coach'
+ regionalCoach: 'Regional coach'
+ specialCoach: 'Special coach'
+ schoolCoach: 'School coach'
+ sightseeingCoach: 'Sightseeing coach'
+ touristCoach: 'Tourist coach'
+ commuterCoach: 'Commuter coach'
+ metro: 'Metro'
+ tube: 'Tube'
+ urbanRailway: 'Urban railway'
+ local: 'Local'
+ highSpeedRail: 'High speed rail'
+ suburbanRailway: 'Suburban railway'
+ regionalRail: 'Regional rail'
+ interregionalRail: 'Interregional rail'
+ longDistance: 'Long distance'
+ intermational: 'International'
+ sleeperRailService: 'Sleeper rail service'
+ nightRail: 'Night rail'
+ carTransportRailService: 'Car transport rail service'
+ touristRailway: 'Tourist railway'
+ railShuttle: 'Rail shuttle'
+ replacementRailService: 'Replacement rail service'
+ specialTrain: 'Special train'
+ crossCountryRail: 'Cross country rail'
+ rackAndPinionRailway: 'Rack and pinion railway'
+ cityTram: 'City tram'
+ localTram: 'Local tram'
+ regionalTram: 'Regional tram'
+ sightseeingTram: 'Sightseeing tram'
+ shuttleTram: 'Shuttle tram'
+ trainTram: 'Train tram'
+ internationalCarFerry: 'International car ferry'
+ nationalCarFerry: 'National car ferry'
+ regionalCarFerry: 'Regional car ferry'
+ localCarFerry: 'Local car ferry'
+ internationalPassengerFerry: 'International passenger ferry'
+ nationalPassengerFerry: 'National passenger ferry'
+ regionalPassengerFerry: 'Regional passenger ferry'
+ localPassengerFerry: 'Local passenger ferry'
+ postBoat: 'Post boat'
+ trainFerry: 'Train ferry'
+ roadFerryLink: 'Road ferry link'
+ airportBoatLink: "Airport boat link"
+ highSpeedVehicleService: 'High speed vehicle service'
+ highSpeedPassengerService: 'High speed passenger service'
+ sightseeingService: 'Sightseeing service'
+ schoolBoat: 'School boat'
+ cableFerry: 'Cable ferry'
+ riverBus: 'River bus'
+ scheduledFerry: 'Scheduled ferry'
+ shuttleFerryService: 'Shuttle ferry service'
+ telecabin: 'Telecabin'
+ cableCar: 'Cable car'
+ lift: 'Lift'
+ chairLift: 'Chair lift'
+ dragLift: 'Drag lift'
+ telecabinLink: 'Telecabin link'
+ funicular: 'Funicular'
+ streetCableCar: 'Street cable car'
+ allFunicularServices: 'All funicular services'
+ undefinedFunicular: 'Undefined funicular'
diff --git a/config/locales/enumerize.fr.yml b/config/locales/enumerize.fr.yml
index b183d80e0..115112208 100644
--- a/config/locales/enumerize.fr.yml
+++ b/config/locales/enumerize.fr.yml
@@ -109,138 +109,136 @@ fr:
between: Entre deux dates
before: Avant une date
after: Après une date
- line:
- transport_mode:
- interchange: Interconnection
- unknown: Inconnu
- undefined: 'Non défini'
- air: Air
- train: Train
- long_distance_train: Train Grande Ligne
- local_train: TER
- rapid_transit: RER
- metro: Métro
- tramway: Tramway
- coach: Autocar
- bus: Bus
- ferry: Ferry
- waterborne: Bac
- private_vehicle: Voiture particulière
- walk: Marche à pied
- trolleyBus: Trolleybus
- bicycle: Vélo
- shuttle: Navette
- taxi: Taxi
- val: VAL
- other: Autre
- bus: Bus
- coach: Autocar
- ferry: Ferry
- metro: Métro
- rail: Train
- trolleybus: Trolleybus
- tram: Tramway
- water: Eau
- cableway: Téléphérique
- funicular: Funiculaire
- other: Autre
-
- transport_submode:
- unknown: 'Inconnu'
- undefined: 'Non défini'
- internationalFlight: 'Vol international'
- domesticFlight: 'Vol intérieur'
- intercontinentalFlight: 'Vol intercontinental'
- domesticScheduledFlight: 'Vol intérieur régulier'
- shuttleFlight: 'Vol de navette'
- intercontinentalCharterFlight: "Vol 'charter' intercontinental"
- internationalCharterFlight: "Vol 'charter' international"
- roundTripCharterFlight: "Vol 'charter' aller/retour"
- sightseeingFlight: 'Vol tourisme'
- helicopterService: "Service d'hélicoptère"
- domesticCharterFlight: "Vol 'charter' intérieur"
- SchengenAreaFlight: 'Vol de zone Shengen'
- airshipService: 'Service de dirigeable'
- shortHaulInternationalFlight: 'Vol international à courte distance'
- canalBarge: 'Péniche'
- localBus: 'Bus local'
- regionalBus: 'Bus régional'
- expressBus: 'Bus express'
- nightBus: 'Bus de nuit'
- postBus: 'Bus postal'
- specialNeedsBus: 'Bus de besoins spécial'
- mobilityBus: 'Bus de mobilité'
- mobilityBusForRegisteredDisabled: 'Bus de mobilité pour personnes handicapées'
- sightseeingBus: 'Bus touristique'
- shuttleBus: 'Bus navette'
- highFrequencyBus: 'Bus à haute fréquence'
- dedicatedLaneBus: 'Bus à voie réservée'
- schoolBus: 'Bus scolaire'
- schoolAndPublicServiceBus: 'Bus scolaire/service public'
- railReplacementBus: 'Bus de remplacement de train'
- demandAndResponseBus: 'Bus demande/réponse'
- airportLinkBus: 'Bus de liaison aéroport'
- internationalCoach: 'Autocar international'
- nationalCoach: 'Autocar national'
- shuttleCoach: 'Autocar navette'
- regionalCoach: 'Autocar régional'
- specialCoach: 'Autocar spécial'
- schoolCoach: 'Autocar scolaire'
- sightseeingCoach: 'Autocar touristique'
- touristCoach: 'Autocar touristique (2)'
- commuterCoach: 'Autocar de banlieue'
- metro: 'Métro'
- tube: 'Métro (2)'
- urbanRailway: 'Train urbain'
- local: 'Local'
- highSpeedRail: 'Train à grande vitesse'
- suburbanRailway: 'Train de banlieue'
- regionalRail: 'Train régional'
- interregionalRail: 'Train interrégional'
- longDistance: 'Longue distance'
- intermational: Internationale
- sleeperRailService: 'Train à couchettes'
- nightRail: 'Train de nuit'
- carTransportRailService: 'Service ferroviaire de transport de voitures'
- touristRailway: 'Train touristique'
- railShuttle: 'Navette ferroviaire'
- replacementRailService: 'Service de train de remplacement'
- specialTrain: 'Train spécial'
- crossCountryRail: 'Train de campagne'
- rackAndPinionRailway: 'Train à crémaillère'
- cityTram: 'Tramway de ville'
- localTram: 'Tramway local'
- regionalTram: 'Tramway régional'
- sightseeingTram: 'Tramway touristique'
- shuttleTram: 'Tramway navette'
- trainTram: 'Train/tramway'
- internationalCarFerry: 'Ferry international'
- nationalCarFerry: 'Ferry national'
- regionalCarFerry: 'Ferry régional'
- localCarFerry: 'Ferry local'
- internationalPassengerFerry: 'Traversier international à passagers'
- nationalPassengerFerry: 'Traversier national à passagers'
- regionalPassengerFerry: 'Traversier régional à passagers'
- localPassengerFerry: 'Traversier local à passagers'
- postBoat: 'Bateau de poste'
- trainFerry: 'Navire transbordeur'
- roadFerryLink: 'Liaison par navire transbordeur'
- airportBoatLink: "Liaison maritime d'aéroport"
- highSpeedVehicleService: 'Service de véhicule à grande vitesse'
- highSpeedPassengerService: 'Service passager à grande vitesse'
- sightseeingService: 'Service touristique'
- schoolBoat: 'Bateau scolaire'
- cableFerry: 'Traversier à câble'
- riverBus: 'Bateau-bus'
- scheduledFerry: 'Traversier régulier'
- shuttleFerryService: 'Service de traversier-navette'
- telecabin: 'Télécabine'
- cableCar: 'Téléphérique'
- lift: 'Ascenseur'
- chairLift: 'Télésiège'
- dragLift: 'Téléski'
- telecabinLink: 'Liaison télécabine'
- funicular: 'Funiculaire'
- streetCableCar: 'Tramway (2)'
- allFunicularServices: 'Tous services de funiculaire'
- undefinedFunicular: 'Funiculaire non défini'
+ transport_mode:
+ interchange: Interconnection
+ unknown: Inconnu
+ undefined: 'Non défini'
+ air: Air
+ train: Train
+ long_distance_train: Train Grande Ligne
+ local_train: TER
+ rapid_transit: RER
+ metro: Métro
+ tramway: Tramway
+ coach: Autocar
+ bus: Bus
+ ferry: Ferry
+ waterborne: Bac
+ private_vehicle: Voiture particulière
+ walk: Marche à pied
+ trolleyBus: Trolleybus
+ bicycle: Vélo
+ shuttle: Navette
+ taxi: Taxi
+ val: VAL
+ other: Autre
+ bus: Bus
+ coach: Autocar
+ ferry: Ferry
+ metro: Métro
+ rail: Train
+ trolleybus: Trolleybus
+ tram: Tramway
+ water: Eau
+ cableway: Téléphérique
+ funicular: Funiculaire
+ other: Autre
+ transport_submode:
+ unknown: 'Inconnu'
+ undefined: 'Non défini'
+ internationalFlight: 'Vol international'
+ domesticFlight: 'Vol intérieur'
+ intercontinentalFlight: 'Vol intercontinental'
+ domesticScheduledFlight: 'Vol intérieur régulier'
+ shuttleFlight: 'Vol de navette'
+ intercontinentalCharterFlight: "Vol 'charter' intercontinental"
+ internationalCharterFlight: "Vol 'charter' international"
+ roundTripCharterFlight: "Vol 'charter' aller/retour"
+ sightseeingFlight: 'Vol tourisme'
+ helicopterService: "Service d'hélicoptère"
+ domesticCharterFlight: "Vol 'charter' intérieur"
+ SchengenAreaFlight: 'Vol de zone Shengen'
+ airshipService: 'Service de dirigeable'
+ shortHaulInternationalFlight: 'Vol international à courte distance'
+ canalBarge: 'Péniche'
+ localBus: 'Bus local'
+ regionalBus: 'Bus régional'
+ expressBus: 'Bus express'
+ nightBus: 'Bus de nuit'
+ postBus: 'Bus postal'
+ specialNeedsBus: 'Bus de besoins spécial'
+ mobilityBus: 'Bus de mobilité'
+ mobilityBusForRegisteredDisabled: 'Bus de mobilité pour personnes handicapées'
+ sightseeingBus: 'Bus touristique'
+ shuttleBus: 'Bus navette'
+ highFrequencyBus: 'Bus à haute fréquence'
+ dedicatedLaneBus: 'Bus à voie réservée'
+ schoolBus: 'Bus scolaire'
+ schoolAndPublicServiceBus: 'Bus scolaire/service public'
+ railReplacementBus: 'Bus de remplacement de train'
+ demandAndResponseBus: 'Bus demande/réponse'
+ airportLinkBus: 'Bus de liaison aéroport'
+ internationalCoach: 'Autocar international'
+ nationalCoach: 'Autocar national'
+ shuttleCoach: 'Autocar navette'
+ regionalCoach: 'Autocar régional'
+ specialCoach: 'Autocar spécial'
+ schoolCoach: 'Autocar scolaire'
+ sightseeingCoach: 'Autocar touristique'
+ touristCoach: 'Autocar touristique (2)'
+ commuterCoach: 'Autocar de banlieue'
+ metro: 'Métro'
+ tube: 'Métro (2)'
+ urbanRailway: 'Train urbain'
+ local: 'Local'
+ highSpeedRail: 'Train à grande vitesse'
+ suburbanRailway: 'Train de banlieue'
+ regionalRail: 'Train régional'
+ interregionalRail: 'Train interrégional'
+ longDistance: 'Longue distance'
+ intermational: Internationale
+ sleeperRailService: 'Train à couchettes'
+ nightRail: 'Train de nuit'
+ carTransportRailService: 'Service ferroviaire de transport de voitures'
+ touristRailway: 'Train touristique'
+ railShuttle: 'Navette ferroviaire'
+ replacementRailService: 'Service de train de remplacement'
+ specialTrain: 'Train spécial'
+ crossCountryRail: 'Train de campagne'
+ rackAndPinionRailway: 'Train à crémaillère'
+ cityTram: 'Tramway de ville'
+ localTram: 'Tramway local'
+ regionalTram: 'Tramway régional'
+ sightseeingTram: 'Tramway touristique'
+ shuttleTram: 'Tramway navette'
+ trainTram: 'Train/tramway'
+ internationalCarFerry: 'Ferry international'
+ nationalCarFerry: 'Ferry national'
+ regionalCarFerry: 'Ferry régional'
+ localCarFerry: 'Ferry local'
+ internationalPassengerFerry: 'Traversier international à passagers'
+ nationalPassengerFerry: 'Traversier national à passagers'
+ regionalPassengerFerry: 'Traversier régional à passagers'
+ localPassengerFerry: 'Traversier local à passagers'
+ postBoat: 'Bateau de poste'
+ trainFerry: 'Navire transbordeur'
+ roadFerryLink: 'Liaison par navire transbordeur'
+ airportBoatLink: "Liaison maritime d'aéroport"
+ highSpeedVehicleService: 'Service de véhicule à grande vitesse'
+ highSpeedPassengerService: 'Service passager à grande vitesse'
+ sightseeingService: 'Service touristique'
+ schoolBoat: 'Bateau scolaire'
+ cableFerry: 'Traversier à câble'
+ riverBus: 'Bateau-bus'
+ scheduledFerry: 'Traversier régulier'
+ shuttleFerryService: 'Service de traversier-navette'
+ telecabin: 'Télécabine'
+ cableCar: 'Téléphérique'
+ lift: 'Ascenseur'
+ chairLift: 'Télésiège'
+ dragLift: 'Téléski'
+ telecabinLink: 'Liaison télécabine'
+ funicular: 'Funiculaire'
+ streetCableCar: 'Tramway (2)'
+ allFunicularServices: 'Tous services de funiculaire'
+ undefinedFunicular: 'Funiculaire non défini'
diff --git a/config/locales/stif.fr.yml b/config/locales/stif.fr.yml
new file mode 100644
index 000000000..4c2ecc951
--- /dev/null
+++ b/config/locales/stif.fr.yml
@@ -0,0 +1,12 @@
+fr:
+ stif:
+ dashboards:
+ dashboard:
+ subtitle: "Offres de transport"
+ organisation: "Offres de mon organisation"
+ idf: "Offres IDF"
+ api_keys: "Clés d'API"
+ referentials: "Jeux de données"
+ calendars: "Calendriers"
+ see: "Voir la liste"
+ no_content: "Aucun contenu pour le moment"
diff --git a/config/locales/workbenches.fr.yml b/config/locales/workbenches.fr.yml
index f361251a0..7a614efc5 100644
--- a/config/locales/workbenches.fr.yml
+++ b/config/locales/workbenches.fr.yml
@@ -1,16 +1,5 @@
fr:
workbenches:
- index:
- title: "Tableau de bord %{organisation}"
- offers:
- title: "Offres de transport"
- organisation: "Offres de mon organisation"
- idf: "Offres IDF"
- api_keys: "Clés d'API"
- referentials: "Jeux de données"
- calendars: "Calendriers"
- see: "Voir la liste"
- no_content: "Aucun contenu pour le moment"
referential_count:
zero: "Aucun jeu de données à l'heure actuelle"
one: "1 jeu de données à l'heure actuelle"
diff --git a/config/routes.rb b/config/routes.rb
index cc3896da9..b9e318f91 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -1,6 +1,8 @@
require 'sidekiq/web'
ChouetteIhm::Application.routes.draw do
+ resource :dashboard
+
resources :workbenches, only: [:show, :index] do
delete :referentials, on: :member, action: :delete_referentials
resources :imports do
@@ -216,7 +218,7 @@ ChouetteIhm::Application.routes.draw do
end
end
- root :to => "workbenches#index"
+ root :to => "dashboards#show"
get '/help/(*slug)' => 'help#show'
diff --git a/db/migrate/20171002080526_add_compliance_check_set_to_compliance_check_message.rb b/db/migrate/20171002080526_add_compliance_check_set_to_compliance_check_message.rb
new file mode 100644
index 000000000..74f74a858
--- /dev/null
+++ b/db/migrate/20171002080526_add_compliance_check_set_to_compliance_check_message.rb
@@ -0,0 +1,5 @@
+class AddComplianceCheckSetToComplianceCheckMessage < ActiveRecord::Migration
+ def change
+ add_reference :compliance_check_messages, :compliance_check_set, index: true, foreign_key: true
+ end
+end
diff --git a/db/schema.rb b/db/schema.rb
index 3593576de..443fe0579 100644
--- a/db/schema.rb
+++ b/db/schema.rb
@@ -11,7 +11,11 @@
#
# It's strongly recommended that you check this file into your version control system.
+<<<<<<< HEAD
ActiveRecord::Schema.define(version: 20170928144740) do
+=======
+ActiveRecord::Schema.define(version: 20171002080526) do
+>>>>>>> eaf5b3fd868d68856ef94e18656dac39096d866b
# These are extensions that must be enabled in order to support this database
enable_extension "plpgsql"
@@ -164,10 +168,15 @@ ActiveRecord::Schema.define(version: 20170928144740) do
t.datetime "created_at", null: false
t.datetime "updated_at", null: false
t.string "status"
+<<<<<<< HEAD
+=======
+ t.integer "compliance_check_set_id"
+>>>>>>> eaf5b3fd868d68856ef94e18656dac39096d866b
end
add_index "compliance_check_messages", ["compliance_check_id"], name: "index_compliance_check_messages_on_compliance_check_id", using: :btree
add_index "compliance_check_messages", ["compliance_check_resource_id"], name: "index_compliance_check_messages_on_compliance_check_resource_id", using: :btree
+ add_index "compliance_check_messages", ["compliance_check_set_id"], name: "index_compliance_check_messages_on_compliance_check_set_id", using: :btree
create_table "compliance_check_resources", id: :bigserial, force: :cascade do |t|
t.string "status"
@@ -400,9 +409,9 @@ ActiveRecord::Schema.define(version: 20170928144740) do
t.string "type"
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
@@ -986,6 +995,7 @@ ActiveRecord::Schema.define(version: 20170928144740) do
add_foreign_key "api_keys", "organisations"
add_foreign_key "compliance_check_blocks", "compliance_check_sets"
add_foreign_key "compliance_check_messages", "compliance_check_resources"
+ 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"
diff --git a/lib/stif/dashboard.rb b/lib/stif/dashboard.rb
new file mode 100644
index 000000000..fafddec62
--- /dev/null
+++ b/lib/stif/dashboard.rb
@@ -0,0 +1,15 @@
+module Stif
+ class Dashboard < ::Dashboard
+ def workbench
+ @workbench ||= current_organisation.workbenches.find_by(name: "Gestion de l'offre")
+ end
+
+ def referentials
+ @referentials ||= @workbench.all_referentials
+ end
+
+ def calendars
+ @calendars ||= Calendar.where('organisation_id = ? OR shared = ?', current_organisation.id, true)
+ end
+ end
+end
diff --git a/spec/controllers/rule_parameter_sets_controller_spec.rb b/spec/controllers/rule_parameter_sets_controller_spec.rb
index a1d65e92e..0f57855b7 100644
--- a/spec/controllers/rule_parameter_sets_controller_spec.rb
+++ b/spec/controllers/rule_parameter_sets_controller_spec.rb
@@ -1,8 +1,8 @@
-require 'spec_helper'
+# require 'spec_helper'
-describe RuleParameterSetsController, :type => :controller do
- login_user
- let(:mode){"air"}
+# describe RuleParameterSetsController, :type => :controller do
+# login_user
+# let(:mode){"air"}
# shared_examples_for "organisation dependant" do
# it "assigns rule_parameter_set.organisation as current organisation" do
@@ -10,17 +10,17 @@ describe RuleParameterSetsController, :type => :controller do
# end
# end
- describe "GET /index" do
- before(:each) do
- get :index
- end
- it "should assign rule_parameter_sets to organisation rule_parameter_sets" do
- expect(assigns[:rule_parameter_sets].size).to eq(assigns[:rule_parameter_sets][0].organisation.rule_parameter_sets.size)
- assigns[:rule_parameter_sets].each do |rps|
- expect(rps.organisation.id).to eq(assigns[:rule_parameter_sets][0].organisation.id)
- end
- end
- end
+ # describe "GET /index" do
+ # before(:each) do
+ # get :index
+ # end
+ # it "should assign rule_parameter_sets to organisation rule_parameter_sets" do
+ # expect(assigns[:rule_parameter_sets].size).to eq(assigns[:rule_parameter_sets][0].organisation.rule_parameter_sets.size)
+ # assigns[:rule_parameter_sets].each do |rps|
+ # expect(rps.organisation.id).to eq(assigns[:rule_parameter_sets][0].organisation.id)
+ # end
+ # end
+ # end
# describe "GET /new" do
# before(:each) do
@@ -33,4 +33,4 @@ describe RuleParameterSetsController, :type => :controller do
# end
# end
# end
-end
+# end
diff --git a/spec/factories/compliance_check_messages.rb b/spec/factories/compliance_check_messages.rb
index a0d45eb50..e015fb121 100644
--- a/spec/factories/compliance_check_messages.rb
+++ b/spec/factories/compliance_check_messages.rb
@@ -2,6 +2,7 @@ FactoryGirl.define do
factory :compliance_check_message do
association :compliance_check
association :compliance_check_resource
+ association :compliance_check_set
status 'OK'
message_key "message_key"
end
diff --git a/spec/factories/compliance_control_blocks.rb b/spec/factories/compliance_control_blocks.rb
index 5bc45cc75..4785d8419 100644
--- a/spec/factories/compliance_control_blocks.rb
+++ b/spec/factories/compliance_control_blocks.rb
@@ -1,6 +1,7 @@
FactoryGirl.define do
factory :compliance_control_block do
sequence(:name) { |n| "Compliance control block #{n}" }
+ transport_mode "air"
association :compliance_control_set
end
end
diff --git a/spec/features/api_keys/delete_api_key_feature_spec.rb b/spec/features/api_keys/delete_api_key_feature_spec.rb
index b58e819a6..6bfc686af 100644
--- a/spec/features/api_keys/delete_api_key_feature_spec.rb
+++ b/spec/features/api_keys/delete_api_key_feature_spec.rb
@@ -10,7 +10,7 @@ RSpec.describe 'New API Key', type: :feature do
xit 'complete workflow' do
# /workbenches
- visit workbenches_path
+ visit dashboard_path
# the api_key is visible
click_link edit_label
@@ -23,7 +23,7 @@ RSpec.describe 'New API Key', type: :feature do
# expect(Api::V1::ApiKey.where(id: api_key.id)).to be_empty
# # check redirect and changed display
- # expect(page.current_path).to eq(workbenches_path)
+ # expect(page.current_path).to eq(dashboard_path)
# # deleted api_key's not shown anymore
# expect( page ).not_to have_content(edit_label)
end
@@ -31,4 +31,3 @@ RSpec.describe 'New API Key', type: :feature do
end
end
-
diff --git a/spec/features/api_keys/edit_api_key_feature_spec.rb b/spec/features/api_keys/edit_api_key_feature_spec.rb
index 411c11aaf..256c4218b 100644
--- a/spec/features/api_keys/edit_api_key_feature_spec.rb
+++ b/spec/features/api_keys/edit_api_key_feature_spec.rb
@@ -1,4 +1,4 @@
-RSpec.describe 'New API Key', type: :feature do
+RSpec.describe 'Edit API Key', type: :feature do
login_user
describe "api_keys#edit" do
@@ -12,8 +12,7 @@ RSpec.describe 'New API Key', type: :feature do
let( :unique_name ){ SecureRandom.uuid }
it 'complete workflow' do
- # /workbenches
- visit workbenches_path
+ visit dashboard_path
# api_key's new name does not exist yet
expect( page ).not_to have_content(unique_name)
# the api_key is visible
@@ -28,7 +27,7 @@ RSpec.describe 'New API Key', type: :feature do
expect(api_key.reload.name).to eq(unique_name)
# check redirect and changed display
- expect(page.current_path).to eq(workbenches_path)
+ expect(page.current_path).to eq(dashboard_path)
# changed api_key's name exists now
expect( page ).to have_content(unique_name)
end
@@ -36,4 +35,3 @@ RSpec.describe 'New API Key', type: :feature do
end
end
-
diff --git a/spec/features/api_keys/new_api_key_feature_spec.rb b/spec/features/api_keys/new_api_key_feature_spec.rb
index eba873691..988690f3c 100644
--- a/spec/features/api_keys/new_api_key_feature_spec.rb
+++ b/spec/features/api_keys/new_api_key_feature_spec.rb
@@ -1,3 +1,4 @@
+# coding: utf-8
RSpec.describe 'New API Key', type: :feature do
login_user
@@ -13,21 +14,21 @@ RSpec.describe 'New API Key', type: :feature do
it 'complete workflow' do
# /workbenches
- visit workbenches_path
+ visit dashboard_path
expect(page).to have_link(create_label, href: new_api_key_path)
# to be created api_key does not exist yet
expect( page ).not_to have_content(unique_name)
# /api_keys/new
- click_link create_label
- fill_in(name_label, with: unique_name)
+ click_link create_label
+ fill_in(name_label, with: unique_name)
click_button validate_label
# check impact on DB
expect(last_api_key.name).to eq(unique_name)
# check redirect and changed display
- expect(page.current_path).to eq(workbenches_path)
+ expect(page.current_path).to eq(dashboard_path)
# to be created api_key exists now
expect( page ).to have_content(unique_name)
end
@@ -35,4 +36,3 @@ RSpec.describe 'New API Key', type: :feature do
end
end
-
diff --git a/spec/models/chouette/transport_mode_spec.rb b/spec/models/chouette/transport_mode_spec.rb
deleted file mode 100644
index 8f2b2eddb..000000000
--- a/spec/models/chouette/transport_mode_spec.rb
+++ /dev/null
@@ -1,64 +0,0 @@
-require 'spec_helper'
-
-describe Chouette::TransportMode, :type => :model do
-
- def mode(text_code = "test", numerical_code = nil)
- numerical_code ||= 1 if text_code == "test"
- Chouette::TransportMode.new(text_code, numerical_code)
- end
-
- describe "#to_i" do
-
- it "should return numerical code" do
- expect(mode("test", 1).to_i).to eq(1)
- end
-
- end
-
- it "should return true to #test? when text code is 'test'" do
- expect(mode("test")).to be_test
- end
-
- it "should be equal when text codes are identical" do
- expect(mode("test",1)).to eq(mode("test", 2))
- end
-
- describe ".new" do
-
- it "should find numerical code from text code" do
- expect(mode("unknown").to_i).to eq(0)
- end
-
- it "should find text code from numerical code" do
- expect(mode(0)).to be_unknown
- end
-
- it "should accept another mode" do
- expect(Chouette::TransportMode.new(mode("test"))).to eq(mode("test"))
- end
-
- end
-
- describe "#public_transport?" do
-
- it "should return false for interchange" do
- expect(mode("interchange")).not_to be_public_transport
- end
-
- it "should return true for other modes" do
- expect(mode("unknown")).to be_public_transport
- end
-
- end
-
- describe ".all" do
-
- Chouette::TransportMode.definitions.each do |text_code, numerical_code|
- it "should include a TransportMode #{text_code}" do
- expect(Chouette::TransportMode.all).to include(Chouette::TransportMode.new(text_code))
- end
- end
-
- end
-
-end
diff --git a/spec/models/compliance_check_message_spec.rb b/spec/models/compliance_check_message_spec.rb
index 8b424595e..7c8f05953 100644
--- a/spec/models/compliance_check_message_spec.rb
+++ b/spec/models/compliance_check_message_spec.rb
@@ -7,4 +7,5 @@ RSpec.describe ComplianceCheckMessage, type: :model do
it { should belong_to :compliance_check }
it { should belong_to :compliance_check_resource }
+ it { should belong_to :compliance_check_set }
end
diff --git a/spec/models/compliance_control_block_spec.rb b/spec/models/compliance_control_block_spec.rb
index a50fe026b..c7440a5eb 100644
--- a/spec/models/compliance_control_block_spec.rb
+++ b/spec/models/compliance_control_block_spec.rb
@@ -9,4 +9,5 @@ RSpec.describe ComplianceControlBlock, type: :model do
it { should belong_to :compliance_control_set }
it { should have_many(:compliance_controls).dependent(:destroy) }
+ it { should validate_presence_of(:transport_mode) }
end
diff --git a/spec/models/line_referential_spec.rb b/spec/models/line_referential_spec.rb
index 8472faaa0..07725d9e6 100644
--- a/spec/models/line_referential_spec.rb
+++ b/spec/models/line_referential_spec.rb
@@ -12,7 +12,7 @@ RSpec.describe LineReferential, :type => :model do
describe "#transport_modes" do
it 'returns a list of all transport modes' do
- expect(FactoryGirl.create(:line_referential).transport_modes).to eq( Chouette::TransportMode.all.select { |tm| tm.to_i > 0 } )
+ expect(FactoryGirl.create(:line_referential).transport_modes).to match_array(StifTransportModeEnumerations.transport_mode.options.map(&:first) )
end
end
end
diff --git a/spec/models/organisation_spec.rb b/spec/models/organisation_spec.rb
index b16324a56..1217666f7 100644
--- a/spec/models/organisation_spec.rb
+++ b/spec/models/organisation_spec.rb
@@ -6,10 +6,10 @@ describe Organisation, :type => :model do
expect(FactoryGirl.build(:organisation)).to be_valid
end
- it "create a rule_parameter_set" do
- organisation = create(:organisation)
- expect(organisation.rule_parameter_sets.size).to eq(1)
- end
+ # it "create a rule_parameter_set" do
+ # organisation = create(:organisation)
+ # expect(organisation.rule_parameter_sets.size).to eq(1)
+ # end
describe "Portail sync" do
let(:conf) { Rails.application.config.stif_portail_api }
diff --git a/spec/models/vehicle_translation_spec.rb b/spec/models/vehicle_translation_spec.rb
index d30cfa03e..4bbff7f49 100644
--- a/spec/models/vehicle_translation_spec.rb
+++ b/spec/models/vehicle_translation_spec.rb
@@ -9,7 +9,7 @@ describe VehicleTranslation, :type => :model do
:journey_pattern => journey_pattern,
:route => journey_pattern.route,
# :company => company,
- :transport_mode => Chouette::TransportMode.new("metro"),
+ :transport_mode => "metro",
:published_journey_name => "dummy"
)}
subject {build(:vehicle_translation,