Commit Graph

15065 Commits

Author SHA1 Message Date
taitus
1d4bde46d6 Align admin legislation milestones summary form fields with new translations interface 2019-07-01 14:49:44 +02:00
taitus
9695b0c720 Align admin legislation homepages form fields with new translations interface 2019-07-01 14:49:44 +02:00
taitus
a7dcc61ab4 Align admin legislation draft version form fields with new translations interface 2019-07-01 14:49:44 +02:00
taitus
944e502605 Align admin budget form fields with new translations interface 2019-07-01 14:49:44 +02:00
taitus
44ee8aa0c0 Align admin budget_headings form fields with new translations interface 2019-07-01 14:49:44 +02:00
taitus
fb39e6c09e Align admin budget_groups form fields with new translations interface 2019-07-01 14:49:44 +02:00
taitus
6c0f9165c7 Align admin budget_phases form fields with new translations interface 2019-07-01 14:49:44 +02:00
taitus
cd5095cf68 Align admin_notifications form fields with new translations interface 2019-07-01 14:49:44 +02:00
taitus
07577a050c Cover special translation interface behavior at admin information texts
When not yet exists I18nContentTranslation languages,
SiteCustomization::InformationText section render I18n.locale by
default. This was causing that `languages in use` description and
default selected language were incorrectly initialized.
2019-07-01 14:49:44 +02:00
Senén Rodero Rodríguez
0bbc6be141 Add specs to check how visibility of translations interface behaves
Co-Authored-By: Sebastia <sebastia.roig@gmail.com>
2019-07-01 14:49:44 +02:00
Senén Rodero Rodríguez
c0b4bb67eb Adapt shared specs to new translations interface 2019-07-01 14:49:44 +02:00
Senén Rodero Rodríguez
faed5857c3 Adapt specs to new translation interface
As translatable translations already exists in these specs it has more
sense to me to use select_language intead of adding an already existing
language. Anyway both versions behaves the same and specs pass.
2019-07-01 14:49:43 +02:00
Senén Rodero Rodríguez
f7417d6479 Adapt specs to new translations interface markup 2019-07-01 14:49:43 +02:00
Senén Rodero Rodríguez
721710be79 Fix script to manage visibility of progress bar translations
After markup changes we need to update DOM selector used to hide/show
translations.
2019-07-01 14:49:43 +02:00
Senén Rodero Rodríguez
5ada975448 Adapt globalize helper methods to new translation interface markup 2019-07-01 14:49:43 +02:00
Senén Rodero Rodríguez
05562c190f Adapt translations CS to new translation interface markup
Now we are using different html markup to render new translation interface
in a responsiveness way so we had to adapt CS to cover new behavior.
2019-07-01 14:49:43 +02:00
Senén Rodero Rodríguez
4d15815843 Add reusable methods to common actions translations module
Because we do this same expectation from a lot of specs.
2019-07-01 14:49:43 +02:00
Senén Rodero Rodríguez
9fd77d4042 Add languages in use description
New interface now shows a description to ensure the user
knows how many languages are currently in use.
2019-07-01 14:49:43 +02:00
Senén Rodero Rodríguez
db70594fca Add column class to keep proper alignment of forms
When translations interface is enabled we also want to keep
proper alignment between translatable and not translatable fields.

Co-Authored-By: alessandro <agileontheweb@gmail.com>
2019-07-01 14:49:43 +02:00
Senén Rodero Rodríguez
3ef8ef8c9c Add class to set padding-top to any element 2019-07-01 14:49:43 +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
6183f14d9d Move translations interface after heading selector
Co-Authored-By: alessandro <agileontheweb@gmail.com>
2019-07-01 14:49:43 +02:00
Senén Rodero Rodríguez
146c09adb7 Update references to new translation interface 2019-07-01 14:49:43 +02:00
Senén Rodero Rodríguez
140c37fcc0 Render translation interface only when feature setting is active 2019-07-01 14:49:43 +02:00
Senén Rodero Rodríguez
01bb0b9c6b Move translation interface to views root shared folder
As we are going to call this partial from any application view it will
have more sense to place it at `app/views/shared`.
2019-07-01 14:49:43 +02:00
voodoorai2000
83b43c6bc6 Fix milestone translatable specs
Milestones do not have an author so we can not update that attribute.

Adding this conditional fixes this spec: ./spec/features/admin/budget_investment_milestones_spec.rb[1:1:1:10]
2019-06-27 10:07:38 +02:00
voodoorai2000
251326ea9a Revert removal of translated attributes from default tables
We removed these columns from their original tables as Globalize raises a warning when making queries on the corresponding translated columns.

Since then we have decided to migrate from Globalize to Mobility, which does not raise these warnings.

We are still concerned about possible inconsistencies in the database due to maintaining these columns. However until we clear the problems out with the Mobility support team we are bringing them back.
2019-06-27 09:21:19 +02:00
voodoorai2000
875ae1f487 Add spec for translated budget poll name
This spec fails if we remove the attribute `name` from `poll_params` in
the `Admin::Poll::PollsController`, which we would usually remove
because it's a translatable attribute.
2019-06-27 09:21:19 +02:00
voodoorai2000
53b4c12439 Use correct interpolation variable
This view[1] has changed and now uses `handle` instead of `org`. The Dutch translations, used in this view, had not been updated yet and when used in specs[2] it was raising a variable interpolation error.

[1] https://github.com/consul/consul/blob/master/app/views/budgets/investments/_investment_show.html.erb#L197

[2] rspec ./spec/features/budgets/investments_spec.rb[1:2:5:1:2]
2019-06-27 09:21:19 +02:00
voodoorai2000
338fecc7c7 Use retired trait in specs
This fixes a validation error being raised in these specs, as we were
missing some attributes that are required. Using the factory trait the
missing attributes are correctly filled out.
2019-06-27 09:21:19 +02:00
voodoorai2000
2acba1c5db Use Rails 5 syntax to set referer in specs
The previous way was working fine with Rails 4, but now the referer was
returning nil and therefore raising an error in this spec.
2019-06-27 09:21:19 +02:00
taitus
1e084017d6 Fix style for remote-translation-button 2019-06-27 09:21:19 +02:00
taitus
44da3126d6 Convert AvailableLocales from Module to Class 2019-06-27 09:21:19 +02:00
taitus
3a154a57cb Fix houncibot offenses: Style/StringLiterals 2019-06-27 09:21:19 +02:00
taitus
aad6491049 Add remote translations to welcome 2019-06-27 09:21:19 +02:00
taitus
b3ae9038c3 Add remote translations to budget investments 2019-06-27 09:21:19 +02:00
taitus
c1f3a4ad3b Add remote translations to debates and proposals
Include RemotelyTranslatable concern on commentable actions to detect
remote translations on index and show controllers actions.
2019-06-27 09:21:19 +02:00
taitus
b6642f826e Shared example remotely translatable
We have 2 contexts that we want check:
  - Status from button to request translation
  - Status after click remote translations button
2019-06-27 09:21:19 +02:00
taitus
395143ba5a Display button or informative text
When all remote translations are enqueued we not display button but
we display informative text.

Co-Authored-By: alessandro <agileontheweb@gmail.com>
2019-06-27 09:21:19 +02:00
taitus
72d1893703 Manage the remote translation button display
- Add remote_translation_button partial to layout
- Only display button when we have remote_translations and if current
  locale is include on available locales from remote translations service.
- Recover available locales from remote translations service.
  Use daily_cache to detect every day if remote translation service has
  added new available locale.

Co-Authored-By: alessandro <agileontheweb@gmail.com>
2019-06-27 09:21:18 +02:00
taitus
cbd7ab7179 Add remote translation button
- Create partial to render remote translation button. This button will
  send remote_translations as json to remote translations controller.
- Add locales
- Add styles

Co-Authored-By: alessandro <agileontheweb@gmail.com>
2019-06-27 09:21:18 +02:00
taitus
6ad294e71f Fix houncibot offenses. 2019-06-27 09:21:18 +02:00
taitus
1d3dd6f727 Add RemoteTranslationsCaller to new namespace
- Rename to Caller
 - Add to new namespace RemoteTranslations
 - Update references to new namespace
2019-06-27 09:21:18 +02:00
taitus
510307b0bd Add SentencesParser to new namespace
Add to new name space RemoteTranslations::Microsoft
2019-06-27 09:21:18 +02:00
taitus
4c1704a5a3 Add RemoteAvailableLocales to new namespace
Add to new name space RemoteTranslations::Microsoft and rename to
AvailableLocales.
2019-06-27 09:21:18 +02:00
taitus
d29656d78f Add MicrososftTranslateClient to new namespace
- Rename to Client
- Add to new namespace RemoteTranslations::Microsoft
- Update references to new namespace
2019-06-27 09:21:18 +02:00
taitus
91ba5ff879 Fix flakys specs 2019-06-27 09:21:18 +02:00
taitus
d2506358ef Fix found Hound violations 2019-06-27 09:21:18 +02:00
taitus
abb81fccf4 Allow create translations without length validation
We have changed validate_translation method on Globalize concern.
The objective is skip length validations when locale is distinct to
default_locale.

First we force apply :length validations when locale is equal to
default_locale. After we reject :length from options and apply rest
of validation options only when we have more than 1 options.

Ej: options = { length: "maximum: 10" }
When reject :length option in this example, options is equal to a
empty hash and we cant execute validations.
2019-06-27 09:21:18 +02:00
taitus
21f347778b Add Remote Translations Settings
- Add to seeds and dev_seeds
- Add locales
2019-06-27 09:21:18 +02:00