diff options
| author | Luc Donnet | 2017-09-21 09:38:12 +0200 |
|---|---|---|
| committer | Luc Donnet | 2017-09-21 09:38:12 +0200 |
| commit | 7ec5867ec7bd7365bb4c97d7d4c1bdc2cf580bc2 (patch) | |
| tree | 05a9a14e9acacdf4ec47f04d620aa336570fa533 /app | |
| parent | d62e303b9cae0f4c2e1e5075e4135faa24dd4460 (diff) | |
| parent | 5c63e10c3f576254d28a2bfff0b5dbbd0dd8e2d5 (diff) | |
| download | chouette-core-7ec5867ec7bd7365bb4c97d7d4c1bdc2cf580bc2.tar.bz2 | |
Merge branch 'master' of github.com:AF83/stif-boiv
Diffstat (limited to 'app')
| -rw-r--r-- | app/controllers/compliance_control_sets_controller.rb | 7 | ||||
| -rw-r--r-- | app/models/generic_attribute_pattern.rb | 23 | ||||
| -rw-r--r-- | app/models/generic_attribute_uniqueness.rb | 23 | ||||
| -rw-r--r-- | app/models/journey_pattern_control/vehicle_journey.rb | 13 | ||||
| -rw-r--r-- | app/models/line_control/route.rb | 13 | ||||
| -rw-r--r-- | app/models/route_control/journey_pattern.rb | 13 | ||||
| -rw-r--r-- | app/models/route_control/opposite_route_terminus.rb | 13 | ||||
| -rw-r--r-- | app/models/routing_constaint_zone_control/maximum_length.rb | 13 | ||||
| -rw-r--r-- | app/models/routing_constaint_zone_control/minimum_length.rb | 13 | ||||
| -rw-r--r-- | app/views/compliance_control_sets/_filters.html.slim | 29 | ||||
| -rw-r--r-- | app/views/compliance_control_sets/index.html.slim | 10 |
11 files changed, 137 insertions, 33 deletions
diff --git a/app/controllers/compliance_control_sets_controller.rb b/app/controllers/compliance_control_sets_controller.rb index 1b23becaa..6edfa3fcc 100644 --- a/app/controllers/compliance_control_sets_controller.rb +++ b/app/controllers/compliance_control_sets_controller.rb @@ -4,8 +4,9 @@ class ComplianceControlSetsController < BreadcrumbController def index index! do |format| + @q_for_form = @compliance_control_sets.ransack(params[:q]) format.html { - @compliance_control_sets = decorate_compliance_control_sets(@compliance_control_sets) + @compliance_control_sets = decorate_compliance_control_sets(@q_for_form.result) } end end @@ -23,11 +24,9 @@ class ComplianceControlSetsController < BreadcrumbController ) end - protected - private def compliance_control_set_params - params.require(:compliance_control_set).permit(:name) + params.require(:compliance_control_set).permit(:name, :id) end end diff --git a/app/models/generic_attribute_pattern.rb b/app/models/generic_attribute_pattern.rb new file mode 100644 index 000000000..0043f1563 --- /dev/null +++ b/app/models/generic_attribute_pattern.rb @@ -0,0 +1,23 @@ +#module ComplianceControls + + class GenericAttributePattern < ComplianceControl + + hstore_accessor :control_attributes, value: :string, pattern: :string + + @@default_criticity = :warning + @@default_code = "3-Generic-3" + + validate :pattern_match + def pattern_match + true + end + + after_initialize do + self.name = 'GenericAttributeMinMax' + self.code = @@default_code + self.criticity = @@default_criticity + end + + end + +#end
\ No newline at end of file diff --git a/app/models/generic_attribute_uniqueness.rb b/app/models/generic_attribute_uniqueness.rb new file mode 100644 index 000000000..dcf4a16c2 --- /dev/null +++ b/app/models/generic_attribute_uniqueness.rb @@ -0,0 +1,23 @@ +#module ComplianceControls + + class GenericAttributeUniqueness < ComplianceControl + + hstore_accessor :control_attributes, name: :string + + @@default_criticity = :warning + @@default_code = "3-Generic-3" + + validate :unique_values + def unique_values + true + end + + after_initialize do + self.name = 'GenericAttributeMinMax' + self.code = @@default_code + self.criticity = @@default_criticity + end + + end + +#end
\ No newline at end of file diff --git a/app/models/journey_pattern_control/vehicle_journey.rb b/app/models/journey_pattern_control/vehicle_journey.rb new file mode 100644 index 000000000..a90c16138 --- /dev/null +++ b/app/models/journey_pattern_control/vehicle_journey.rb @@ -0,0 +1,13 @@ +module JourneyPatternControl + class VehicleJourney < ComplianceControl + + @@default_criticity = :warning + @@default_code = "3-JourneyPattern-2" + + after_initialize do + self.name = self.class.name + self.code = @@default_code + self.criticity = @@default_criticity + end + end +end
\ No newline at end of file diff --git a/app/models/line_control/route.rb b/app/models/line_control/route.rb new file mode 100644 index 000000000..8ac13a080 --- /dev/null +++ b/app/models/line_control/route.rb @@ -0,0 +1,13 @@ +module LineControl + class Route < ComplianceControl + + @@default_criticity = :warning + @@default_code = "3-Line-1" + + after_initialize do + self.name = self.class.name + self.code = @@default_code + self.criticity = @@default_criticity + end + end +end
\ No newline at end of file diff --git a/app/models/route_control/journey_pattern.rb b/app/models/route_control/journey_pattern.rb new file mode 100644 index 000000000..0559fac42 --- /dev/null +++ b/app/models/route_control/journey_pattern.rb @@ -0,0 +1,13 @@ +module RouteControl + class JourneyPattern < ComplianceControl + + @@default_criticity = :warning + @@default_code = "3-Route-3" + + after_initialize do + self.name = self.class.name + self.code = @@default_code + self.criticity = @@default_criticity + end + end +end
\ No newline at end of file diff --git a/app/models/route_control/opposite_route_terminus.rb b/app/models/route_control/opposite_route_terminus.rb new file mode 100644 index 000000000..e72229ca3 --- /dev/null +++ b/app/models/route_control/opposite_route_terminus.rb @@ -0,0 +1,13 @@ +module RouteControl + class OppositeRouteTerminus < ComplianceControl + + @@default_criticity = :warning + @@default_code = "3-Route-5" + + after_initialize do + self.name = self.class.name + self.code = @@default_code + self.criticity = @@default_criticity + end + end +end
\ No newline at end of file diff --git a/app/models/routing_constaint_zone_control/maximum_length.rb b/app/models/routing_constaint_zone_control/maximum_length.rb new file mode 100644 index 000000000..fd63ffeda --- /dev/null +++ b/app/models/routing_constaint_zone_control/maximum_length.rb @@ -0,0 +1,13 @@ +module RoutingConstaintZoneControl + class MaximumLength < ComplianceControl + + @@default_criticity = :warning + @@default_code = "3-ITL-2" + + after_initialize do + self.name = self.class.name + self.code = @@default_code + self.criticity = @@default_criticity + end + end +end
\ No newline at end of file diff --git a/app/models/routing_constaint_zone_control/minimum_length.rb b/app/models/routing_constaint_zone_control/minimum_length.rb new file mode 100644 index 000000000..c17bbc834 --- /dev/null +++ b/app/models/routing_constaint_zone_control/minimum_length.rb @@ -0,0 +1,13 @@ +module RoutingConstaintZoneControl + class MinimumLength < ComplianceControl + + @@default_criticity = :warning + @@default_code = "3-ITL-3" + + after_initialize do + self.name = self.class.name + self.code = @@default_code + self.criticity = @@default_criticity + end + end +end
\ No newline at end of file diff --git a/app/views/compliance_control_sets/_filters.html.slim b/app/views/compliance_control_sets/_filters.html.slim index 8da629e9c..7ee050636 100644 --- a/app/views/compliance_control_sets/_filters.html.slim +++ b/app/views/compliance_control_sets/_filters.html.slim @@ -1,33 +1,10 @@ -= search_form_for @q_for_form, url: workbench_path(@workbench.id), builder: SimpleForm::FormBuilder, class: 'form form-filter' do |f| += search_form_for @q_for_form, url: compliance_control_sets_path, builder: SimpleForm::FormBuilder, class: 'form form-filter' do |f| .ffg-row .input-group.search_bar - = f.search_field :name_cont, class: 'form-control', placeholder: t('referentials.filters.name') + = f.search_field :name_cont, class: 'form-control', placeholder: t('compliance_control_sets.filters.name') span.input-group-btn button.btn.btn-default type='submit' span.fa.fa-search - - .ffg-row - .form-group - = f.label t('activerecord.models.line.one').upcase, required: false, class: 'control-label' - = f.input :associated_lines_id_eq, as: :select, collection: @workbench.lines.includes(:company).order(:name), input_html: { 'data-select2ed': 'true', 'data-select2ed-placeholder': t('referentials.filters.line') }, label: false, label_method: :display_name, wrapper_html: { class: 'select2ed'} - - .form-group.togglable - = f.label Referential.human_attribute_name(:status), required: false, class: 'control-label' - .form-group.checkbox_list - = f.input :archived_at_not_null, label: ("<span>#{t('activerecord.attributes.referential.archived_at')}<span class='fa fa-archive'></span></span>").html_safe, as: :boolean, wrapper_html: { class: 'checkbox-wrapper' } - = f.input :archived_at_null, label: ("<span>#{t('activerecord.attributes.referential.archived_at_null')}<span class='sb sb-lg sb-preparing'></span></span>").html_safe, as: :boolean, wrapper_html: { class: 'checkbox-wrapper' } - - .form-group.togglable - = f.label t('activerecord.models.organisation.one'), required: false, class: 'control-label' - = f.input :organisation_name_eq_any, collection: Organisation.order('name').pluck(:name), as: :check_boxes, label: false, label_method: lambda{|w| ("<span>#{w}</span>").html_safe}, required: false, wrapper_html: { class: 'checkbox_list' } - - .form-group.togglable - = f.label Referential.human_attribute_name(:validity_period), required: false, class: 'control-label' - .filter_menu - = f.simple_fields_for :validity_period do |p| - = p.input :begin_gteq, as: :date, label: t('simple_form.from'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @begin_range, include_blank: @begin_range ? false : true - = p.input :end_lteq, as: :date, label: t('simple_form.to'), wrapper_html: { class: 'date smart_date filter_menu-item' }, default: @end_range, include_blank: @end_range ? false : true - .actions - = link_to t('actions.erase'), @workbench, class: 'btn btn-link' + = link_to t('actions.erase'), @compliance_control_set, class: 'btn btn-link' = f.submit t('actions.filter'), class: 'btn btn-default', id: 'referential_filter_btn' diff --git a/app/views/compliance_control_sets/index.html.slim b/app/views/compliance_control_sets/index.html.slim index fa85c38f7..95833a01c 100644 --- a/app/views/compliance_control_sets/index.html.slim +++ b/app/views/compliance_control_sets/index.html.slim @@ -14,7 +14,7 @@ .container-fluid .row .col-lg-12 - /= render 'filters' + = render 'filters' .row .col-lg-12 .select_table @@ -40,11 +40,15 @@ attribute: 'control_numbers' \ ), \ TableBuilderHelper::Column.new( \ - key: :update, \ - attribute: '' \ + key: :updated_at, \ + attribute: Proc.new { |n| l(n.updated_at, format: :long) if n.updated_at }, \ ) \ ], sortable: true, cls: 'table has-filter has-search' + - unless @compliance_control_sets.any? + .row.mt-xs + .col-lg-12 + = replacement_msg t('compliance_control_sets.search_no_results') |
