Commit Graph

290 Commits

Author SHA1 Message Date
Senén Rodero Rodríguez
64bfab9c9c Extract spec methods to commons module to avoid code duplication
Because "translatable" and "new_translatable" shared examples needs same methods to manipulate translations.
2019-06-27 09:20:25 +02:00
Senén Rodero Rodríguez
673fecf92a Add "new_translatable" shared example to check creation of translatable records
The existing shared example 'translatable' only works for edit actions.
This shared example allow us to check how translations behaves at new
resource pages.

Now this shared specs only works with Proposals, Budget::Investments and
Debates.
2019-06-27 09:20:24 +02:00
Senén Rodero Rodríguez
661ca5a568 Add budget investments translation interface
* Adapt translatable spec helper method to work with budget investments
* Remove old attributes from strong parameters
* Add missing locales to admin.yml and budgets.yml
* Change SpendingProposal.title_max_length and
  SpendingProposal.description_max_lenght to Budget::Investment methods
* Add budget investment translatable attribute translations
2019-06-27 09:20:24 +02:00
Senén Rodero Rodríguez
5eb5f02cbe Fix budget investment specs
After adding investment translatable fields to forms, they will be
generated with nested translations names and ids so we can no longer
use standard id locator.

Using input label text to fill in fields works with both types of forms.
2019-06-27 09:20:24 +02:00
Senén Rodero Rodríguez
78c2f54c5d Fix proposal specs
After adding proposal translatable fields to forms, they will be generated with nested translations names and ids so we can no longer
use standard id locator.

Using input label text to fill in fields works with both types of forms.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
02be0c61f9 Add proposal translations
Adapt retire form to include needed translations and move validations
from controller to model.

Also change sanitizable concern to sanitize not marked for destruction
translations.
2019-06-27 09:19:36 +02:00
taitus
98074a9a73 Refactor specs from shared translatable 2019-06-27 09:19:36 +02:00
taitus
1687fb3a7b Fix specs budget_phases_spec.rb:13 2019-06-27 09:19:36 +02:00
taitus
2964d91303 Fix specs active_polls_spec.rb:10 2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
ba9e9887ed Set globalize fallbacks for requests
New version of globalize uses RequestStore gem to store I18n.locale and
Globalize.fallbacks in a per request basis to avoid collissions between
different requests. This gem update broke Globalize.fallback results
because it tries to fetch fallbacks from RequestStore, where there is no
locale fallbacks definition.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
3d04b388ad Adapt translatable shared specs
Adapt translatable shared specs to define an owner when running at
frontend feature specs.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
5881f8241e Sanitization shared spec
Create sanitization shared spec to check sanitizable concern features
in all translatable models.
2019-06-27 09:19:36 +02:00
Senén Rodero Rodríguez
db38a87205 Add specs to check how paranoia and globalize work together
Create shared model spec to test paranoia and globalize behavior on
globalizable and paranoid models.
2019-06-27 09:19:35 +02:00
German Galia
9ce524e1f3 Create tracker rol 2019-06-12 16:23:40 +02:00
Julian Herrero
8e0bbf54f6 Replace harcoded images and documents settings 2019-06-04 11:50:09 +02:00
Javi Martín
307cf24846 Use describe on feature tests
The `type: :feature` is automatically detected by RSpec because these
tests are inside the `spec/features` folder. Using `feature` re-adds a
`type: :feature` to these files, which will result in a conflict when we
upgrade to Rails 5.1's system tests.

Because of this change, we also need to change `background` to `before`
or else these tests will fail.
2019-05-28 16:36:54 +02:00
decabeza
0c704c2f06 Replace i18n destroy to delete 2019-05-17 17:41:38 +02:00
decabeza
f40787561d Remove all references to question and external_url fields 2019-04-30 16:42:07 +02:00
decabeza
07fd5084f7 Show request to admins and short description only for resources 2019-04-24 14:01:04 +02:00
decabeza
cb22e6cbfb Merge branch 'master' into proposal-dashboard 2019-04-23 17:12:47 +02:00
rgarcia
f23fd6f3bb Remove parameterise deprecation warning
DEPRECATION WARNING: Passing the separator argument as a positional
parameter is deprecated and will soon be removed. Use `separator: '_'`
instead.
2019-04-17 17:40:55 +02:00
decabeza
2af154d539 Merge branch 'master' into proposal-dashboard 2019-03-28 01:26:04 +01:00
decabeza
91be3cf775 Fix more hound warnings 2019-03-27 15:22:14 +01:00
decabeza
f47ec9d7dc Fix hound warnings 2019-03-26 18:21:19 +01:00
decabeza
eda6ea7f12 Merge branch 'master' into dashboard 2019-03-26 16:45:48 +01:00
Javi Martín
2b4e1cf358 Add missing double quotes
We overlooked a few single quotes while we changed thousands of them.
2019-03-25 13:22:35 +01:00
Julian Herrero
884274c4ad Add a description for open polls 2019-02-18 13:34:07 +01:00
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +01:00
Julian Herrero
922600252c Make budget headings translatable 2019-02-13 13:35:07 +01:00
Julian Herrero
1c35ec99c1 Make budget groups translatable 2019-02-13 12:30:37 +01:00
Julian Herrero
90d0a6e416 Make budget phases translatable 2019-02-13 11:44:56 +01:00
Julian Herrero
60ce72f3a0 Make possible to check for more than one ckeditor in the same form.
When more than one ckeditor field this line was raising the error:
"Ambiguous match, found 2 elements matching visible css"
2019-02-13 11:42:27 +01:00
Julian Herrero
dbdbcd662a Remove extra check
Sometimes when updating a resource you are not redirected to the same
resource, you are maybe redirected to the parent resource and the
translations can be different. This condition will be checked after
visiting the edit_path again.
2019-02-13 11:42:18 +01:00
Julian Herrero
d76782f150 Make budgets translatable 2019-02-13 11:41:58 +01:00
Julian Herrero
2eb2839ab0 Reload path for sluggable models
Sluggable models can update the slug when updating new translations,
so we make sure the path is correct before using it.
2019-02-13 11:29:43 +01:00
taitus
a4673c8b3e Add shared nested_documentable specs to admin dashboard actions specs.
Not render Documents count on dashboard actions views.
Add skips on nested_documentable when factory_name is equal to dashboard_actions.
2019-02-02 15:30:35 +01:00
decabeza
d650b90e25 Adds missing backport content on progressable specs 2019-01-24 18:33:26 +01:00
Javi Martín
97ef69ee33 Rename progressable specs to admin_progressable
We're going to introduce progress bars in the public view as well, and
it's more consistent with "admin_milestoneable".
2019-01-24 17:39:42 +01:00
Javi Martín
e73f3bd97a Add progress bars to milestones public view 2019-01-24 17:33:34 +01:00
decabeza
7c0fb96b02 Adds styles to admin progress bars views 2019-01-18 14:17:40 +01:00
Javi Martín
dfdf0b0636 Hide title field for primary progress bars
These bars don't have a title.
2019-01-18 14:17:37 +01:00
Javi Martín
c5d32c5ab9 Manage progress bars in the admin area 2019-01-18 14:17:33 +01:00
Javi Martín
4f25581636 Add progress bar polymorphic views 2019-01-18 14:17:29 +01:00
Julian Herrero
bf7112f090 make parameter 'skip_map' accessible on creating an investment 2018-12-27 18:39:27 +01:00
decabeza
4cda7d1d9f Shows documents title only if there is any document 2018-12-26 12:03:46 +01:00
Javier Martín
0e252b618f Merge pull request #3102 from consul/backport-milestone_status_texts
Update milestone status texts
2018-12-13 12:07:47 +01:00
Javi Martín
041e1f3f7b Remove obsolete reference to investment milestones 2018-12-11 20:27:54 +01:00
Javi Martín
dca95d608f Display description validation error in milestones
We had a validation rule for milestones which made sure either the
status or the description was present. However, since the description is
now translatable, the validation error wasn't being displayed in the
admin form.

Moving the validation rule to the translation object fixes the problem.
However, the translation object needs to check an attribute in the
milestone object in order to know whether the description is required or
not. This is tricky because by default it loads the milestone object
from the database, meaning it doesn't work with new records and it
ignores params sent by the browser.

The solution is to manually assign the globalized model before
validating the object. It's a hack, but apparently Rails doesn't provide
a better way to handle this case [1].

[1] https://github.com/rails/rails/issues/32024
2018-12-11 20:25:38 +01:00
Javi Martín
df29b49d05 Make milestones view reusable 2018-12-11 19:22:55 +01:00
Javi Martín
3e83b5893c Make milestone specs reusable 2018-12-11 19:22:55 +01:00