Commit Graph

15 Commits

Author SHA1 Message Date
Javi Martín
c97e7852a4 Use "excluding" instead of "reject"
This method was already available as #without, but we didn't know about
it.
2022-08-24 18:11:56 +02:00
Javi Martín
1e883af9cd Don't count errors for the same field twice
The number of errors in a form includes several errors for the same
field. For example, if a title is mandatory and has to have at least 5
characters, leaving the title blank will result in two errors. So users
will be invited to look for two errors, but they'll only find one field
with errors.

So it's a bit more intuitive to show as many errors as fields having
errors.

Note we're excluding errors on `:base`, which is a bit of a hack for
errors in association fields. For example, if the title of one
translation is not present, `resource.errors.messages` will contain two
elements: one for the translation's title, and one for the `base` field.
This resulted in the count of errors being 2 when there was only one.

Also note I haven't found a way to count errors on all `has_many`
relations. That is, if two translations have a missing title field, only
one error will be mentioned in the message (as it did before this
commit).
2020-05-18 17:57:06 +02:00
Javi Martín
6b1864fbcd Sanitize translations instead of using _html
Using the `_html` suffix in an i18n key is the same as using `html_safe`
on it, which means that translation could potentially be used for XSS
attacks.
2019-10-09 19:46:47 +02:00
Javi Martín
71d9ddd849 Apply rule to end files with a newline character 2019-09-10 20:02:15 +02:00
decabeza
f95d5d4639 improves generic error message 2017-12-22 12:32:34 +01:00
Alberto Garcia Cabeza
3752f3a53b Adds foundation 6 🎉 2016-02-26 19:33:33 +01:00
Juanjo Bazán
8b8c1feab7 favors underscore for resource name resolution
SpendingProposal becomes spending_proposal instead of spendingproposal
2016-01-11 12:17:10 +01:00
Alberto Garcia Cabeza
bf08cb582f Adds title on close alerts link 2015-09-28 13:46:54 +02:00
Juanjo Bazán
8c7d47a922 typo 2015-09-06 20:39:35 +02:00
Álvaro Durán Tovar
7fd7f2cc81 fix indentation on shared/errors 2015-09-06 19:55:37 +02:00
Álvaro Durán Tovar
92ae988251 adds close button to alert boxes, also adds
data-alert attribute to enable javascript
on them
2015-09-06 19:54:12 +02:00
Alberto Garcia Cabeza
ee72096890 fixes conflicts 2015-08-29 00:40:15 +02:00
Alberto Garcia Cabeza
13fe1dcb9f Changes bg images, adds favicon and alerts styles 2015-08-29 00:33:40 +02:00
rgarcia
5ced63b639 adds views changes for verified accounts 2015-08-28 00:00:59 +02:00
rgarcia
a81612b226 improves consistency of error messages [#110] 2015-08-16 15:57:09 +02:00