Commit Graph

88 Commits

Author SHA1 Message Date
Karim Semmoud
3faaa8521d Render markdown tables in legislation draft
* Add Tables option to Redcarpet in Legislation draft

* Allow table tags in Admin Legislation Sanitizer

* Add Test to render markdown tables in Legislation drafts

* Add Test for Admin Legislation Sanitizer

We include test for image, table and h1 to h6 tags and additional tests to strengthen the allowed and disallowed parameters

* Add Table from markdown test in System and Factories

* Add test to render  tables for admin user

* Remove comment line about Redcarpet options

* Edit custom css for legislation draft table to make it responsive
2023-06-29 20:48:01 +02:00
taitus
d96a91710f Fix broken h3 tag
Since we're now allowing <h2> and <h3> tags in the description, we
remove the broken <h3> tag from quiz-question class. Since its content
is also in the <title> element, and in order to be consistent with other
show actions in the public area, we change this tag to <h1>.

We add <h2> tag in the "Share" heading and we replace the broken <h4>
tag above adding new styles.
2023-02-22 19:19:27 +01:00
Javi Martín
fcc63cb436 Allow different brand colors per tenant
Until now, overwriting the styles for a certain tenant was a very
tedious task. For example, if we wanted to use a different brand color
for a tenant, we had to manually overwrite the styles for every element
using that color.

It isn't possible to use different SCSS variables per tenant unless we
generate a different stylesheet per tenant. However, doing so would make
the CSS compilation take way too long on installations with more than a
couple of tenants, and it wouldn't allow to get the colors dynamically
from the database, which we intend to support in the future.

So we're using CSS variables instead. These variables are supported by
97% of the browsers (as of October 2022), and for the other 3% of the
browsers we're using the default colors (SCSS variables) instead.

CSS variables have some limitations: for instance, it isn't possible to
use functions like `lighten`, `darken` or `scale-color` with CSS
variables, so the application might behave in a strange way when we use
these functions.

It also isn't possible to automatically get whether black or white text
makes a better contrast with a certain background color. To overcome
this limitation, we're providing variables ending with `-contrast`. For
instance, since the default `$brand` color is a dark one, when assigning
a light color to `--brand`, we probably want to assign
`--brand-contrast: #{$black}` as well, so the text is still readable.
2022-11-20 00:29:12 +01:00
Javi Martín
a2c032573f Rename brand-text mixin to brand-color
This is consistent with the `body-colors` mixin and with other mixins
we're about to add, like `anchor-color`.
2022-11-20 00:29:12 +01:00
taitus
aec317e5e6 Unify annotations comment icon to new structure
Apply new structure in the section that shows the comments icon together
with the number of comments so that it is easier to unify them into one
component.

Please note that we updated the comment-number class to comments-count
in order to simplify the css in the new component in the next commit.
2022-08-19 15:40:50 +02:00
taitus
e6f2c5474d Unify comment icon on legislation summaries
This was the only place in the application where the comments icon was
included without the span with the class "icon-comments".

We unified with the rest of the application and removed the
"comments-count" class which is no longer needed.
2022-08-19 14:25:58 +02:00
taitus
0ca17c6fae Unify comment icon on legislation questions
Remove unnecessary span class "debate-comments".

We take advantage of this commit to also unify the format of the date
that appears next to the comments with the rest of the application. The
format that we removed is being used on the same page in the
"Participation phases" tab (I guess that was the reason for putting it
the same) but I think it makes more sense to use the date format that is
used in this kind section in the rest of the application.
2022-08-19 14:25:34 +02:00
taitus
3deba3b189 Unify comment icon on legislation annotation index
Apply new structure in the section that shows the comments icon together
with the number of comments so that it is easier to unify them into one
component.

In this case we make only the text clickable and not the icon as in the
rest of the application. We're keeping the color and text-decoration so
it looks the same way it has looked until now, but we might change it
in the future.
2022-08-19 14:25:34 +02:00
Javi Martín
a0b4e35dbd Show login to comment message in annotations
This way it's consistent with what we get when there are no comments. It
only appears once on the page so it isn't overwhelming.
2022-02-21 18:48:09 +01:00
Javi Martín
aa2c551411 Use has-fa-icon in agree/disagree comment buttons
Note we're using the in-favor HTML class instead of the in_favor class
so we're consistent with our conventions for HTML classes and because we
use the in-favor class in similar places.

Also note the styles of the legislation process annotations/comments
buttons is now similar to the styles in the other sections. Previously,
the colors didn't have enough contrast and there was a very strange
margin between the "thumbs up" icon and the number of people agreeing
(that margin wasn't present between the "thumbs down" icon and the
number of people disagreeing).
2022-02-21 18:47:38 +01:00
Javi Martín
f00cb631bc Remove all grid-row Sass rules
We were using these rules in order to set the maximum width of an
element to `$global-width`. However, since we now do so in the <body>
element, there's no need to apply these rules to "rows".

Note we're adding `overflow: hidden` to the budget subheader. That's
because it only contains `float` element inside, and we're now missing
the `.row::before` and `.row::after` rules which make sure float
elements are rendered properly.
2021-07-07 22:32:08 +02:00
Javi Martín
9cc4d52723 Use a global maximum width for the <body> element
We weren't using a global maximum width for the <body> element because
we wanted the background of some elements to cover the whole screen. If
the body didn't cover the whole screen, then we would have to find a way
to extend the background beyond the limits of the body.

Elements can take the whole screen width using a width of 100 viewport
width (vw) units, which weren't as widely supported when CONSUL
development started as they are today.

However, there's a gotcha will vw units; they don't take into account
the vertical scrollbars browsers add when scroll is needed. That means
that an element with a width of 100vw would cause a *horizontal*
scrollbar when the vertical scrollbar appears on the screen. So
approaches like this one wouldn't work:

```
body {
  margin-left: auto;
  margin-right: auto;
  max-width: $global-width;
}

@mixin full-background-width {

  &::before {
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
  }
}
```

We could add `overflow-x: hidden` to the body to avoid the horizontal
scrollbar. However, on certain screens sizes that could cause some
content to disappear if there isn't enough horizontal space for all the
elements.

If we tried some other solution based on using `max-width` with `margin:
auto` on the <body> element, it would result in a body having a fixed
width and a variable margin (depending on whether there's a scrollbar).
So it wouldn't be possible to set a negative margin on child elements
based on the margin of the body, because that margin would be different
depending on the existence of a scrollbar.

So, instead, we're adding a fixed margin to the body, which depends on
the viewport width and the font size of the <html> element. With this
approach, when a vertical scrollbar appears, the margin of the <body> is
still the same; what changes is its width. That means we can set a
negative margin on child elements based on the margin of the <body>. No
horizontal scrollbar will appear.

Note we're slightly duplicating the code by using two variables
(`$body-margin` and `$full-width-margin`) to do the same thing. We could
simply use `$body-margin` and then use `calc(-1 * #{$body-margin})` in
our `full-width-background` mixin. We aren't doing so because some old
versions of the Android browser and Internet Explorer can't handle this
operation. Since our whole layout is based on these properties, in this
case supporting old browsers is quite important.

For similar reasons we're using a breakpoint instead of using the
`max()` function like: `Max(0px, calc(50vw - #{$global-width / 2}))`. At
the time of writing, `max()` is only supported in about 91% of the
browsers.

With this change, we no longer need to add `row` elements to make sure
we don't exceed the maximum width; the <body> element takes care of
that.

Also note banners sometimes have a full background and sometimes they
don't, depending on which page they appear. We're adding specific rules
for them.

Finally, the code for full width borders is a bit brittle; sometimes we
want the border to cover an element, and sometimes we don't. For
example, we had to slightly change the way the border of the "tabs" in
legislation processes is rendered. Without these changes, the borders
wouldn't overlap as we intended. We also had to add a `z-index` to
navigation links so their bottom outline is visible when they're
focused. The recommendations have a border with the same color as the
background so it's painted on top of the border of the `help-header`
section.
2021-07-07 22:32:06 +02:00
Javi Martín
c3a329a6f6 Remove unnecessary background color definitions
These elements already inherit these background colors form their parent
elements. Defining them explicitly makes it harder to change them and it
also makes it harder to customize the styles in other CONSUL
installations.
2021-06-30 16:42:53 +02:00
Javi Martín
8e8a4d784c Simplify using text color for links
Using `inherit` is IMHO more expressive since it means "use the color of
the parent element".

This is particularly useful for CONSUL installations using custom
styles. Consider the following code:

```
h2 {
  color: $white;

  a {
    color: $white;
  }
}
```

If we'd like to customize the way headings look, we'd have to override
two colors:

```
h2 {
  color: $red;

  a {
    color: $red;
  }
}
```

Consider the scenario where we use `inherit`:

```
h2 {
  color: $white;

  a {
    color: inherit;
  }
}
```

Now we only need to override one color to change the styles:

```
h2 {
  color: $red;
}
```
2021-06-29 19:45:09 +02:00
Javi Martín
4bb12c573f Fix invisible text selection on brand text
When an element had a text using the brand color and was a child of an
element with a brand background, the selection was invisible.
2021-03-24 15:48:24 +01:00
Javi Martín
e2d540d203 Extract code to define brand background
Setting the color to `$white` or `#fff` while setting the background to
`$brand` is a pattern we were using in many places. Since we're going to
edit it in order to fix the `::selection` behavior, we're defining the
pattern in one place.
2021-03-24 15:48:24 +01:00
Javi Martín
a877449936 Add related SDG and targets tags to processes
I'm not sure why we were using squares to style these lists see commit
bbacd4546b) but I don't think it's very important and it breaks
displaying the list of related SDGs.
2021-01-31 13:33:27 +01:00
Javi Martín
18813c8f2a Specify styles are meant for the main header
The <header> tag is a standard HTML tag which can be used in any section
of the page. We were adding the main header styles to all <header> tags
because in the past it was in only <header> tag we used.

That's not the case anymore, so instead of overwriting these styles on
every other <header> tag, modifying the rule so it only selects the main
header makes the code easier to maintain.
2020-11-23 18:05:43 +01:00
Javi Martín
0961cf464c Use CSS to make Table of Contents sticky
Originally we were using Foundation's sticky, which wasn't entirely
compatible with our way to open/close the Table of Contents because its
width would not automatically be updated when the TOC was opened/closed
but when users scrolled the page.

Using CSS, which is now supported in most browsers, simplifies the
matter. On browsers like Internet Explorer, where it's not supported,
the content will not stick but other than that it'll work fine.

We're also adding `scroll: auto` so when the TOC's height will be large
than the page, it'll be possible to scroll it, which users couldn't do
in the original version.
2020-11-17 14:48:48 +01:00
Javi Martín
48daf22f31 Make draft version content use the empty space
Now that comments and TOC can be closed at the same time, we use a flex
layout so the main content uses the available width.

We're also making the comments work better on medium-sized screens,
since previously they had a fixed width and now the width is adapted to
the size of the screen.

Since now the comment box element has a relative position instead of an
absolute one, we need to consider the draft panel height when
calculating the comment box position.
2020-11-17 14:48:48 +01:00
Javi Martín
41e5ddbcdf Use details tag to show/hide a draft version TOC
We were using JavaScript to show/hide the Table of Contents.

In my humble opinion, the <details> tag has a few shortcomings [1][2],
which means we should be careful about when to use it.

IMHO a Table of Contents is a good candidate for this tag because it's a
very common pattern to add a show/hide behavior for it, even if using it
means the "navigation" role (which we are *not* using anyway) wouldn't
be identified correctly.

I'm adding a <details> tag to the comments section as well for
consistency and in order to simplify the code. I'm not sure this is as
good an application of the <details> tag, though, but then again I'm not
sure about the interface we use to show/hide the comments (and this
feeling is increased by the fact that we use a different interface on
small screens). If we decide to change the interface in the future, we
might consider using the <details> tag for the Table of Contents but not
for the comments.

Since the <details> tag is not supported on Internet Explorer, I'm
only adding styles to this tag using the `:not([open])` option. On
Internet Explorer <details> will always be opened and so these styles
will be ignored.

[1] https://adrianroselli.com/2019/04/details-summary-are-not-insert-control-here.html
[2] https://daverupert.com/2019/12/why-details-is-not-an-accordion/
2020-11-17 14:48:48 +01:00
Javi Martín
220b1de01e Remove duplicate text in table of contents
We were using different divs to show the same text in different
positions, but we can use the same one and rotate it when appropriate.
2020-11-16 19:43:45 +01:00
Javi Martín
74e819e4e7 Use "regular" instead of "r" as parameter
Even if "r" is shorter, "regular" is easier to understand, and we're
going to store these icons in a folder named "regular", which is the
convention Font Awesome uses.
2020-10-26 16:26:21 +01:00
Javi Martín
b2b64ca8a0 Add link to download summary in XLSX format again
It was removed in commit 128a8164 alongside everything related to the
legislation process summary.

Co-Authored-By: taitus <sebastia.roig@gmail.com>
2020-09-08 13:32:08 +02:00
Javi Martín
14df74fed7 Add collaborative legislation summary again
It was removed in commit 128a8164 because we hadn't reviewed it nor
tested it properly. We're now adding it again, fixing the issues we've
found while reviewing.
2020-09-08 13:32:08 +02:00
Javi Martín
128a816464 Remove collaborative legislation summary
This feature wasn't properly tested nor reviewed, and after reviewing
several pull requests with a similar status and considering this pull
request is related to the public area of the web, we've decided to
remove it before releasing version 1.1.

This commit reverts commit 4f50e67a.
2019-11-06 17:21:03 +01:00
German Galia
4f50e67ac3 Collaborative legislation summary 2019-06-03 12:34:25 +02:00
decabeza
5fd493cd2c Add link to process on legislation processes proposals 2019-05-31 11:40:48 +02:00
decabeza
acc7cf65e3 Replace single quotes to double quotes on scss files 2019-02-11 17:42:58 +01:00
decabeza
78d8e34415 Show following tab on process if there are progress bar
Before, this tab only was show if were some milestone
2019-01-24 17:40:09 +01:00
decabeza
5924a70385 Removes arrow icon on active process phase 2018-12-28 19:39:11 +01:00
decabeza
6b58a71f3f Shows tabs only on large screens
Also moves ::after styles inside breakpoint(large down) to avoid use !important
2018-12-28 18:23:15 +01:00
decabeza
db86f0e7ab Changes styles to tabs on processes key dates 2018-12-28 18:22:59 +01:00
decabeza
04ea068f90 Fixes legislation processes key dates active class 2018-11-07 13:14:41 +01:00
decabeza
6f4f161076 Adds help gif on legislation processes with texts 2018-07-05 18:10:06 +02:00
decabeza
0bf31bde6c Updates all active to is-active classes 2018-06-06 12:02:13 +02:00
decabeza
48c7fb5fc2 Adds legislation processes styles 2018-03-08 11:34:33 +01:00
decabeza
ef53cd0f15 Clean css and views of custom content 2018-03-08 11:30:46 +01:00
Raimond Garcia
bce0729a61 Merge pull request #1899 from xarlybovi/legislation-process-html-fixes
Legislation process minor html fixes
2018-01-08 16:00:26 +01:00
María Checa
841ef2a3a2 Merge branch 'master' into 1856-legislation_processes_proposals_phase 2017-10-09 17:19:07 +02:00
decabeza
e404d149ce fixes some lint errors on legislation_process.scss 2017-09-22 19:10:39 +02:00
Carlos Ruiz
dc2e2a0944 Minor refactor and implement foundation toggler 2017-09-21 23:09:04 +02:00
decabeza
fb44a931df fixes legislation key dates with new proposal dates 2017-09-13 17:45:56 +02:00
decabeza
a15a75a4d6 cleans legislation process scss 2017-09-05 11:50:42 +02:00
decabeza
da1f72ee7c improves legislation processes header layout 2017-09-05 11:50:42 +02:00
decabeza
c796c5be2d Removes unnecessary margin-bottom 2017-08-01 12:56:59 +02:00
decabeza
5d036bae1a removes unnecessary margin on legislation allegations 2017-06-20 18:43:02 +02:00
decabeza
76b7f66fb3 fixes scss lint warnings 2017-06-16 12:09:01 +02:00
Bertocq
85d9fa7b6b Correct table of contents rotated text margin and line height 2017-06-12 17:38:20 +02:00
decabeza
d5d5402ece improves color contrast 2017-05-24 13:03:34 +02:00