aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobert2017-10-30 17:59:26 +0100
committerXinhui2017-11-03 12:26:42 +0100
commitd6213f724633abfa2f899715b6f686d8972fe7e1 (patch)
treee5263df8fca1651797f706461a1e21ba0f9abb0d
parentf95e4360bc559cec31a5e83de4dda8119a74c23d (diff)
downloadchouette-core-d6213f724633abfa2f899715b6f686d8972fe7e1.tar.bz2
Refs: #4774@2h;
View correctly implemented, but spex on filters do not work yet.
-rw-r--r--app/helpers/compliance_controls_helper.rb9
-rw-r--r--app/views/compliance_controls/_filters.html.slim9
-rw-r--r--config/locales/compliance_controls.en.yml9
-rw-r--r--config/locales/compliance_controls.fr.yml9
4 files changed, 34 insertions, 2 deletions
diff --git a/app/helpers/compliance_controls_helper.rb b/app/helpers/compliance_controls_helper.rb
index ee7e56514..ba0c538c9 100644
--- a/app/helpers/compliance_controls_helper.rb
+++ b/app/helpers/compliance_controls_helper.rb
@@ -1,2 +1,11 @@
module ComplianceControlsHelper
+ def subclass_selection_list
+ ComplianceControl.subclass_patterns.map(&method(:make_subclass_selection_item))
+ end
+
+
+ def make_subclass_selection_item(key_pattern)
+ key, pattern = key_pattern
+ [t("compliance_controls.filters.subclasses.#{key}"), "-#{pattern}-"]
+ end
end
diff --git a/app/views/compliance_controls/_filters.html.slim b/app/views/compliance_controls/_filters.html.slim
index 200aede7e..c729190a0 100644
--- a/app/views/compliance_controls/_filters.html.slim
+++ b/app/views/compliance_controls/_filters.html.slim
@@ -22,6 +22,15 @@
label_method: lambda {|w| ("<span>#{transport_mode(w.transport_mode, w.transport_submode)}</span>").html_safe},
required: false,
wrapper_html: {class: 'checkbox_list'}
+ .form-group.togglable#subclass-filter
+ = f.label t('compliance_controls.filters.subclass'), required: false, class: 'control-label'
+ = f.input :origin_code_cont_any,
+ collection: subclass_selection_list,
+ as: :check_boxes,
+ label: false,
+ label_method: lambda {|w| ("<span>#{w.first}</span>").html_safe},
+ required: false,
+ wrapper_html: {class: 'checkbox_list'}
.form-group.togglable#severity-filter
= f.label t('compliance_controls.filters.criticity'), required: false, class: 'control-label'
= f.input :criticity_eq_any,
diff --git a/config/locales/compliance_controls.en.yml b/config/locales/compliance_controls.en.yml
index f39f54e5b..41971d9e9 100644
--- a/config/locales/compliance_controls.en.yml
+++ b/config/locales/compliance_controls.en.yml
@@ -3,9 +3,16 @@ en:
clone:
prefix: 'Copy of'
filters:
- comment: Object
criticity: Severity
name: "Search by a control's name or code"
+ subclass: Object
+ subclasses:
+ generic: 'Generic'
+ journey_pattern: 'JourneyPattern'
+ line: 'Line'
+ route: 'Route'
+ routing_constraint_zone: 'RoutingConstraint'
+ vehicle_journey: 'VehicleJourney'
min_max_values: "the minimum (%{min}) is not supposed to be greater than the maximum (%{max})"
errors:
incoherent_control_sets: "Impossible to assign a control to a set (id: %{direct_set_name}) differing from the one of its group (id: %{indirect_set_name})"
diff --git a/config/locales/compliance_controls.fr.yml b/config/locales/compliance_controls.fr.yml
index 312638379..f6207187a 100644
--- a/config/locales/compliance_controls.fr.yml
+++ b/config/locales/compliance_controls.fr.yml
@@ -3,9 +3,16 @@ fr:
clone:
prefix: 'Copie de'
filters:
- comment: Objet
criticity: Criticité
name: "Chercher le nom ou code d'un contrôl"
+ subclass: Objet
+ subclasses:
+ generic: 'Généric'
+ journey_pattern: 'JourneyPattern'
+ line: 'Ligne'
+ route: 'Route'
+ routing_constraint_zone: 'ITL'
+ vehicle_journey: 'Course'
min_max_values: "la valeur de minimum (%{min}) ne doit pas être superieur à la valuer du maximum (%{max})"
errors:
incoherent_control_sets: "Le contrôle ne peut pas être associé à un jeu de contrôle (id: %{direct_set_name}) différent de celui de son groupe (id: %{indirect_set_name})"