From 90173e6bdd12d1aabe68a0d28f4f228782d3adf0 Mon Sep 17 00:00:00 2001 From: Guillaume Date: Mon, 23 Oct 2017 17:08:17 +0200 Subject: page select compliance_control_set for validate referential Refs #4755 --- .../compliance_control_sets_controller.rb | 4 ++++ app/decorators/referential_decorator.rb | 8 +++++++ .../select_compliance_control_set.html.slim | 27 ++++++++++++++++++++++ config/locales/actions.en.yml | 1 + config/locales/actions.fr.yml | 1 + config/locales/referentials.en.yml | 2 ++ config/locales/referentials.fr.yml | 2 ++ config/routes.rb | 1 + 8 files changed, 46 insertions(+) create mode 100644 app/views/compliance_control_sets/select_compliance_control_set.html.slim diff --git a/app/controllers/compliance_control_sets_controller.rb b/app/controllers/compliance_control_sets_controller.rb index e5c2e19dd..fd66a54e7 100644 --- a/app/controllers/compliance_control_sets_controller.rb +++ b/app/controllers/compliance_control_sets_controller.rb @@ -29,6 +29,10 @@ class ComplianceControlSetsController < BreadcrumbController redirect_to(compliance_control_sets_path) end + def select_compliance_control_set + @compliance_control_sets = ComplianceControlSet.all + end + protected def begin_of_association_chain diff --git a/app/decorators/referential_decorator.rb b/app/decorators/referential_decorator.rb index dccf0052c..3876d966d 100644 --- a/app/decorators/referential_decorator.rb +++ b/app/decorators/referential_decorator.rb @@ -16,6 +16,14 @@ class ReferentialDecorator < Draper::Decorator href: h.new_referential_path(from: object.id, current_workbench_id: context[:current_workbench_id]) ) end + + # if policy.validate? + links << Link.new( + content: h.t('actions.validate'), + href: h.compliance_control_set_select_compliance_control_set_path(object.id, referential_id: context[:referential_id]) + ) + # end + if policy.archive? links << Link.new( content: h.t('actions.archive'), diff --git a/app/views/compliance_control_sets/select_compliance_control_set.html.slim b/app/views/compliance_control_sets/select_compliance_control_set.html.slim new file mode 100644 index 000000000..4b76fdac2 --- /dev/null +++ b/app/views/compliance_control_sets/select_compliance_control_set.html.slim @@ -0,0 +1,27 @@ +/ PageHeader +- header_params = ['jeux-de-controle', + t('referentials.select_jdc.title'), + ''] += pageheader(*header_params) do + +/ PageContent +.page_content + .container-fluid + .row + .col-lg-8.col-lg-offset-2.col-md-8.col-md-offset-2.col-sm-10.col-sm-offset-1 + = form_tag '#', {class: 'form-horizontal', id: 'select_compliance_control_set', wrapper: :horizontal_form} do + .row + .col-lg-12 + .form-group + = label_tag 'name', nil, class: 'string required col-sm-4 col-xs-5 control-label' + .col-sm-8.col-xs-7 + = select_tag :name, options_from_collection_for_select(@compliance_control_sets, "id", "name"), class: 'select optional form-control' + .separator + = button_tag t('actions.submit'), class: 'btn btn-default formSubmitr' + + + /= simple_form_for @compliance_control_sets, html: { class: 'form-horizontal', id: 'select_compliance_control_set' }, wrapper: :horizontal_form do |f| + / .row + / .col-lg-12 + / = f.association :compliance_control_set, collection: @compliance_control_sets, label_method: lambda {@compliance_control_sets.name} + /= f.button :submit, t('actions.submit'), class: 'btn btn-default formSubmitr', form: 'select_compliance_control_set' diff --git a/config/locales/actions.en.yml b/config/locales/actions.en.yml index c34462d0d..2706ba69d 100644 --- a/config/locales/actions.en.yml +++ b/config/locales/actions.en.yml @@ -17,6 +17,7 @@ en: combine: 'Combine' actualize: 'Actualize' import: 'Import' + validate: 'Validate' filter: 'Filter' erase: 'Erase' create_api_key: "Create an API key" diff --git a/config/locales/actions.fr.yml b/config/locales/actions.fr.yml index df16d2aab..e796017c7 100644 --- a/config/locales/actions.fr.yml +++ b/config/locales/actions.fr.yml @@ -17,6 +17,7 @@ fr: combine: 'Combiner' actualize: 'Actualiser' import: 'Importer' + validate: 'Valider' filter: 'Filtrer' erase: 'Effacer' create_api_key: "Créer une clé d'API" diff --git a/config/locales/referentials.en.yml b/config/locales/referentials.en.yml index 14b4dbe66..844e4a570 100644 --- a/config/locales/referentials.en.yml +++ b/config/locales/referentials.en.yml @@ -31,6 +31,8 @@ en: duplicated: title: 'Clone a data space' submit: "Create a data space" + select_jdc: + title: "Select a Compliance Control Set" actions: new: "Add a data space" destroy_confirm: "Do you confirm to destroy this data space ?" diff --git a/config/locales/referentials.fr.yml b/config/locales/referentials.fr.yml index b90f6e5b6..285db3d3f 100644 --- a/config/locales/referentials.fr.yml +++ b/config/locales/referentials.fr.yml @@ -31,6 +31,8 @@ fr: duplicated: title: 'Dupliquer un jeu de données' submit: "Valider" + select_jdc: + title: "Sélection du jeu de contôle" actions: new: "Créer un jeu de données" destroy_confirm: "Etes vous sûr de vouloir supprimer ce jeu de données ?" diff --git a/config/routes.rb b/config/routes.rb index b105e77d6..214b12584 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -75,6 +75,7 @@ ChouetteIhm::Application.routes.draw do resources :compliance_control_sets do get :clone, on: :member + get :select_compliance_control_set resources :compliance_controls, except: :index do get :select_type, on: :collection end -- cgit v1.2.3