Commit Graph

21 Commits

Author SHA1 Message Date
Marko Lovic
c0f6fa182f Make Milestones general, and not specific to Budget Investments
Generalize the Budget::Investment::Milestone model to a
polymorphic Milestone model so it can be used for entities
other than Budget::Investment.
2018-11-30 14:15:21 +01:00
Javi Martín
dbea577062 Follow naming conventions for HTML classes and IDs
We use underscores for IDs and hyphens for classes.
2018-10-22 16:36:18 +02:00
Javi Martín
34b5a88564 Fix updating translatables without current locale
The current locale wasn't being marked for destruction and so saving
the record tried to create a new translation for the current locale.
2018-10-22 16:36:17 +02:00
Javi Martín
7479223d59 Wrap translation fields in a div
This way we can show/hide that div when displaying translations, and we
can remove the duplication applying the same logic to the label, the
input, the error and the CKEditor.

This way we also solve the problem of the textarea of the CKEditor
taking space when we switch locales, as well as CKEditor itself taking
space even when not displayed.
2018-10-22 16:36:17 +02: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
Javi Martín
3c170f47d2 Update site customization pages translatable fields 2018-10-22 16:13:48 +02:00
Javi Martín
e0b9c1bfdd Update poll question answers translatable fields
We needed to bring back support for CKEditor in our translatable form,
which we had temporarily remove.

And now we support CKEditor in our translatable specs, and so we can
remove the duplicated specs for poll question answers.
2018-10-22 16:13:48 +02:00
Javi Martín
6278175f57 Update legislation drafts translatable fields
Updating it required reorganizing the form so translatable fields are
together.

We also needed to add a `hint` option to the form label and input
methods so the hint wouldn't show up for every language.

Finally, the markdown editor needed to use the same globalize attributes
as inputs, labels and hints, which adds a bit of duplication.
2018-10-22 15:44:14 +02:00
Javi Martín
96b3a37222 Disable removed translations
After removing a translation while editing another one with invalid data
and sending the form, we were displaying the removed translation to the
user.

We now remove that translation from the form, but we don't remove it
from the database until the form has been sent without errors.
2018-10-22 15:43:28 +02:00
Javi Martín
7deb857357 Don't disable new invalid translations
After adding a new translation with invalid data and sending the form,
we were disabling the new translation when displaying the form again to
the user, which was confusing.
2018-10-22 15:43:28 +02:00
Javi Martín
1d2979cd57 Keep invalid translation params through requests
We were reloading the values from the database and ignoring the
parameters sent by the browser.
2018-10-22 15:43:28 +02:00
Javi Martín
71601bd3f8 Validate translations in banners
This change forces us to use nested attributes for translations, instead
of using the more convenient `:"title_#{locale}"` methods.

On the other hand, we can use Rails' native `_destroy` attribute to
remove existing translations, so we don't have to use our custom
`delete_translations`, which was a bit buggy since it didn't consider
failed updates.
2018-10-22 15:43:28 +02:00
voodoorai2000
6f978b9f4e Fix portuguese specs 2018-10-09 18:32:59 +02:00
Javi Martín
5bb5cfa7fb Make Widget::Card translatable 2018-09-26 16:09:09 +02:00
Raimond Garcia
4086220ebf Merge pull request #2914 from microweb10/make_polls_translatable
Make polls translatable
2018-09-26 13:19:17 +02:00
Julian Herrero
df9955e0c6 make use of the new spec helper it_behaves_like translatable 2018-09-21 20:52:35 +02:00
Marko Lovic
64d72ca8e7 Enable JS in shared translatable test
Due to its markdown editor, the admin draft version page
requires JS to correctly render the draft version form.
2018-09-19 14:54:24 +02:00
Marko Lovic
f6749049c9 Make Admin Notifications translatable 2018-09-19 12:15:26 +02:00
Javi Martín
0552616764 Use have_field to detect text input contents
Using `have_content` detected textareas, but not text input contents.

All credit to Marko (mlovic) for finding the issue and suggesting the
implemented solution.
2018-09-17 20:34:43 +02:00
Javi Martín
612fdb09dd Share translatable specs 2018-09-17 20:34:43 +02:00
Javi Martín
726110c91e Share Globalize JavaScript interface specs 2018-09-17 20:34:20 +02:00