Commit Graph

126 Commits

Author SHA1 Message Date
Javi Martín
31b65679c3 Extract partial to render flag actions
The main obstacle to extract this partial was probably the paths for the
flag and unflag actions.

Now that we use Rails 5.1 `resolve` method to handle nested resources,
we can use `polymorphic_path`.

Also note the code is a bit ugly because comments render a divider. We
should probably use a CSS border instead.

Co-Authored-By: taitus <sebastia.roig@gmail.com>
2020-07-07 23:39:21 +02:00
Javi Martín
7bf4e4d611 Sanitize descriptions in the views
Sanitizing descriptions before saving a record has a few drawbacks:

1. It makes the application rely on data being safe in the database. If
somehow dangerous data enters the database, the application will be
vulnerable to XSS attacks
2. It makes the code complicated
3. It isn't backwards compatible; if we decide to disallow a certain
HTML tag in the future, we'd need to sanitize existing data.

On the other hand, sanitizing the data in the view means we don't need
to triple-check dangerous HTML has already been stripped when we see the
method `auto_link_already_sanitized_html`, since now every time we use
it we sanitize the text in the same line we call this method.

We could also sanitize the data twice, both when saving to the database
and when displaying values in the view. However, doing so wouldn't make
the application safer, since we sanitize text introduced through
textarea fields but we don't sanitize text introduced through input
fields.

Finally, we could also overwrite the `description` method so it
sanitizes the text. But we're already introducing Globalize which
overwrites that method, and overwriting it again is a bit too confusing
in my humble opinion. It can also lead to hard-to-debug behaviour.
2019-10-21 21:32:02 +02:00
Javi Martín
2aabf79fb4 Rename methods to add auto links to HTML
The name `safe_html_with_links` was confusing and could make you think
it takes care of making the HTML safe. So I've renamed it in a way that
makes it a bit more intuitive that it expects its input to be already
sanitized.

I've changed `text_with_links` as well so now the two method names
complement each other.
2019-10-08 18:46:20 +02:00
Javi Martín
911fe4e481 Simplify calls to render partial
We're also adding a bit of consistency, since most of our calls to
partial rendering omit the `partial` and `locals` keys.
2019-09-04 15:00:36 +02:00
Julian Herrero
b78ff808c1 Use double quotes in app/views/debates 2019-03-19 12:16:50 +01:00
decabeza
88cae1424e Add missing mobile social share message 2019-03-14 11:32:14 +01:00
decabeza
d4b88f1fae Adds description for social share buttons 2018-03-07 17:24:30 +01:00
María Checa
3836b73482 Added related contents to debates 2017-12-18 23:56:32 +01:00
decabeza
05a713790f improves edit debate button on debate show 2017-10-18 18:54:01 +02:00
decabeza
6c5513ab38 replaces back_link partial to back_link_to helper 2017-07-26 18:22:45 +02:00
Bertocq
f03e2ec236 Use shared social_share partial on every view that was using duplicated code 2017-05-30 12:39:36 +02:00
decabeza
d49b6e5aa4 adds rel canonical on show views 2017-05-17 14:10:38 +02:00
Alberto Garcia Cabeza
551501c148 replaces &nbsp; to %20 on whatsapp links href 2017-05-03 18:08:09 +02:00
Alberto Garcia Cabeza
e2a015c24e shows always whatsapp icon on small screens 2017-05-03 18:07:23 +02:00
Alberto Garcia Cabeza
da8e51aed7 adds missing parenthesis 😅 2017-03-28 18:05:23 +02:00
Alberto Garcia Cabeza
b4e81d60fc fixes html validation on whatsapp share 2017-03-27 19:01:39 +02:00
Alberto Garcia Cabeza
b5fd8cc8b2 fixes missing i18n 2017-03-06 14:04:17 +01:00
Alberto Garcia Cabeza
580ed6e4c6 adds alternative text for share on WhatsApp links 2017-03-06 13:15:12 +01:00
Alberto Garcia Cabeza
ae7458024d closes missing aside tag 2016-12-27 13:57:27 +01:00
Alberto Garcia Cabeza
76a3c61020 improves html structure for comments on debates and proposals 2016-12-19 13:43:09 +01:00
Alberto Garcia Cabeza
3b2fe1e184 improves headings and outline structure 2016-12-05 17:02:42 +01:00
Alberto Garcia Cabeza
2c4b5315c8 removes blue blocks and improves contrast on debates 2016-11-02 13:07:26 +01:00
Alberto Garcia Cabeza
7320d17bea Moves back links inside a partial 2016-04-26 13:04:57 +02:00
Juanjo Bazán
87d2d74f66 updates devise & ahoy 2016-04-19 13:27:16 +02:00
Bertocq
f18a1778ff Hashtag al compartir en redes sociales #65 @AyuntamientoMadrid/consul 2016-04-04 20:56:29 +02:00
Juanjo Bazán
4eb822a73c improves styles for whatsapp sharing button 2016-03-21 11:56:08 +01:00
Juanjo Bazán
df6e3301b9 uses generic urls in whatsapp sharing button 2016-03-21 11:52:49 +01:00
Alberto García Cabeza
3f63c5af7b Merge pull request #985 from Ana06/master
Share with WhatsApp
2016-03-21 11:33:14 +01:00
Alberto Garcia Cabeza
3ec0971b37 Replaces icons i tags for span 2016-03-14 19:32:48 +01:00
Ana
8119df26fb Use of fontastic instead of font-awesome 2016-03-12 22:20:35 +01:00
Ana
f4b7e0c142 Share with Whatsapp improvement 2016-03-11 00:34:07 +01:00
Ana
927b1e8e5d Share with WhatsApp in debates 2016-03-11 00:21:39 +01:00
Alberto Garcia Cabeza
3752f3a53b Adds foundation 6 🎉 2016-02-26 19:33:33 +01:00
rgarcia
f82a590e1e reverts debate links 2016-02-19 19:08:35 +01:00
palomahnhp
2ee90ac76e share links to debate 2016-02-08 10:32:57 +01:00
Alberto Garcia Cabeza
66acbdbb66 Removes unused classes 2015-12-16 11:58:36 +01:00
kikito
d4bbf0d26e refactors shared part of debate & proposal views 2015-10-21 14:47:17 +02:00
kikito
6c5d1faa90 Uses the new field, erased_at, for erased users 2015-10-21 14:28:21 +02:00
Enrique García
72787b6284 Merge pull request #485 from juandefelix/keep-filter
Conservar orden de búsqueda al hacer click en "Volver"
2015-09-22 16:41:20 +02:00
juandefelix
09b751bda9 "Back" link directs to previous page 2015-09-19 19:00:11 -05:00
Juanjo Bazán
a60fdc8ccd sets debate's title as title page in debate/show 2015-09-18 12:34:14 +02:00
Juanjo Bazán
2ffb22a249 Merge pull request #519 from AyuntamientoMadrid/fix-tagcloud-488
Fix tagcloud
2015-09-17 17:24:39 +02:00
Alberto Garcia Cabeza
efe1e58318 Improves styles for moderator actions 2015-09-17 13:38:49 +02:00
kikito
d324c061b3 Refactors shared/_tags view to always take a param called taggable 2015-09-15 15:28:14 +02:00
Juanjo Bazán
b0b8d4126d adds cache to highlights 2015-09-14 18:00:26 +02:00
juandefelix
30f54e4c2d adding session order and page to back link 2015-09-14 00:08:54 -05:00
Juanjo Bazán
d4b3e8be94 adds autolinking to debate's description 2015-09-13 18:03:17 +02:00
Alberto Garcia Cabeza
a61c006f7f Replaces bullet for bull 2015-09-09 20:33:21 +02:00
rgarcia
f11220206a displays alert for conflictive debates 2015-09-07 17:17:33 +02:00
Raimond Garcia
b3b4b79f41 Merge pull request #406 from AyuntamientoMadrid/improves_styles
Improves styles
2015-09-07 16:57:20 +02:00