Commit Graph

2102 Commits

Author SHA1 Message Date
voodoorai2000
59b35156b1 Fix flaky spec
`I18n.available_locales=` does a little magic[1] and was causing some flakieness along the way, as the `:wl` locale persisted in future specs

Thanks for the heads up @javierm 👌

[1] https://www.rubydoc.info/github/svenfuchs/i18n/I18n%2FConfig:available_locales=
2018-10-09 22:15:05 +02:00
voodoorai2000
6f978b9f4e Fix portuguese specs 2018-10-09 18:32:59 +02:00
voodoorai2000
9d7042c5ae Adds missing language name translations 2018-10-05 18:08:47 +02:00
voodoorai2000
0a0261900c Display language name or language key
There where two issues with the current implementation:

- There was a possible duplication between looking up the language name in key "locale" and in key "i18n.language.name"

- The "default" option was not being picked up, as the fallback always returned the default locale's translation, "English"

With this implementation there is only a single place to put the language name: i18n.language.name. I think this place is easier to find and understand for Crowdin translators than a "locale" key hidden in general.yml

If the translation is not found we display the language key, instead of English, which makes more sense to me too 😌

Solution based on recent comments[1] on a related I18n issue

[1] https://github.com/svenfuchs/i18n/issues/365#issuecomment-419263847
2018-10-05 18:08:41 +02:00
Javi Martín
ec18743251 Authorize resource after authenticating user
Just like it's done everywhere else in the application. Not doing so
means users who aren't logged in receive a "you aren't authorized"
message when they try to create a new legislation proposal instead of
being redirected to the login page.
2018-10-03 22:06:20 +02:00
María Checa
388c1a9bd9 Improved tests 2018-10-03 16:02:41 +02:00
María Checa
d73be15296 Added tests 2018-10-03 16:02:41 +02:00
Bertocq
52df63c2aa Add legislation proposal feature scenario to check random order is consistent with pagination 2018-10-03 13:46:32 +02:00
Bertocq
89b8e51a93 Add helper function to get legislation proposals list order on feature spec 2018-10-03 13:46:32 +02:00
Bertocq
d36e47c740 Add legislation proposal spec, with random list order scenario 2018-10-03 13:46:00 +02:00
Javier Martín
132fea9c94 Merge pull request #2913 from papayalabs/2741-updates-translatable-custom-pages-reloaded
Updates translatable custom pages
2018-10-03 13:23:13 +02:00
Javier Martín
2775ae2b50 Merge pull request #2924 from consul/backport-1588-make-homepage-content-translatable
Make homepage content translatable
2018-10-03 13:20:49 +02:00
Alberto
857f747ab8 Merge pull request #2922 from consul/legislation-proposals-imageable
Legislation proposals imageable
2018-10-02 11:22:19 +02:00
decabeza
7c194f6042 Adds imageable to legislation proposals 2018-10-01 16:48:46 +02:00
decabeza
dd11a040a6 Adds setting to enable or disable help page 2018-09-28 18:59:28 +02:00
Papaya Labs
3f9dea080b Check title and slug in spec 2018-09-28 09:43:00 +02:00
Papaya Labs
914bfa645e Updates translatable custom pages 2018-09-27 13:46:17 +02:00
Javi Martín
1ffaa680a3 Create correct translation when visiting root page
We set `I18n.locale = :en` before each test, and so creating a new card
will automatically create English translations.

So visiting the Spanish page won't show the card, since no Spanish
translation exists for it. If we visit the klingon page after doing so,
the last used locale (Spanish) will still be used, and so the test will
fail.

Specifically creating Spanish translations instead of the English ones
makes the translations visible when visiting the Spanish homepage.
2018-09-26 16:09:09 +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
Raimond Garcia
1fbb428004 Merge pull request #2898 from papayalabs/2889-show-active-tab-in-custom-info-texts
Show active tab in custom info texts
2018-09-24 21:11:25 +02:00
Papaya Labs
45da512ce9 Add Spec 2018-09-24 20:38:42 +02:00
Javier Martín
ef0192c3ff Merge pull request #2912 from consul/backport-make-collaborative-legislation-translatable
Make collaborative legislation translatable
2018-09-24 17:45:59 +02:00
Javier Martín
758d3f8541 Merge pull request #2911 from consul/backport-fix_time_related_specs
Fix time related specs
2018-09-24 17:43:22 +02:00
Julian Herrero
df9955e0c6 make use of the new spec helper it_behaves_like translatable 2018-09-21 20:52:35 +02:00
decabeza
a1bbc82c8d Changes allegations dates label 2018-09-20 17:33:04 +02:00
Julian Herrero
673ec075eb Make answers translatable 2018-09-20 17:13:40 +02:00
Julian Herrero
5e6248d2ac Make questions translatable 2018-09-20 17:11:53 +02:00
Julian Herrero
9495208518 Make polls translatable 2018-09-20 17:07:43 +02:00
Javi Martín
4d238c5d07 Fix crash updating legislation process categories
We were expecting translation parameters in legislation processes
`update` action. However, those parameters aren't sent when we get to
that action through the "proposals" tab.
2018-09-19 14:54:52 +02:00
Javi Martín
58ad333791 Remove duplicate lines 2018-09-19 14:54:52 +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
05bfa193cd Make Legislation Draft Versions translatable 2018-09-19 14:54:24 +02:00
Marko Lovic
06347062dd Make Legislation Questions translatable 2018-09-19 14:54:24 +02:00
Marko Lovic
d78aea1fd3 Make Legistlation Processes translatable 2018-09-19 14:54:24 +02:00
Javi Martín
86aa56b5e8 Fix flaky legislation processes specs
They were failing if executed right before midnight. If the process is
created right before midnight and then the date changes, when we visit
the process path the phase will aready be open.
2018-09-19 14:24:09 +02:00
Javi Martín
c1bb1fb2e1 Fix flaky admin notifications spec
It was failing when executed right before midnight due to the date
changing between the moment the notification is created and the moment
the test checks the notification shows the current date.
2018-09-19 14:21:47 +02:00
Javi Martín
ec3d4c4449 Fix flaky officing dashboard spec
It was failing when executed right before midnight due to today's
officer assigments changing during the test.
2018-09-19 14:12:32 +02:00
Javi Martín
b787e33883 Use the same system to freeze time in all specs
This required changing the `voted_before_sign_in` slightly in order to
change what the method returns if the user signed in and voted at the
exact same microsecond.

It doesn't affect production code because it would be impossible for the
user to do both things at the same time.

As a side effect, the method now returns what the method name suggests.
Before this change, the correct method name would have been
`voted_before_or_at_the_same_time_of_sign_in`.

As a less desirable side effect, in the tests now we need to make sure
at least one second passes between the moment a user votes and the
moment a user signs in again. One microsecond wouldn't work because
the method `travel_to` automatically sets microseconds to zero in order
to avoid rounding issues.
2018-09-19 14:11:50 +02:00
Javi Martín
02b8bc6f69 Simplify the way to freeze time in specs 2018-09-19 14:10:18 +02:00
Marko Lovic
f6749049c9 Make Admin Notifications translatable 2018-09-19 12:15:26 +02:00
Marko Lovic
5ff85d33d6 Fix submit button text for Admin Notifications admin form
In Madrid, the button text didn't change depending on whether the form
is for the "new" page or for the "edit" page.

In consul, the buttons texts were "create admin notification" and
"update admin notification" instead of "create notification" and "update
notification".

Also change translation key from "submit" to "submit_button" to
match other instances.
2018-09-19 12:05:18 +02:00
María Checa
eeb7463ff4 Merge pull request #2860 from consul/backport_1582-icon-polls
[Backport] Adds status icons on polls poll group
2018-09-18 12:42:37 +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
Raimond Garcia
cae210c155 Merge pull request #2887 from wairbut-m2c/backport/db_queries
[Backport] Replace `.all.each` with `.find_each` to reduce memory usage
2018-09-17 19:06:46 +02:00
Raimond Garcia
eb435930db Merge pull request #2888 from wairbut-m2c/backport/test-suite-maintenance
[Backport] Test suite maintenance
2018-09-17 19:06:07 +02:00
Javi Martín
29b9f172f6 Fix test for Portuguese
It fails because we try to follow a link without a Portuguese
translation. In Madrid they use Spanish as fallback, but in consul we
use English as fallback, and so the text in the link is different in
those repos.

A proper solution would be to update the Portuguese locales. However,
since this test is going to be removed in our next backport, I'm just
doing a quick patch.
2018-09-12 10:52:00 +02:00
Marko Lovic
d2dd5f2a58 Test Translatable logic with a locale with non-underscored name
In the past there have been issues with the `pt-BR` locale because
it has a hyphen `-` and a uppercase letters.

I am adding the test only to spec/features/translations_spec.rb (which
tests Milestones) for now. We might want to also add it to the other
translatable resource specs in the future (banners, etc.).
2018-09-11 18:48:23 +02:00
Angel Perez
d86103db5a Disable unnecessary JS usage on comments/topics specs 2018-09-10 11:45:41 -04:00