diff options
| author | Teddy Wing | 2017-07-07 17:14:14 +0200 | 
|---|---|---|
| committer | Teddy Wing | 2017-07-12 11:06:03 +0200 | 
| commit | a6a3122bf1d2c2f6fc6b0f27b25b14da16a9b976 (patch) | |
| tree | e74246044e2311b2b3c91ad433dd2f56e453cd6b | |
| parent | 288c5980dc7cd9f143b88d5a8492c006c5f46bb7 (diff) | |
| download | chouette-core-a6a3122bf1d2c2f6fc6b0f27b25b14da16a9b976.tar.bz2 | |
CompanyDecorator#action_links: Rename `line_referential` context param
Rename this to `referential` to be more generic. This is because we
could be passing both `Referential`s and `LineReferential`s into this
parameter.
In `CompaniesController`, we use a `LineReferential` while in
`ReferentialCompaniesController` we use `Referential`.
Refs #3479
| -rw-r--r-- | app/controllers/companies_controller.rb | 2 | ||||
| -rw-r--r-- | app/controllers/referential_companies_controller.rb | 2 | ||||
| -rw-r--r-- | app/decorators/company_decorator.rb | 8 | ||||
| -rw-r--r-- | spec/helpers/table_builder_helper_spec.rb | 2 | 
4 files changed, 7 insertions, 7 deletions
| diff --git a/app/controllers/companies_controller.rb b/app/controllers/companies_controller.rb index 1596975b8..07a732fc9 100644 --- a/app/controllers/companies_controller.rb +++ b/app/controllers/companies_controller.rb @@ -20,7 +20,7 @@ class CompaniesController < BreadcrumbController            @companies,            with: CompanyDecorator,            context: { -            line_referential: line_referential +            referential: line_referential            }          )        } diff --git a/app/controllers/referential_companies_controller.rb b/app/controllers/referential_companies_controller.rb index 09167009a..53dde93bb 100644 --- a/app/controllers/referential_companies_controller.rb +++ b/app/controllers/referential_companies_controller.rb @@ -18,7 +18,7 @@ class ReferentialCompaniesController < ChouetteController            @companies,            with: CompanyDecorator,            context: { -            line_referential: referential +            referential: referential            }          )        } diff --git a/app/decorators/company_decorator.rb b/app/decorators/company_decorator.rb index 030952483..402bd3ab6 100644 --- a/app/decorators/company_decorator.rb +++ b/app/decorators/company_decorator.rb @@ -13,7 +13,7 @@ class CompanyDecorator < Draper::Decorator    # Requires:    #   context: { -  #     line_referential: +  #     referential:    #   }    def action_links      links = [] @@ -23,7 +23,7 @@ class CompanyDecorator < Draper::Decorator        binding.pry        links << Link.new(          content: h.t('companies.actions.new'), -        href: h.new_line_referential_company_path(context[:line_referential]) +        href: h.new_line_referential_company_path(context[:referential])        )      end @@ -31,7 +31,7 @@ class CompanyDecorator < Draper::Decorator        links << Link.new(          content: h.t('companies.actions.edit'),          href: h.edit_line_referential_company_path( -          context[:line_referential], +          context[:referential],            object          )        ) @@ -41,7 +41,7 @@ class CompanyDecorator < Draper::Decorator        links << Link.new(          content: t('companies.actions.destroy'),          href: h.line_referential_company_path( -          context[:line_referential], +          context[:referential],            object          ),          method: :delete, diff --git a/spec/helpers/table_builder_helper_spec.rb b/spec/helpers/table_builder_helper_spec.rb index 4f7c1bd69..c536a4c62 100644 --- a/spec/helpers/table_builder_helper_spec.rb +++ b/spec/helpers/table_builder_helper_spec.rb @@ -302,7 +302,7 @@ describe TableBuilderHelper, type: :helper do        companies = ModelDecorator.decorate(          companies,          with: CompanyDecorator, -        context: {line_referential: line_referential} +        context: { referential: line_referential }        )        stub_policy_scope(company) | 
