diff options
| author | Zakaria BOUZIANE | 2015-05-06 10:38:34 +0200 |
|---|---|---|
| committer | Zakaria BOUZIANE | 2015-05-06 10:38:34 +0200 |
| commit | ed6fd2af69ebecb8d6af496135f1398ef6332b06 (patch) | |
| tree | 6e69aa36cd98edad74091aea3916ec0b445872ae /app/controllers | |
| parent | 1f9feab16cc9d7722be1ed0c495c7eeba555ab9a (diff) | |
| download | chouette-core-ed6fd2af69ebecb8d6af496135f1398ef6332b06.tar.bz2 | |
Showing validation of imports (still css to fix)
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/compliance_check_results_controller.rb | 17 | ||||
| -rw-r--r-- | app/controllers/compliance_checks_controller.rb | 28 | ||||
| -rw-r--r-- | app/controllers/imports_controller.rb | 5 |
3 files changed, 41 insertions, 9 deletions
diff --git a/app/controllers/compliance_check_results_controller.rb b/app/controllers/compliance_check_results_controller.rb index 3195e4c82..d1f445e45 100644 --- a/app/controllers/compliance_check_results_controller.rb +++ b/app/controllers/compliance_check_results_controller.rb @@ -6,7 +6,6 @@ class ComplianceCheckResultsController < ChouetteController respond_to :js, :only => :index def index - #puts "params = #{params.inspect}" index! do |format| format.html { render :layout => false } end @@ -17,13 +16,25 @@ class ComplianceCheckResultsController < ChouetteController def compliance_check_service ComplianceCheckService.new(@referential) end - + def compliance_check @compliance_check ||= compliance_check_service.find( params[:compliance_check_id] ) end + def import_service + import_service = ImportService.new(@referential) + end + + def import + @import = import_service.find(params[:import_id]) + end + def compliance_check_validation_report - @compliance_check_validation_report ||= compliance_check.compliance_check_validation_report + if params[:import_id] + compliance_check_validation_report ||= import.compliance_check_validation_report + else + compliance_check_validation_report ||= compliance_check.compliance_check_validation_report + end end def collection diff --git a/app/controllers/compliance_checks_controller.rb b/app/controllers/compliance_checks_controller.rb index 3ce961d72..976ced921 100644 --- a/app/controllers/compliance_checks_controller.rb +++ b/app/controllers/compliance_checks_controller.rb @@ -6,7 +6,7 @@ class ComplianceChecksController < ChouetteController respond_to :html, :js respond_to :zip, :only => :export belongs_to :referential - + def index begin index! do @@ -18,6 +18,20 @@ class ComplianceChecksController < ChouetteController redirect_to referential_path(@referential) end end + + def show + @import = resource if resource.kind_of?(Import) + begin + show! do |format| + build_breadcrumb :show + format.js { render 'show_for_import.js.coffee' if @import} + end + rescue Ievkit::Error => error + logger.error("Iev failure : #{error.message}") + flash[:error] = t('iev.failure') + redirect_to referential_path(@referential) + end + end def references @references = referential.send(params[:type]).where("name ilike ?", "%#{params[:q]}%") @@ -29,7 +43,6 @@ class ComplianceChecksController < ChouetteController end def rule_parameter_set - #@rule_parameter_set = compliance_check.rule_parameter_set_archived @rule_parameter_set = resource.rule_parameter_set build_breadcrumb :edit render "rule_parameter_sets/show" @@ -54,13 +67,22 @@ class ComplianceChecksController < ChouetteController def compliance_check_service ComplianceCheckService.new(@referential) end + + def import_service + ImportService.new(@referential) + end def build_resource(attributes = {}) @compliance_check ||= ComplianceCheck.new end def resource - @compliance_check ||= compliance_check_service.find(params[:id] ) + compliance_check ||= compliance_check_service.find(params[:id]) + if compliance_check.datas[:action] == "importer" + @importer = import_service.find(params[:id]) + else + @compliance_check = compliance_check + end end def collection diff --git a/app/controllers/imports_controller.rb b/app/controllers/imports_controller.rb index ae0ac063b..752c08f5b 100644 --- a/app/controllers/imports_controller.rb +++ b/app/controllers/imports_controller.rb @@ -5,8 +5,8 @@ require 'open-uri' class ImportsController < ChouetteController defaults :resource_class => Import - respond_to :html, :only => [:show, :index, :destroy, :imported_file, :rule_parameter_set] - respond_to :js, :only => [:show, :index] + respond_to :html, :only => [:show, :index, :destroy, :imported_file, :rule_parameter_set, :compliance_check] + respond_to :js, :only => [:show, :index, :compliance_check] belongs_to :referential def index @@ -69,7 +69,6 @@ class ImportsController < ChouetteController begin build_breadcrumb :show @import = resource - #@compliance_check = ComplianceCheck.new @import.datas render "compliance_checks/show" rescue Ievkit::Error => error logger.error("Iev failure : #{error.message}") |
