Commit Graph

21 Commits

Author SHA1 Message Date
Angel Perez
ee2b87aedf Use .where clause first when calling .destroy_all method 2019-04-17 17:40:55 +02:00
Julian Herrero
d24376f6ad Use double quotes in controllers/ 2019-03-13 22:19:49 +01:00
Javi Martín
00983200d4 Update information texts translatable fields
This part used the code we deleted in order to make it easier to
refactor the rest of the translatable models. Now we add the code back.
2018-10-22 16:36:12 +02:00
Angel Perez
1835bac7e4 Avoid ternary operator usage when appending/creating I18n keys
When using the OR operator, if the left side of the expression evaluates
to false, its right side is taken into consideration. Since in Ruby nil
is false, we can avoid using conditionals for this particular scenario
2018-10-22 16:35:01 +02:00
Angel Perez
05890602fd Fix Rubocop warnings [ci skip] 2018-10-22 16:34:57 +02:00
Raúl Fuentes
bdf12ebdfb Move flat_hash to I18nContent model
also add unit tests for this function and a description
into the model of the behaviour of the function
2018-10-22 16:33:01 +02:00
Marko Lovic
54d0068134 Remove unused code
This method has never been used as far as I've
been able to tell from the git history.
2018-09-10 17:33:50 +02:00
Marko Lovic
3c4f221e04 Change Translatable interface 2018-09-10 17:32:49 +02:00
Marko Lovic
4603a30f95 Change Translatable impl to keep track of enabled locales 2018-09-10 17:18:01 +02:00
rgarcia
ea4f079588 Do not store missing translations in DB
When visiting http://localhost:3000/admin/site_customization/information_texts?locale=fr
and creating a translation, other languages where storing translations in db with
the following values:
"<span class=\"translation_missing\" title=\"translation missing: es.debates.index.search_results.one\">One</span>">

With this commit we are not storing this translations

Note that this only happened when using a param[:locale] in the url at least for french
2018-07-26 21:55:08 -04:00
rgarcia
4c8b174274 Display only translations for the current language
After creating a translation in spanish, it was also displaying it when selecting
the english locale.

This was due to the code picking the first translation available

With this commit, we are checking for an existing translation in the current locale
and displaying it if it exists
2018-07-26 21:55:07 -04:00
Angel Perez
8015596cb8 Replace hardcoded update notice when updating translations with proper I18n 2018-07-26 20:49:12 -04:00
rgarcia
461a172bd2 Refactor translations loading for current locale 2018-07-26 20:49:01 -04:00
rgarcia
feb3df1f93 Initialize I18n.backend translations
We were getting a 500 error because the translations had not been initialized
https://stackoverflow.com/a/4054527
2018-07-26 20:49:00 -04:00
rgarcia
82f496ccfa Fix globalization for information texts
Refactoring and making similar specs to the milestones globalization specs
2018-07-26 20:48:56 -04:00
Angel Perez
5c1e0bd949 Don't use hardcoded locale when appending/creating I18n keys 2018-07-26 19:07:11 -04:00
Angel Perez
a190e3e1e0 Fix exception for undeclared variable on InformationTexts#index action 2018-07-26 19:06:54 -04:00
Angel Perez
f92006b3f3 Extract complex logic from InformationTexts#index into separate private methods 2018-07-26 19:06:37 -04:00
Angel Perez
26965b43ee Clean I18n codebase 2018-07-26 19:06:29 -04:00
Raúl Fuentes
6d6dc32c38 Complete basic I18n backend and frontend 2018-07-26 19:06:19 -04:00
Raúl Fuentes
c18479e3ac Add translations management pages
In the admin section of the application, a new page
has been added so that the admins are able to manage
the selected texts for translate.

The texts have been divided in different "sections",
depending on the nature of themselves (budgets, polls,
proposals, management, etc.). Each section has become a tab
with a form associated to edit all the texts for her.

When a language is added, it's added for ALL the texts in the
application. That means that, if an admin adds french for debates,
the french form will appear for the rest of the texts. That doesn't
mean that they need to fill all the texts, only that the languages
work for all of them instead of individually.
2018-07-26 19:05:58 -04:00