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

@@ -39,8 +39,7 @@ describe "Local Targets" do
scenario "Shows succesful notice when form is fullfilled correctly" do
visit new_sdg_management_local_target_path
target = SDG::Target["1.1"]
select "1.1. #{target.title}", from: "Target"
select "1.1. Eradicate Extreme Poverty", from: "Target"
fill_in "Code", with: "1.1.1"
fill_in "Title", with: "Local target title"
fill_in "Description", with: "Local target description"
@@ -53,8 +52,7 @@ describe "Local Targets" do
scenario "Shows form errors when not valid" do
visit new_sdg_management_local_target_path
target = SDG::Target["2.3"]
code_and_title = "2.3. #{target.title}"
code_and_title = "2.3. Double the Productivity and Incomes of Small-Scale Food Producers"
select code_and_title, from: "Target"
click_button "Create local target"