Commit Graph

357 Commits

Author SHA1 Message Date
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
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
decabeza
546105d989 Merge branch 'master' into dashboard-master 2018-10-19 01:48:37 +02:00
Javier Martín
5f8311845b Merge pull request #2967 from consul/backport-1609-fix_skip_flaky_specs
Fix flaky spec: Admin feature flags Enable a disabled feature
2018-10-11 17:46:59 +02:00
Javi Martín
5ae7a5512d Skip spec before doing any requests
Skipping a spec in the middle of it, particularly after doing some
requests, caused Capybara to keep using the same driver in the following
spec.

Since the current spec uses the JavaScript driver, the next test would
also use the JavaScript driver, causing apparently random failures if
that test was supposed to use the Rack driver.
2018-10-11 17:14:53 +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
Angel Perez
7b95f4c320 Correct typos on nested documentable/imageable 2018-09-10 11:45:48 -04:00
Angel Perez
bdda397bf1 Use new RSpec stub syntax to fix deprecation warnings 2018-09-10 11:41:20 -04:00
Juan Salvador Pérez García
50f73abb0c Fixes #voodoorai2000 comments
Fixes some comments from #voodoorai2000 for the PR to consul
2018-07-27 16:30:03 +02:00
Juan Salvador Pérez García
a05e5c003f Fixed failing tests 2018-07-17 17:50:46 +02:00
iagirre
271c1595ba Changed the way the notifications page is accessed. Instead of doing it through UI, after the notifications are created the test goes directly to the notifications page (after login in the user). To check if the notification icon is correctly shown, a new test has been created that only does that. 2018-06-26 17:35:42 +02:00
Bertocq
21ead40e26 Disable document upload & show with new setting
When Setting allow_attached_documents is disabled (false value) the user
should not be able to upload documents neither see the documents lists
2018-04-10 13:10:14 +02:00
rgarcia
59805e9b73 Fix specs 2018-04-05 22:16:36 +02:00
Raimond Garcia
1692abc54a Merge pull request #2374 from wairbut-m2c/upload_documents_feature
Upload documents feature
2018-04-05 19:39:12 +02:00
Angel Perez
0fce8ca787 Fix incorrect assertion for nested imageable example
The example tests if a certain selector is hidden after adding
one image but the assertion expected said selector to be visible,
which made the scenario to fail at random
2018-03-27 14:47:51 -04:00