Commit Graph

16 Commits

Author SHA1 Message Date
Javi Martín
7ca55c44e0 Apply Rails/SaveBang rubocop rule
Having exceptions is better than having silent bugs.

There are a few methods I've kept the same way they were.

The `RelatedContentScore#score_with_opposite` method is a bit peculiar:
it creates scores for both itself and the opposite related content,
which means the opposite related content will try to create the same
scores as well.

We've already got a test to check `Budget::Ballot#add_investment` when
creating a line fails ("Edge case voting a non-elegible investment").

Finally, the method `User#send_oauth_confirmation_instructions` doesn't
update the record when the email address isn't already present, leading
to the test "Try to register with the email of an already existing user,
when an unconfirmed email was provided by oauth" fo fail if we raise an
exception for an invalid user. That's because updating a user's email
doesn't update the database automatically, but instead a confirmation
email is sent.

There are also a few false positives for classes which don't have bang
methods (like the GraphQL classes) or destroying attachments.

For these reasons, I'm adding the rule with a "Refactor" severity,
meaning it's a rule we can break if necessary.
2019-10-23 14:39:31 +02:00
Javi Martín
27468b0b7b Use relative URLs where possible
In general, we always use relative URLs (using `_path`), but sometimes
we were accidentally using absolute URLs (using `_url`). It's been
reported i might cause some isuses if accepting both HTTP and HTTPS
connections, although we've never seen the case.

In any case, this change makes the code more consistent and makes the
generated HTML cleaner.
2019-10-20 17:26:14 +02:00
Javier Martín
a0fb19f0b4 Merge branch 'master' into feature/3153 2019-02-15 16:25:50 +01:00
decabeza
64cbed838a Fix hound warnings 2019-01-31 17:23:45 +01:00
decabeza
e7fcf2ce35 Add select on cards form to select the number of columns 2019-01-31 17:06:01 +01:00
Javi Martín
2926e4e375 Fix managing widget cards for homepage
The condition `params[:page_id] != 0` didn't work properly when editing
the homepage because in that case the parameter was `nil`, and the line
`SiteCustomization::Page.find(@card.site_customization_page_id)` raised
an exception because it couldn't find a page with a `nil` ID.

Fixing the issue while maintaining the check against `0` lead to complex
code, and so allowing `nil` in the database and assuming cards with no
`site_customization_page_id` belonged in the homepage seemed to be the
easiest solution.
2019-01-21 10:40:14 -05:00
Javi Martín
9c050ca6bd Extract method to redirect when managing cards 2019-01-21 10:40:04 -05:00
Javi Martín
8a643c72e7 Use I18n for card notice messages 2019-01-21 10:39:42 -05:00
Manu
722a431b54 Add cards to custom pages 2019-01-18 09:54:43 -05:00
rogelio-o
f1bb1ff8de Moves attributes to a concern. 2019-01-14 20:26:47 +01:00
rogelio-o
ea76179002 Solves #3153. It refactors images attributes. 2019-01-12 17:42:55 +01:00
Javi Martín
139cf769c6 Update widget cards translatable fields 2018-10-22 16:28:49 +02:00
Javi Martín
5bb5cfa7fb Make Widget::Card translatable 2018-09-26 16:09:09 +02:00
Angel Perez
9029acd440 Fix Rubocop warnings for Admin controllers [ci skip] 2018-09-07 13:59:07 -04:00
rgarcia
ad181b0e10 Add label to cards
Also removes unused fields related to buttons and alignment
2018-05-28 18:17:26 +02:00
rgarcia
664e77305c Add widget cards to homepage 2018-05-28 18:17:26 +02:00