diff options
| author | Teddy Wing | 2017-06-15 14:49:34 +0200 |
|---|---|---|
| committer | Teddy Wing | 2017-06-15 14:49:34 +0200 |
| commit | 40b02ab0bdbf51ea4c9d3ebef26d880c789edf44 (patch) | |
| tree | b118ee690e838b0b0243f77a1fd91b9adcfdb304 /app | |
| parent | 22b4146541ce721447b2364c390c2dfe1efae8ef (diff) | |
| download | chouette-core-40b02ab0bdbf51ea4c9d3ebef26d880c789edf44.tar.bz2 | |
Link: Change :name & :content into a single property :content
The only difference between :name and :content was that :name contained
a string and :content contained HTML. But they're really the same thing.
Thus it makes much more sense to combine those into a single property
that means both, and handles content regardless of type.
Refs #3479
Diffstat (limited to 'app')
| -rw-r--r-- | app/decorators/company_decorator.rb | 6 | ||||
| -rw-r--r-- | app/decorators/referential_decorator.rb | 12 | ||||
| -rw-r--r-- | app/helpers/table_builder_helper.rb | 2 | ||||
| -rw-r--r-- | app/helpers/table_builder_helper/custom_links.rb | 2 |
4 files changed, 11 insertions, 11 deletions
diff --git a/app/decorators/company_decorator.rb b/app/decorators/company_decorator.rb index 5a2fdd1c0..629d1ff38 100644 --- a/app/decorators/company_decorator.rb +++ b/app/decorators/company_decorator.rb @@ -16,21 +16,21 @@ class CompanyDecorator < Draper::Decorator if h.policy(Chouette::Company).create? links << Link.new( - name: h.t('companies.actions.new'), + content: h.t('companies.actions.new'), href: h.new_line_referential_company_path(@line_referential) ) end if h.policy(object).update? links << Link.new( - name: h.t('companies.actions.edit'), + content: h.t('companies.actions.edit'), href: h.edit_line_referential_company_path(@line_referential, object) ) end if h.policy(object).destroy? links << Link.new( - name: t('companies.actions.destroy'), + content: t('companies.actions.destroy'), href: h.line_referential_company_path(@line_referential, object), method: :delete, data: { confirm: t('companies.actions.destroy_confirm') } diff --git a/app/decorators/referential_decorator.rb b/app/decorators/referential_decorator.rb index b514a38df..58c2eac73 100644 --- a/app/decorators/referential_decorator.rb +++ b/app/decorators/referential_decorator.rb @@ -4,14 +4,14 @@ class ReferentialDecorator < Draper::Decorator def action_links links = [ Link.new( - name: h.t('time_tables.index.title'), + content: h.t('time_tables.index.title'), href: h.referential_time_tables_path(object) ) ] if h.policy(object).clone? links << Link.new( - name: h.t('actions.clone'), + content: h.t('actions.clone'), href: h.new_referential_path(from: object.id) ) end @@ -22,13 +22,13 @@ class ReferentialDecorator < Draper::Decorator if object.archived? links << Link.new( - name: h.t('actions.unarchive'), + content: h.t('actions.unarchive'), href: h.unarchive_referential_path(object.id), method: :put ) else links << Link.new( - name: h.t('actions.archive'), + content: h.t('actions.archive'), href: h.archive_referential_path(object.id), method: :put ) @@ -37,10 +37,10 @@ class ReferentialDecorator < Draper::Decorator if h.policy(object).destroy? links << Link.new( + content: h.destroy_link_content, href: h.referential_path(object), method: :delete, - data: { confirm: h.t('referentials.actions.destroy_confirm') }, - content: h.destroy_link_content + data: { confirm: h.t('referentials.actions.destroy_confirm') } ) end diff --git a/app/helpers/table_builder_helper.rb b/app/helpers/table_builder_helper.rb index af05a7354..888bd40ad 100644 --- a/app/helpers/table_builder_helper.rb +++ b/app/helpers/table_builder_helper.rb @@ -121,7 +121,7 @@ module TableBuilderHelper method: link.method, data: link.data ) do - link.content || link.name + link.content end, class: link.method == :delete ? 'delete-action' : '', ) diff --git a/app/helpers/table_builder_helper/custom_links.rb b/app/helpers/table_builder_helper/custom_links.rb index f03acac1e..abb907678 100644 --- a/app/helpers/table_builder_helper/custom_links.rb +++ b/app/helpers/table_builder_helper/custom_links.rb @@ -17,7 +17,7 @@ module TableBuilderHelper def links actions_after_policy_check.map do |action| Link.new( - name: I18n.t("actions.#{action}"), + content: I18n.t("actions.#{action}"), href: polymorphic_url(action), method: method_for_action(action) ) |
