Commit Graph

26 Commits

Author SHA1 Message Date
Javi Martín
b51aa31e6a Use HTML beautifier to indent ERB files
We had inconsistent indentation in many places. Now we're fixing them
and adding a linter to our CI so we don't accidentally introduce
inconsistent indentations again.
2025-03-07 16:31:08 +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
cdc5e05d48 Open PDF files in the same tab/window
Quoting usability experts Jakob Nielsen and Anna Kaley [1]:

> [Opening PDF files in new tabs] is problematic, because it assumes
> users will always do the exact same things with certain file formats,
> which isn’t always the case.

There are many examples of this situation. For example, some people
(myself included) configure their browser so it downloads PDF files
instead of opening them in the browser. In this situation, a new tab is
opened, a blank page is displayed, the file is downloaded, and then
either the tab is closed or the blank page needs to be manually closed.
The end result is really annoying.

Other situations include people who use a mobile phone browser, where
navigating through tabs is generally much harder than doing so on a
desktop browser.

But IMHO the most important point is: every browser already provides a
way to open "regular" links in a new tab, so people can choose what to
do, but if we decide to open the link in a new tab, we take control away
from them, and people who'd like to open the link in the same tab might
feel frustrated.

In these cases, the links either say "download" or include the word
"PDF", so people know in advance that they're going to download/open a
PDF file, and so we're giving them information and, by removing the
`target` attribute, we're giving them control over their browser so they
can choose what's convenient for them.

[1] https://www.nngroup.com/articles/new-browser-windows-and-tabs
2023-10-23 18:16:14 +02:00
Javi Martín
ad26c5cf9f Fix background images with special characters
Just like we did for budgets, we're doing the same thing in all the
places where we render background images attached by either regular
users or administrators.

This way we correctly render background images with characters like
brackets or quotes.
2023-06-27 15:06:30 +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
c5103d3025 Fix generating dashboard poster on production
In commit 905ac48bb we mentioned:

> Since we don't use `asset_path` to reference assets in the public
> folder, we can safely disable the `unknown_asset_fallback` option.

However, `asset_path` is used by the wicked_pdf gem when calling the
`wicked_pdf_stylesheet_link_tag` method. This method also checks the CSS
files, searching for `url()` calls and converting any relative URLs
referenced there to absolute URLs.

However, when compiling assets on production, our `application.css` file
contains the following line imported from Leaflet which says:

```
behavior: url(#default#VML);
```

When passing this URL to `asset_path` (which is something the wicked_pdf
gem does automatically), it doesn't find the URL, and so this call
crashes unless we enable then `unknown_asset_fallback` option.

Since the dashboard poster is a feature we might remove in the future,
we're avoiding changing a Rails global configuration just for this
feature. So, instead of enabling the `unknown_asset_fallback` option,
we're changing the `poster.pdf` view so it doesn't load all the CSS of
the application but only the CSS it needs.

Note we aren't adding a test case because this bug is only present on
production environments when assets have been precompiled.
2022-01-12 13:45:59 +01: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
00a6f5b601 Remove <%== usage displaying settings
Using `<%==` is the same as using `raw`. I'm not sure if we meant
`sanitize` in this case, or it's just a typo. I'm assuming the latter
since we don't use anything similar in any other places.
2019-10-08 19:10:14 +02:00
Javi Martín
cf9e36c767 Replace single quotes with double quotes
Most of these quotes were in the dashboard branch before we added the
rule for double quotes.
2019-09-10 19:21:03 +02:00
decabeza
91be3cf775 Fix more hound warnings 2019-03-27 15:22:14 +01:00
decabeza
cbc89dae8c Replace html_safe to i18n _html 2019-03-19 17:35:39 +01:00
decabeza
6c0b1a316b Change text on poster footer to show the proposal url 2019-03-19 17:27:51 +01:00
decabeza
71c6a6edbc Rename images using underscores 2019-03-19 17:18:21 +01:00
Alessandro Cuoghi
d81d1537d0 Created new quotes
- Created blue images quotes
- Added quotes images to preview poster
- Added quotes images to download poster
- Removed reference to Decide Madrid and use %{org}
- Removed reference to decide.madrid.es and use %{link}
- FIxed some style (font, padding, maring) in PDF
- Passed scss-lint
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
Alessandro Cuoghi
003d3e82b0 Convert Color to Variables
- Added two temporal variables for colors. (Deciding how to call these new variables)
- Replaced hexadecimal with variable
- Remove white space in the html
2019-02-02 19:18:26 +01:00
Alessandro Cuoghi
145e0ae659 Show Preview only in Large version
- Add class Foundation show-for-large
- Fixed width Preview so as not to make it responsive
2019-02-02 19:18:26 +01:00
Alessandro Cuoghi
f317514258 Change Finger icon SVG to PNG
- Suggestion DeCabeza until FontAwesome is inserted.
- Remove SVG and convert to PNG
2019-02-02 19:18:26 +01:00
Alessandro Cuoghi
5fd9b2b633 Change quote and fix font
- Created new quotation marks without svg - Greater flexibility

- Fix font Lato in PDF - change font family in pdf_font
2019-02-02 19:18:26 +01:00
Alessandro Cuoghi
8064ac3779 Converted the tag image into background image
- Converted the TAG image into background image inside an overflow container because the height of the image in the pdf pushes to create 2 pages.

- Remove unused css
-
2019-02-02 19:18:26 +01:00
Alessandro Cuoghi
1d910c0073 Style PDF
- Added icon finger
- Chnage color quote
- Add class icon-finger
- Add some style
- Remove Open Sans
- Arranged the content in the A4
- Remove some style css
2019-02-02 19:18:24 +01:00
Alessandro Cuoghi
981e718a48 Style Generate Pdf
- Change some style
- Fixing the bug to the svg that was not rendered
- Change some rem  to cm
- The Lato font does not render well while Open Sans is correct. Strong and normal weight.
2019-02-02 19:17:59 +01:00
Alessandro Cuoghi
667039b127 Style Preview Pdf
- Customized the preview as shown by email
- Added two svg for quote icons. (Need convert to font)
- Ceate two class for quote icons.
- Added tag strong into yml for text decoration
- Customize css
2019-02-02 19:17:33 +01:00
decabeza
bd1ba2bc78 Adds styles to dashboard poster 2018-10-17 01:12:09 +02:00
decabeza
d38ef88b06 Adds styles to dashboard poster views 2018-10-05 18:38:17 +02:00
Juan Salvador Pérez García
6cc1ddb9af Fixes #231
Implements a poster feature for the proposals dashboard
2018-07-31 12:50:25 +02:00