diff options
Diffstat (limited to 'app/controllers')
| -rw-r--r-- | app/controllers/api/v1/imports_controller.rb | 6 | ||||
| -rw-r--r-- | app/controllers/compliance_control_sets_controller.rb | 8 | ||||
| -rw-r--r-- | app/controllers/compliance_controls_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/time_tables_controller.rb | 1 |
4 files changed, 13 insertions, 4 deletions
diff --git a/app/controllers/api/v1/imports_controller.rb b/app/controllers/api/v1/imports_controller.rb index 6050418d8..3d7f4ca79 100644 --- a/app/controllers/api/v1/imports_controller.rb +++ b/app/controllers/api/v1/imports_controller.rb @@ -5,7 +5,11 @@ class Api::V1::ImportsController < Api::V1::IbooController def create args = workbench_import_params.merge(creator: 'Webservice') @import = parent.workbench_imports.create(args) - create! + if @import.valid? + create! + else + render json: { status: "error", messages: @import.errors.full_messages } + end end private diff --git a/app/controllers/compliance_control_sets_controller.rb b/app/controllers/compliance_control_sets_controller.rb index 9de90c21c..e5c2e19dd 100644 --- a/app/controllers/compliance_control_sets_controller.rb +++ b/app/controllers/compliance_control_sets_controller.rb @@ -23,6 +23,12 @@ class ComplianceControlSetsController < BreadcrumbController end end + def clone + ComplianceControlSetCloner.new.copy(params[:id], current_organisation.id) + flash[:notice] = I18n.t("compliance_control_sets.errors.operation_in_progress") + redirect_to(compliance_control_sets_path) + end + protected def begin_of_association_chain @@ -48,4 +54,4 @@ class ComplianceControlSetsController < BreadcrumbController def compliance_control_set_params params.require(:compliance_control_set).permit(:name, :id) end -end +end
\ No newline at end of file diff --git a/app/controllers/compliance_controls_controller.rb b/app/controllers/compliance_controls_controller.rb index e51d1eb74..0a9c7d52b 100644 --- a/app/controllers/compliance_controls_controller.rb +++ b/app/controllers/compliance_controls_controller.rb @@ -1,6 +1,7 @@ class ComplianceControlsController < BreadcrumbController defaults resource_class: ComplianceControl belongs_to :compliance_control_set + actions :all, :except => [:show, :index] def select_type @sti_subclasses = ComplianceControl.subclasses @@ -15,7 +16,6 @@ class ComplianceControlsController < BreadcrumbController end def create - puts build_resource.inspect create! do |success, failure| success.html { redirect_to compliance_control_set_path(parent) } failure.html { render( :action => 'new' ) } diff --git a/app/controllers/time_tables_controller.rb b/app/controllers/time_tables_controller.rb index 2d24d5aa6..af74f635f 100644 --- a/app/controllers/time_tables_controller.rb +++ b/app/controllers/time_tables_controller.rb @@ -130,7 +130,6 @@ class TimeTablesController < ChouetteController scope = select_time_tables if params[:q] && params[:q]["tag_search"] tags = params[:q]["tag_search"].reject {|c| c.empty?} - params[:q].delete("tag_search") scope = select_time_tables.tagged_with(tags, :any => true) if tags.any? end scope = self.ransack_period_range(scope: scope, error_message: t('referentials.errors.validity_period'), query: :overlapping) |
