diff options
| author | Robert | 2017-10-20 11:44:07 +0200 | 
|---|---|---|
| committer | Robert | 2017-10-20 11:44:07 +0200 | 
| commit | 2315feae844a39ae9e86939b090bed0d2997f482 (patch) | |
| tree | bb1f30288c16007b756a1b0df98f944bc50245ea | |
| parent | c6dec6ee3945c5edd9da752fa87268610d3c98bc (diff) | |
| parent | 3ee97da2ff5c782debcce2ab7365110c95471942 (diff) | |
| download | chouette-core-2315feae844a39ae9e86939b090bed0d2997f482.tar.bz2 | |
Merge branch 'master' of github.com:af83/stif-boiv
| -rw-r--r-- | app/assets/stylesheets/components/_tables.sass | 10 | ||||
| -rw-r--r-- | app/controllers/compliance_control_sets_controller.rb | 8 | ||||
| -rw-r--r-- | app/decorators/compliance_control_set_decorator.rb | 7 | ||||
| -rw-r--r-- | app/views/compliance_control_sets/show.html.slim | 10 | ||||
| -rw-r--r-- | config/locales/compliance_control_sets.en.yml | 5 | ||||
| -rw-r--r-- | config/locales/compliance_control_sets.fr.yml | 5 | ||||
| -rw-r--r-- | config/routes.rb | 1 | 
7 files changed, 40 insertions, 6 deletions
| diff --git a/app/assets/stylesheets/components/_tables.sass b/app/assets/stylesheets/components/_tables.sass index 8fe7be374..178ec2f36 100644 --- a/app/assets/stylesheets/components/_tables.sass +++ b/app/assets/stylesheets/components/_tables.sass @@ -247,6 +247,16 @@        width: 35px        height: 35px        margin: 5px +      &.with_text +        width: initial +        > a, > button +          border-radius: 4% +          text-decoration: none +        span +          &.fa +            padding-left: 10px +        span +          padding: 0 10px 0 0        > a, > button          display: block 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/decorators/compliance_control_set_decorator.rb b/app/decorators/compliance_control_set_decorator.rb index f4aa607e1..7515316ce 100644 --- a/app/decorators/compliance_control_set_decorator.rb +++ b/app/decorators/compliance_control_set_decorator.rb @@ -4,6 +4,13 @@ class ComplianceControlSetDecorator < Draper::Decorator    def action_links      links = [] +    # if policy.clone? +      links << Link.new( +        content: h.t('actions.clone'), +        href: h.clone_compliance_control_set_path(object.id) +      ) +    # end +      # if h.policy(object).destroy?        links << Link.new(          content: h.destroy_link_content, diff --git a/app/views/compliance_control_sets/show.html.slim b/app/views/compliance_control_sets/show.html.slim index 7767bd0d9..f45b0227a 100644 --- a/app/views/compliance_control_sets/show.html.slim +++ b/app/views/compliance_control_sets/show.html.slim @@ -96,9 +96,13 @@                  cls: 'table has-filter has-search'      .select_toolbox        ul -        li.st_action +        li.st_action.with_text            = link_to select_type_compliance_control_set_compliance_controls_path(@compliance_control_set.id)              span.fa.fa-plus -        li.st_action +            span +              = t('compliance_control_sets.actions.add_compliance_control') +        li.st_action.with_text            = link_to new_compliance_control_set_compliance_control_block_path(@compliance_control_set.id) -            span.fa.fa-plus-square +            span.fa.fa-plus +            span +              = t('compliance_control_sets.actions.add_compliance_control_block') diff --git a/config/locales/compliance_control_sets.en.yml b/config/locales/compliance_control_sets.en.yml index f72342894..ed7ccad5e 100644 --- a/config/locales/compliance_control_sets.en.yml +++ b/config/locales/compliance_control_sets.en.yml @@ -2,6 +2,8 @@ en:    compliance_control_sets:      clone:        prefix: 'Copie de' +    errors: +      operation_in_progress: "The clone operation is in progress. Please wait and refresh the page in a few moments"      index:        title: Compliance control set        new: New compliance control set @@ -13,7 +15,8 @@ en:        edit: Edit        show: Show        destroy: Destroy -      add_compliance_control: Add a compliance control +      add_compliance_control: Compliance Control +      add_compliance_control_block: Compliance Control Block        destroy_confirm: Are you sur ?      filters:        name: 'Enter name ...' diff --git a/config/locales/compliance_control_sets.fr.yml b/config/locales/compliance_control_sets.fr.yml index c31eb9423..d952567bf 100644 --- a/config/locales/compliance_control_sets.fr.yml +++ b/config/locales/compliance_control_sets.fr.yml @@ -2,6 +2,8 @@ fr:    compliance_control_sets:      clone:        prefix: 'Copy of' +    errors: +      operation_in_progress: "L'opération de clone est en cours. Veuillez patienter et raffraichir la page dans quelques instants"      index:        title: "Liste des jeux de contrôles"      edit: @@ -15,7 +17,8 @@ fr:        edit: Editer        show: Consulter        destroy: Supprimer -      add_compliance_control: Ajouter un JDC +      add_compliance_control: Contrôle +      add_compliance_control_block: Groupe de contrôles        loaded: Charger le contrôle        destroy_confirm: Etes vous sûr de supprimer ce jeux de contrôle ?      filters: diff --git a/config/routes.rb b/config/routes.rb index b9e318f91..b105e77d6 100644 --- a/config/routes.rb +++ b/config/routes.rb @@ -74,6 +74,7 @@ ChouetteIhm::Application.routes.draw do    resources :api_keys, :only => [:edit, :update, :new, :create, :destroy]    resources :compliance_control_sets do +    get :clone, on: :member      resources :compliance_controls, except: :index do        get :select_type, on: :collection      end | 
