Commit Graph

44 Commits

Author SHA1 Message Date
Javi Martín
291620abf7 Use tag.attributes to set conditional HTML attributes
Using an `if..else` block made the code harder to follow since the
opening tag was inside the block but the closing tag was outside it.
Moreover, it didn't work well with HTML Beautifier (a gem we're going to
introduce to manage ERB indentations).
2025-03-07 16:02:07 +01:00
Javi Martín
b9e137619a Simplify the way we provide the title in most cases
This is consistent with the way we're providing the main class.

Note we're still setting the title using a block in more complex cases.
2024-03-23 00:35:47 +01: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
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
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
Julian Herrero
151aa6009d Allow links and images on legislation drafts
Note we're using a new sanitizer. Ideally we'd reuse the
`AdminWYSIWYGSanitizer`, but then code that would be correctly shown by
markdown-it (like the <h1> tag) wouldn't be shown on the web, which is
confusing. Ideally we would configure markdown-it to only allow the tags
present in the `AdminWYSIWYGSanitizer` and provide some kind of help
showing which tags are allowed.
2020-08-10 12:20:59 +02:00
decabeza
bcfb9b7a18 Use complete keys on legislation translations 2020-08-07 10:29:39 +02:00
Javi Martín
68ca29fa8b Convert markdown to HTML on demand
We were converting markdown to HTML every time we saved a record, which
has the same problems as sanitizing HTML before saving it to the
database, particularly because the body of a legislation draft is stored
in a translations table.

Performance-wise this isn't a problem: converting a text with more than
200_000 characters takes about a milisecond on my machine.

Note we need to modify a migration generated by globalize, since the
method `create_translation_table!` would fail now that we don't define
`translates :body_html` in the model.
2019-10-21 21:32:43 +02:00
Javi Martín
9eee79f218 Sanitize markdown output
We were using the markdown renderer with the `filter_html` option set to
false, so we weren't removing hypothetical `<script>` tags.
2019-10-08 18:46:21 +02:00
Javi Martín
f74971060b Apply SpaceInHtmlTag ERB Lint rule 2019-09-10 20:02:15 +02:00
Javi Martín
4c35df4812 Use double quotes inside string interpolation 2019-03-25 14:58:54 +01:00
Julian Herrero
2b83be1c7c Use double quotes in app/views/legislation 2019-03-19 12:16:50 +01:00
decabeza
6f4f161076 Adds help gif on legislation processes with texts 2018-07-05 18:10:06 +02:00
Manuel Ortega
2fef9c14d0 Moving humanized_content_type from DocumentablesHelper to Document model. Removing humanized_file_size in favor of direct use of number_to_human_size form ActionViewHelper. Added additional documentens to all concerned views 2017-10-18 22:21:01 +02:00
decabeza
e404d149ce fixes some lint errors on legislation_process.scss 2017-09-22 19:10:39 +02:00
Bertocq
553348eaad Convert phase to symbol before comparision for active dates 2017-09-05 16:18:36 +02:00
Bertocq
56434cf197 Make Draft Version comments panel visible by default, that hides Table of Contents 2017-06-21 02:54:31 +02:00
decabeza
76b7f66fb3 fixes scss lint warnings 2017-06-16 12:09:01 +02:00
Bertocq
523988a291 Replace old open_phase? method for new phase/publication open? on Legislative Process 2017-06-13 22:04:36 +02:00
decabeza
28e17b870c unifies styles and html code 2017-05-24 13:03:25 +02:00
decabeza
260df52a34 uses current css classes 2017-05-23 12:22:57 +02:00
Amaia Castro
c7eaadb4b2 Show comment boxes for all annotations at the clicked point 2017-02-24 15:45:36 +01:00
Amaia Castro
9f7d0b8195 Merge pull request #73 from medialab-prado/legislation-text-index-style
Legislation text index styles
2017-01-19 12:37:30 +01:00
Fernando Blat
cba1f8bd9d Draft text index tree navigator 2017-01-19 11:02:45 +01:00
Amaia Castro
536784ee04 Merge pull request #72 from medialab-prado/back-improvements
Back improvements
2017-01-19 10:27:12 +01:00
Martín González
287b144bcf Make draft index fixed on scroll 2017-01-18 16:42:51 +01:00
Martín González
076c5d2784 Use the full width key dates html where is possible, fix svg margin 2017-01-18 13:05:16 +01:00
Fernando Blat
2f5e180069 View changelog link only if present 2017-01-18 11:24:34 +01:00
Amaia Castro
65fcd83ee5 Don’t show new annotation/comment form if allegations phase is not open 2017-01-16 19:06:06 +01:00
Amaia Castro
306e3fa59f Don’t show comments panel if seeing final version 2017-01-11 23:11:11 +01:00
Amaia Castro
4f539b374f View comments for draft text 2017-01-10 17:25:02 +01:00
Amaia Castro
b8f034d896 Legislation annotations/comments page 2017-01-09 09:29:15 +01:00
Fernando Blat
7100156b28 Show full header when click on expand button 2017-01-05 10:55:53 +01:00
Amaia Castro
ee9fa3db15 Base Legislation Annotations 2017-01-04 12:56:58 +01:00
Amaia Castro
375602d297 Display title with an * when status is draft in version chooser 2017-01-04 12:15:12 +01:00
Amaia Castro
6d99a24740 Fix draft versions list 2017-01-04 10:13:55 +01:00
Amaia Castro
f040759693 Show only published draft versions to users (and also drafts to admins) 2017-01-03 22:08:54 +01:00
Amaia Castro
d2b3a21182 Fix abilities and add specs 2017-01-03 17:48:21 +01:00
Amaia Castro
5627b18be2 Draft Version page 2017-01-02 18:05:15 +01:00
Amaia Castro
243429aa41 Set title for process and draft versions pages 2016-12-22 17:34:47 +01:00
Amaia Castro
86009bfcac Render TOC for legislation draft versions 2016-12-15 11:32:20 +01:00
Amaia Castro
766f509f8e Base legislation processes and draft versions page structure for public site 2016-12-15 11:32:20 +01:00