Commit Graph

22 Commits

Author SHA1 Message Date
Javi Martín
607dabbc8a Move admin investments partial to a component
This way it'll be easier to organize the code related to it.
2024-10-25 17:24:32 +02:00
Javi Martín
749428d93f Replace content_tag with new tag builder syntax
One of the main advantages of this syntax is we can now omit the content
parameter when it's empty.
2020-04-27 19:26:37 +02:00
Julian Herrero
65e841e44e Show edit button instead of remove image on accepting phase
Since now it's possible to edit the budget investment during the
accepting phase, it does not really make sense to show the button to
just remove the image when the investment project can be fully edited,
and the image can be removed from the editing form.
2020-02-18 13:49:28 +07:00
Javi Martín
db1ccb18c7 Use safe_join instead of html_safe
The name `html_safe` is very confusing, and many developers (including
me a few years ago) think what that method does is convert the HTML
contents to safe content. It's actually quite the opposite: it marks the
string as safe, so the HTML inside it isn't stripped out by Rails.

In some cases we were marking strings as safe because we wanted to add
some HTML. However, it meant the whole string was considered safe, and
not just the contents which were under our control.

In particular, some translations added by admins to the database or
through crowding were marked as safe, when it wasn't necessarily the
case.

Although AFAIK crowdin checks for potential cross-site scripting
attacks, it's a good practice to sanitize parts of a string potentially
out of our control before marking the string as HTML safe.
2019-10-08 18:46:20 +02:00
decabeza
9e9eb1359b Add icon to sortable table 2019-02-20 13:07:08 +01:00
Javi Martín
68fb295db5 Use if blocks instead of two ternary operators
Using a simple ternary operator is usually fine; however, code combining
two ternary operator is a bit hard to follow.
2019-01-10 16:11:51 +01:00
Javi Martín
eb6bba52e3 Simplify code
The string inside `params[:direction]` should already use lowercase
characters.
2019-01-10 16:11:51 +01:00
Javi Martín
814579d58f Simplify interpolation
It's OK ot use single quotes inside a string with double quotes in order
to avoid escape characters.
2019-01-10 16:11:51 +01:00
Javi Martín
ee2f970e03 Fix sorting links for non-English languages
We were assuming the translation and the column name were related.
2019-01-10 16:11:51 +01:00
Anna Anks Nowak
3fd7b3d216 Extract setting icon and direction to methods 2019-01-10 16:11:51 +01:00
Anna Anks Nowak
0fe9ea08c3 Fix the direction assignment 2019-01-10 16:11:51 +01:00
Anna Anks Nowak
e88acb8905 Make params handling case insensitive 2019-01-10 16:11:51 +01:00
Anna Anks Nowak
e264490bca Styling and refactor sorting methods and helpers 2019-01-10 16:11:51 +01:00
Anna Anks Nowak
37b2226432 Make the link_to helper more readable 2019-01-10 16:11:51 +01:00
Anna Anks Nowak
747b8295b1 Refactor link_to_investments_sorted method 2019-01-10 15:35:54 +01:00
Anna Anks Nowak
9786b0bf7d Rewrite sorting to support direction param [#2931] 2019-01-10 15:34:33 +01:00
Anna Anks Nowak
5dd468092a Rewrite the method to not use budget_investments_sorting_options [#2931] 2019-01-10 15:28:55 +01:00
Anna Anks Nowak
22059379f5 Refactor by creating a helper method for generating sorting links [#2931] 2019-01-10 15:28:55 +01:00
decabeza
ef00eaa765 Adds missing content to budget investments mode view
This feature was already on Madrid fork and missing on backport
2018-04-05 14:53:22 +02:00
Bertocq
bd10285431 Fix line length at budget investments helper 2018-02-10 16:30:07 +01:00
Angel Perez
1f50e284a9 'Current applied filters' message handles multiple filters in use 2018-01-31 07:21:51 -04:00
Angel Perez
e04dc5b8f2 Add sorting options for Admin::BudgetInvestments (#2336) 2018-01-25 08:18:04 -04:00