aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--app/controllers/compliance_check_sets_controller.rb13
-rw-r--r--app/views/compliance_check_sets/index.html.slim8
-rw-r--r--config/locales/compliance_check_sets.en.yml1
-rw-r--r--config/locales/compliance_check_sets.fr.yml1
-rw-r--r--config/routes.rb4
-rw-r--r--spec/decorators/compliance_check_set_decorator_spec.rb4
-rw-r--r--spec/helpers/compliance_check_set_helper_spec.rb15
7 files changed, 13 insertions, 33 deletions
diff --git a/app/controllers/compliance_check_sets_controller.rb b/app/controllers/compliance_check_sets_controller.rb
index 989db1aeb..7d964731d 100644
--- a/app/controllers/compliance_check_sets_controller.rb
+++ b/app/controllers/compliance_check_sets_controller.rb
@@ -10,17 +10,14 @@ class ComplianceCheckSetsController < BreadcrumbController
scope = ransack_period @compliance_check_sets
@q_for_form = scope.ransack(params[:q])
format.html {
- @compliance_check_sets = decorate_compliance_check_sets(@q_for_form.result)
+ @compliance_check_sets = ModelDecorator.decorate(
+ @q_for_form.result,
+ with: ComplianceCheckSetDecorator
+ )
}
end
end
- def decorate_compliance_check_sets(compliance_check_sets)
- ModelDecorator.decorate(
- compliance_check_sets,
- with: ComplianceCheckSetDecorator
- )
- end
private
@@ -44,7 +41,7 @@ class ComplianceCheckSetsController < BreadcrumbController
return scope unless !!@begin_range && !!@end_range
if @begin_range > @end_range
- flash.now[:error] = t('imports.filters.error_period_filter')
+ flash.now[:error] = t('compliance_check_sets.filters.error_period_filter')
else
scope = scope.where_created_at_between(@begin_range, @end_range)
end
diff --git a/app/views/compliance_check_sets/index.html.slim b/app/views/compliance_check_sets/index.html.slim
index e33905fce..3e9b05393 100644
--- a/app/views/compliance_check_sets/index.html.slim
+++ b/app/views/compliance_check_sets/index.html.slim
@@ -18,7 +18,7 @@
.col-lg-12
.select_table
= table_builder_2 @compliance_check_sets,
- [ \
+ [ \
TableBuilderHelper::Column.new( \
key: :ref, \
attribute: 'referential_id' \
@@ -43,9 +43,9 @@
attribute: Proc.new{ |n| (n.compliance_control_set.name) if n.compliance_control_set} \
), \
],
- sortable: true,
- links: [:show],
- cls: 'table has-filter has-search'
+ sortable: true,
+ links: [:show],
+ cls: 'table has-filter has-search'
- unless @compliance_check_sets.any?
.row.mt-xs
.col-lg-12
diff --git a/config/locales/compliance_check_sets.en.yml b/config/locales/compliance_check_sets.en.yml
index d18381e33..b4b9aa1a1 100644
--- a/config/locales/compliance_check_sets.en.yml
+++ b/config/locales/compliance_check_sets.en.yml
@@ -11,6 +11,7 @@ fr:
destroy_confirm: Are you sure to delete this control report ?
filters:
name: Specify a control report name...
+ error_period_filter: End date must be greater or equal than begin date
search_no_results: No control reports match your search
activerecord:
models:
diff --git a/config/locales/compliance_check_sets.fr.yml b/config/locales/compliance_check_sets.fr.yml
index f5aabe89d..d50bdbfa3 100644
--- a/config/locales/compliance_check_sets.fr.yml
+++ b/config/locales/compliance_check_sets.fr.yml
@@ -11,6 +11,7 @@ fr:
destroy_confirm: Etes vous sûr de supprimer ce rapport de contrôle ?
filters:
name: Indiquez un nom d'un objet associé...
+ error_period_filter: La date de fin doit être supérieure ou égale à la date de début
search_no_results: Aucun rapport de contrôle ne correspond à votre recherche
activerecord:
models:
diff --git a/config/routes.rb b/config/routes.rb
index b976e6a6b..6477cc145 100644
--- a/config/routes.rb
+++ b/config/routes.rb
@@ -9,8 +9,8 @@ ChouetteIhm::Application.routes.draw do
resources :import_messages, only: [:index]
end
end
- resources :compliance_check_sets, :only => [:index, :show] do
- resources :compliance_checks, :only => [:show]
+ resources :compliance_check_sets, only: [:index, :show] do
+ resources :compliance_checks, only: [:show]
end
end
diff --git a/spec/decorators/compliance_check_set_decorator_spec.rb b/spec/decorators/compliance_check_set_decorator_spec.rb
deleted file mode 100644
index d1252f509..000000000
--- a/spec/decorators/compliance_check_set_decorator_spec.rb
+++ /dev/null
@@ -1,4 +0,0 @@
-require 'spec_helper'
-
-describe ComplianceCheckSetDecorator do
-end
diff --git a/spec/helpers/compliance_check_set_helper_spec.rb b/spec/helpers/compliance_check_set_helper_spec.rb
deleted file mode 100644
index 675ab872d..000000000
--- a/spec/helpers/compliance_check_set_helper_spec.rb
+++ /dev/null
@@ -1,15 +0,0 @@
-require 'rails_helper'
-
-# Specs in this file have access to a helper object that includes
-# the ComplianceCheckSetHelper. For example:
-#
-# describe ComplianceCheckSetHelper do
-# describe "string concat" do
-# it "concats two strings with spaces" do
-# expect(helper.concat_strings("this","that")).to eq("this that")
-# end
-# end
-# end
-RSpec.describe ComplianceCheckSetHelper, type: :helper do
- pending "add some examples to (or delete) #{__FILE__}"
-end