Commit Graph

132 Commits

Author SHA1 Message Date
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
Senén Rodero Rodríguez
0ccfac76ad Remove Processes link on help page when legislation is disabled 2022-07-20 20:44:25 +02:00
Javi Martín
0be6eb9512 Add and apply Style/RedundantParentheses rule
Parentheses make the code harder to read in these cases.
2021-09-03 11:49:52 +02:00
Javi Martín
5f92252054 Fix exception using locales with no help images
In commit 905ac48bb we activated exceptions when assets were not found,
in order to detect places where we were trying to load non-existent
images.

We got an exception for that reason: we were loading images based on the
current locale, but for some locales there was no images.

We're now using fallbacks and loading another image when the original
one isn't available.

Note we're copying the English images to images with a generic name for
the case where there's no fallback with an image. We're copying the
files instead of using symbolic links to make sure they can be
overwritten independently in other CONSUL installations.

Also note we're updating the HTML so the section gets the ID instead of
the header. That way the system test is simple.
2021-05-29 15:05:29 +02:00
Javi Martín
08318171f0 Extract component to render help section 2021-05-29 14:34:46 +02:00
Senén Rodero Rodríguez
aa6195abc5 Add link to SDG help page to Other information of interest section at main help 2021-03-02 14:45:19 +01:00
Javi Martín
a7bbdb1bd0 Simplify rendering a banner
Now the banner component accepts either a banner or a section and loads
the banner if it's a section, so we don't have to add the `@banners`
variable in several controllers.
2021-01-20 17:22:05 +01:00
Javi Martín
5907ddf884 Use local variable in cards partial
This way it's going to be easier to reuse.
2021-01-14 17:45:14 +01:00
Javi Martín
c156621a4c Add method to generate a list of links
A list of links is a very common pattern in the web, and we use it in
many places. Here we're applying it to one of the most simple ones; the
help page.

Generally speaking, I'm not a big fan of helpers, but there are methods
which IMHO qualify as helpers when:

* They do not deal with application objects but mainly strings and
  arrays
* They return text or an HTML tag
* Their logic is simple and splitting it into several methods is not
  necessary

Many Rails helpers, like `tag`, follow these principles.
2020-12-07 15:28:56 +01:00
Javier Martín
74627641b3 Merge pull request #4034 from consul/help_page_processes
Add processes feature info section in the help page
2020-07-16 23:32:15 +02:00
Julian Herrero
fb0917026c Add processes feature info section in help page 2020-06-08 11:39:27 +07:00
decabeza
8e01b11569 Move conditional into shared banner partial
To avoid always writing if has_banners? every time the partial is used it has been moved within this partial.
2020-05-08 12:00:03 +02:00
decabeza
caedd21da8 Move cards to shared partials 2020-04-21 12:54:16 +02:00
decabeza
a8537f7e19 Replace equalizer to display flex on cards 2020-04-14 17:14:52 +02:00
Javi Martín
b66859945e Remove _html suffix from already sanitized texts
Using the `_html` suffix automatically marks texts as HTML safe, so
doing so on sanitized texts is redundant.

Note flash texts are not sanitized the moment they are generated, but
are sanitized when displayed in the view.
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
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
55a190f44a Remove unneeded _html suffix in I18n keys
This suffix does the same thing as calling `.html_safe` on them. So we
don't need to use it in texts that don't use HTML.
2019-10-08 13:20:22 +02:00
Javi Martín
c62da726b8 Apply SpaceAroundErbTag ERB Lint rule 2019-09-10 20:02:15 +02:00
Julian Herrero
f6489bc604 Use double quotes in app/views 2019-03-19 12:33:07 +01:00
Julian Herrero
87be6f302c Add default site customization pages
From now on these static pages:

`/privacy'
`/conditions'
`/accesibility'
`/help/faq'
`/welcome'

have been moved to the DB and can be modified easily by any
administrator in `/admin/site_customization/pages'
2019-03-14 18:35:51 +01:00
decabeza
47877f1bcd Remove unnecessary title on page cards 2019-01-31 17:08:01 +01:00
decabeza
40a42b0c63 Show card label only if it is present 2019-01-31 17:07:51 +01:00
decabeza
98f550fc18 Add columns on pages card view and improve css layout 2019-01-31 17:06:44 +01:00
Manu
142a0403d6 added new scss class 'custom-page' 2019-01-18 09:54:43 -05:00
Manu
722a431b54 Add cards to custom pages 2019-01-18 09:54:43 -05:00
decabeza
46671fe447 Removes unnecessary pages 2018-11-15 11:52:57 +01:00
decabeza
b364e0ec38 Improves pages markup 2018-11-15 11:05:50 +01:00
decabeza
3a718d88c0 Shows help link only if feature is enabled 2018-11-14 12:45:52 +01:00
Javi Martín
f917f5eed9 Filter image tags everywhere except in custom pages
Allowing image tags everywhere makes us vulnerable to CSRF attacks.
2018-09-12 12:35:28 +02:00
Juan Fernandez
653d36c9e6 Translate static pages 2018-08-04 15:28:41 -04:00
decabeza
2543cf5d6c Removes custom content on help pages 2018-07-30 17:45:19 +02:00
iagirre
0d9da5398b Fix banners in user pages
Banners were not been shown in certain pages; now
they are.

Spec to check if the banner is been shown correctly
added. Before it was in admins specs, now it has it's
own spec out of admins folder.
2018-07-12 10:17:25 -04:00
decabeza
990dc072be Refactors custom page view and include specs 2018-02-14 17:52:10 +01:00
decabeza
c0c4d9e01f Fixes back link to on how to use help page 2018-02-14 16:00:01 +01:00
decabeza
2154a614c2 Adds new legislation processes section on help page 2018-02-08 19:06:41 +01:00
decabeza
dac5b7c9a2 Adds missing polls button on help page 2018-02-07 19:09:30 +01:00
decabeza
42d0f471ee Updates i18n keys and images folder 2018-01-30 19:10:48 +01:00
decabeza
286371c9d9 Changes more_info folder and path to help 2018-01-30 18:26:30 +01:00
decabeza
a958a75bb1 Updates text of polls section of more info page 2018-01-30 18:13:24 +01:00
decabeza
037a3af5a6 Updates text of budgets section of more info page 2018-01-30 18:12:48 +01:00
decabeza
fffc769c90 Updates text of proposals section of more info page 2018-01-30 18:12:21 +01:00
decabeza
59a02301c2 Updates text of debates section of more info page 2018-01-30 18:11:50 +01:00
decabeza
735630cff0 Updates text of intro section of more info page 2018-01-30 18:11:13 +01:00
Angel Perez
ab9d612128 'Proposals' feature can be enabled/disabled
Fixes #1886
2017-11-17 13:10:55 -04:00
decabeza
6c5513ab38 replaces back_link partial to back_link_to helper 2017-07-26 18:22:45 +02:00
María Checa
ed7b7f0361 Added scope to pages model
New scope to use when listing pages to show only the ones with current locale.
2017-07-02 14:54:11 +02:00
decabeza
3bcfaeb61a replaces sr-only class to show-for-sr 2017-06-13 17:51:57 +02:00
decabeza
c846107cd8 removes more info pages belongs to madrid's fork 2017-06-07 18:28:12 +02:00
decabeza
e983c5708e adds missing i18n 2017-06-07 18:26:52 +02:00