From b78dbe9f996083e1f0b75ceab321a968a9d92075 Mon Sep 17 00:00:00 2001 From: davidg73 <david.gunnarsson@univie.ac.at> Date: Tue, 27 May 2025 14:38:20 +0200 Subject: [PATCH] Rename BO model name of Colours it is more correct to call this colours & inclusions, from an archeaology perspective. No need to rename the model name or the database table - instead just overwrite with locale files - much easier approach --- app/avo/resources/colour.rb | 7 +++++-- config/locales/avo.en.yml | 7 +++++++ 2 files changed, 12 insertions(+), 2 deletions(-) create mode 100644 config/locales/avo.en.yml diff --git a/app/avo/resources/colour.rb b/app/avo/resources/colour.rb index 292b271..9392079 100644 --- a/app/avo/resources/colour.rb +++ b/app/avo/resources/colour.rb @@ -1,5 +1,8 @@ class Avo::Resources::Colour < Avo::BaseResource self.title = :colour + self.translation_key = "avo.resource_translations.colours_and_inclusions" + + self.index_query = -> { query.order(code: :asc, colour: :asc) } # self.includes = [] # self.attachments = [] @@ -8,7 +11,7 @@ class Avo::Resources::Colour < Avo::BaseResource # } def fields - field :code, as: :text - field :colour, as: :text + field :code, as: :text, sortable: true, name: "Inclusion" + field :colour, as: :text, sortable: true end end diff --git a/config/locales/avo.en.yml b/config/locales/avo.en.yml new file mode 100644 index 0000000..287ce7d --- /dev/null +++ b/config/locales/avo.en.yml @@ -0,0 +1,7 @@ +en: + avo: + resource_translations: + colours_and_inclusions: + zero: "Colours & Inclusions" + one: "Colour & Inclusion" + other: "Colours & Inclusions" \ No newline at end of file -- GitLab