aboutsummaryrefslogtreecommitdiffstats
path: root/app
diff options
context:
space:
mode:
Diffstat (limited to 'app')
-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
34 files changed, 231 insertions, 161 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')