Add short titles to SDG targets

Since targets didn't have a title but only a long description, every
form allowing to select targets was pretty much unusable: we either
displayed just the code or the whole description.

Now, with a concise title, it's easier to find and select the desired
target.

The titles have been copied from The Global Goals page [1].

Note we're using the `short_title` I18n key for the `title` method and
the `long_title` I18n key for the `long_title` method. We can't use
`title` as I18n key instead of `short_title` because it would affect
existing translations.

[1] https://www.globalgoals.org/
This commit is contained in:
Javi Martín
2021-08-25 23:31:09 +02:00
parent 7f9a05d052
commit c025fef50b
17 changed files with 828 additions and 381 deletions

View File

@@ -119,4 +119,12 @@ describe SDG::LocalTarget do
expect { SDG::LocalTarget["1.1.99"] }.to raise_exception ActiveRecord::RecordNotFound
end
end
describe "#long_title" do
it "returns the title" do
target = build(:sdg_local_target, title: "Improve local water transport system")
expect(target.long_title).to eq "Improve local water transport system"
end
end
end