taitus
a5a62b7471
Add Tracking to backend_translations_enabled?
2019-07-01 15:03:48 +02:00
Senén Rodero Rodríguez
a6e8fecc16
Highlight translation interface and translatable form fields
...
Only when translations interface is enabled.
Co-Authored-By: alessandro <agileontheweb@gmail.com >
2019-07-01 14:49:43 +02:00
Senén Rodero Rodríguez
73563e5d86
Display needed translations when translation interface is disabled
...
Display only current locale translation when translation interface is disabled.
Co-Authored-By: javierm <javim@elretirao.net >
2019-06-27 09:20:25 +02:00
Senén Rodero Rodríguez
7e3f0b5c18
Add translation interface feature setting
...
Allow to enable/disable translation interface at frontend
2019-06-27 09:20:25 +02:00
German Galia
74083df10f
Add historic fields to participatory budget
2019-06-12 18:03:53 +02:00
Senén Rodero Rodríguez
f87804aa90
Update helpers after globalize gem version update
...
Globalize has fixed new translations globalized_model initialization
so we have to adapt existing code.
2019-04-17 17:40:55 +02:00
Javi Martín
2a1b50beba
Extract method to render form fields for a locale
2018-10-22 16:36:18 +02:00
Javi Martín
361a15640f
Use detect instead of select.first
2018-10-22 16:36:18 +02:00
Javi Martín
1895e2dd2f
Make it easier to know destroy_field is an input
...
By using the input and finding it by its name, it's easier to see the
difference between this input and the delete-language link.
2018-10-22 16:36:18 +02: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
0505028d77
Extract method in translatable builder
...
This way we fix the rubocop warning for line too long and make the code
a bit easier to read.
2018-10-22 16:36:17 +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
6d6eb1f849
Fix ambiguous field in test
2018-10-22 16:36:17 +02:00
Javi Martín
1255aa5032
Make private methods private
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
ffb8207f84
Show error message for just the displayed locale
...
Unfortunately the builder didn't offer any options for the error message
and we just had to overwrite the `error_for` methods.
2018-10-22 16:36:17 +02:00
Javi Martín
3b5a12b0ab
Don't force translations for the current locale
...
Globalize creates a translation for the current locale, and the only way
I've found to change this behaviour is to monkey-patch it.
The original code uses `translation.locale` instead of
`Globalize.locale`. Since `translation.locale` loads the translation
with empty attributes. It both makes the record invalid if there are
validations and it makes it almost impossible to create a record with
translations which don't include the current locale.
See also the following convertations:
https://github.com/globalize/globalize/pull/328
https://github.com/globalize/globalize/issues/468
https://github.com/globalize/globalize/pull/578
https://github.com/shioyama/mobility/wiki/Migrating-from-Globalize#blank-translations
2018-10-22 16:28:53 +02:00
Javi Martín
124b8496de
Simplify methods defining translation styles
...
This refactor is going to be useful when we change these rules within
the next few commits.
2018-10-22 16:28:53 +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
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
5cdda12902
Simplify passing the locale to translatable fields
...
Creating a new form builder might be too much. My idea was so the view
uses more or less the same syntax it would use with Rails' default
builder, and so we can use `text_field` instead of
`translatable_text_field`.
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
Julian Herrero
4344165bce
change translatable form helper for cktext_area
2018-09-24 19:40:51 +02:00
Julian Herrero
e6762d6bca
handle non-underscored locale names for cktext_area
2018-09-21 20:50:23 +02:00
Marko Lovic
c7fcdd9b0e
Use standard locale names for Globalize
...
It turns out it is not necessary to downcase and underscore
locale names to use the globalize-accessor gem. The gem
will automatically underscore the locale name when defining and
calling the accessor methods.
2018-09-11 18:48:14 +02:00
Marko Lovic
6fe7dc22bc
Fix translatable field labels to not include locale
...
Label for field :title should be "Title", not "Title en"
2018-09-11 18:48:09 +02:00
Marko Lovic
ca5f8719a8
Fix helper to merge style option correctly
2018-09-11 18:48:05 +02:00
Marko Lovic
1fb1437886
Fix merging_translatable_field_options helper
2018-09-11 18:48:01 +02:00
Marko Lovic
5ad3bf03cd
Nest TranslatableFormBuilder in helper module
...
To avoid having multiple top-level classes per file
2018-09-11 18:47:57 +02:00
Marko Lovic
e26500179a
Add missing blank line between methods
2018-09-11 18:47:52 +02:00
Marko Lovic
38e6c394e7
Change string manipulation to use interpolation for readability
2018-09-11 18:47:48 +02:00
Marko Lovic
b9f3ea2a33
Change variable name to reflect possibility of being array
2018-09-11 18:47:43 +02:00
Marko Lovic
7b0aa1e104
Extract merge_translatable_field_options helper method
2018-09-11 18:47:34 +02:00
Marko Lovic
61e3b3b406
Incorporate label into translatabel field
...
Suggested by @javierm so that we can take advantage of certain browser
features that rely on a <label> tag being associated with an <input> tag.
2018-09-11 18:47:28 +02:00
Marko Lovic
2cb3e4b111
Extract translatable field logic to FormBuilder
2018-09-11 18:46:50 +02:00