Commit Graph

28 Commits

Author SHA1 Message Date
Javi Martín
a6e6a90bef Add alt test to proposal images in mail 2024-11-12 18:25:20 +01:00
Javi Martín
6d6c067296 Use an empty alt attribute for decorative images
This way people using screen readers will know that the image is a
decorative one.
2024-11-12 18:25:20 +01:00
Javi Martín
0c14feee19 Open proposals dashboard links in the same window
Out of the usability issues I've experienced when using Consul
Democracy, the biggest one has arguably been the fact that the link to
edit a proposal opens in a new tab. I guess the reasoning behind it is
that the page to edit a proposal is not part of the proposals dashboard,
but what the hell! Imagine if every link to edit something opened in a
new tab...

So we're reducing the impact of this nonsense by opening most dashboard
links in the same window; for now, we're still opening in a new window
links to download files and links that might point to external websites.
We'll address those ones in the future.
2023-10-24 16:31:39 +02:00
Javi Martín
629e208e9d Add and apply ArgumentAlignment rubocop rule
We're choosing the default `with_first_argument` style because it's the
one we use the most.
2023-08-18 14:56:16 +02:00
Javi Martín
8b13daad95 Add and apply rules for multi-line hashes
For the HashAlignment rule, we're using the default `key` style (keys
are aligned and values aren't) instead of the `table` style (both keys
and values are aligned) because, even if we used both in the
application, we used the `key` style a lot more. Furthermore, the
`table` style looks strange in places where there are both very long and
very short keys and sometimes we weren't even consistent with the
`table` style, aligning some keys without aligning other keys.

Ideally we could align hashes to "either key or table", so developers
can decide whether keeping the symmetry of the code is worth it in a
case-per-case basis, but Rubocop doesn't allow this option.
2023-08-18 14:56:16 +02:00
Javi Martín
e221c3cd1a Remove unused task to send dashboard notifications
This task was "temporarily" removed in commit 7b6619528. Since that was
done three and a half years ago, right after the dashboard was
introduced, I think it's time to make this "temporary" measure a bit
more permanent ;).
2022-10-02 16:52:59 +02:00
Javi Martín
091abfc944 Use Active Storage to render attachments
This way we fix a bug we mentioned in commit 930bb753c which caused
links to documents to be broken when editing their title because the
title was used to generate the URL of the document.

Note we're still using Paperclip to render cached attachments because
this is the only case where we store files with just Paperclip and not
Active Storage.

With Active Storage, we render attachments just like any other resource,
using `polymorphic_path`. Paperclip included the `url` method in the
model; since the model doesn't have access to the request parameters
(like the host), this was inconvenient because it wasn't possible to
generate absolute URLs with Paperclip.

In order to simplify the code and make it similar to the way we used
Paperclip, we're adding a `variant` method accepting the name of a
variant and returning the variant.
2022-02-23 18:21:38 +01:00
Javi Martín
ae2576020e Extract method to use WYSIWYGSanitizer in views
This is similar to methods we use like `sanitize` or `markdown`.
2019-10-21 21:32:02 +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
928312e218 Use sanitize in translations with links
Sometimes we're interpolating a link inside a translation, and marking
the whole translations as HTML safe.

However, some translations added by admins to the database or through
crowdin are not entirely under our control.

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:21 +02:00
Javi Martín
0f485308b7 Sanitize CKEditor content before displaying it
It's possible to create a newsletter or a proposed action with
<script> tags by filling in the body using a textarea instead of a
CKEditor. While we trust our administrators not to do so, it's better to
completely eliminate that possibility.
2019-10-08 18:46:20 +02:00
Javi Martín
20ca6beb30 Remove unneeded html_safe and raw calls
There's no HTML in these texts, or it has already been escaped by Rails
`link_to` helper method.
2019-10-08 13:20:22 +02:00
Javi Martín
a21240b230 Use Date.current and Time.current
Using Date.today and Time.now might lead to inconsistencies if the time
zone the application uses is not the same as the system time zone.
2019-08-28 20:32:40 +02:00
decabeza
0517ae04a6 Remove consul logo 2019-04-24 13:57:04 +02:00
decabeza
91be3cf775 Fix more hound warnings 2019-03-27 15:22:14 +01:00
Alberto
29a87e2746 Merge branch 'dashboard' into dashboard-polish 2019-03-26 12:19:20 +01:00
taitus
08383b9cac Send new notification email after publish Proposal
After publish a proposal send email to proposal's author with information text and new actions available.
2019-03-21 12:29:30 +01:00
taitus
5177adb32a New rake task for proposals to send new action email
Execute rake task every day to detect new actions available for not archived proposals. If there are new actions available for today, send email to proposal's author with information text, new actions available and link to proposal dashboard url.
2019-03-21 12:29:28 +01:00
taitus
c959e078b8 Send new action notification email after create Proposal
After create a proposal send email to proposal's author with information text and new actions available.
2019-03-20 11:50:47 +01:00
decabeza
cbc89dae8c Replace html_safe to i18n _html 2019-03-19 17:35:39 +01:00
decabeza
71c6a6edbc Rename images using underscores 2019-03-19 17:18:21 +01:00
Alessandro Cuoghi
44964c35f9 Added quotes images
- Created white quote images png (before and after)
- Added images quotes to preview email and email.
- Added max width to images quotes png
2019-02-02 19:18:27 +01:00
Alessandro Cuoghi
56dadcb701 Changed logo image
- The original logo is white. Created black version for white background.
- Added logo in preview email and send email.
2019-02-02 19:18:27 +01:00
Alessandro Cuoghi
394a7e55ee Fixed some style preview email and email
- Removed class large-7
- Changed font size preview-email and email
- Changed text color in the email
- Changed some font size and padding in the email
- Added some padding in preview email
- Pass scss-lint
- Changed padding and added font size.
2019-02-02 19:18:27 +01:00
Alessandro Cuoghi
70171b0e17 Fix PDF and email
- Inserted normal quotation marks
- Remove class quote
- Added max width mail preview
- Added some styles in the email
- Added image decide_madrid at the end of the email
- Added cover to the image preview poster and PDF
- Passed scss lint
2019-02-02 19:18:27 +01:00
decabeza
c33d9fa97b Improves styles for dashboard mailer forward
Uses layout with tables and inline styles to avoid display errors in mail readers
2018-10-13 13:03:02 +02:00
Juan Salvador Pérez García
9eaa990145 Added default image for proposal dashboard mailing 2018-07-25 17:01:30 +02:00
Juan Salvador Pérez García
8876b285ce Fixes #229
Adds email feature for proposals dashboard
2018-07-25 13:28:44 +02:00