Commit Graph

5 Commits

Author SHA1 Message Date
Julian Herrero
31ac8b7f55 Change single quotes to double quotes 2019-02-15 11:40:39 +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
c5d32c5ab9 Manage progress bars in the admin area 2019-01-18 14:17:33 +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
3e83b5893c Make milestone specs reusable 2018-12-11 19:22:55 +01:00