Commit Graph

25 Commits

Author SHA1 Message Date
Javi Martín
53ff81dfdf Unify code applying the colors of a process
We had some duplication because the `css_for_process_header` was using
an instance variable, and so it couldn't be called from a partial where
this instance variable wasn't available.

Using a local variable and passing it as a parameter (as we should
always do) solves the issue and lets us simplify the code.
2025-03-06 18:25:45 +01: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
taitus
85ffc70f5f Apply Legislation Process default colors to dev seeds
Legislation Processes created through the admin form were getting the default color.
However, Legislation processes created by other means (like the `db:dev_seed` rake task) were not getting these default values.

This feature was originally implemented when we were using Rails 4.
With Rails 5, we can provide default values to all new Legislation processes
and simplify the code at the same time thanks to its `attribute` method.

Related commit:
https://github.com/consul/consul/pull/4080/commits/0b83be6
2020-09-08 10:07:43 +02:00
Javi Martín
fc9a87a8ab Use native HTML5 date fields in the admin section
We've had to add a couple of hacks in order to make jQuery UI datepicker
work with Turbolinks, and one of our tests is failing because the
datepicker changes its height when changing from a month with 5 weeks to
a month with 6 weeks.

We could add a workaround so the test still passes (jQuery UI doesn't
provide a configuration option to always displays 6 weeks in the
datepicker), but I think it's easier to just use the HTML5 native date
input field, which also allows us to simplify the code a bit and IMHO it
improves the user experience, particularly when using mobile phones.

Since date fields are not supported in Safari and Internet Explorer,
we're still using the jQuery UI datepicker on those browsers (and on any
other browser not supporting date fields).

Due to these changes, we're moving the tests checking datepicker's
behaviour to the dashboard. I've choosing not to change the public pages
because I'm not 100% sure everybody would like this change (some people
prefer the datepicker because we can configure the way it looks).
2020-08-28 12:55:58 +02:00
Javi Martín
db97f9d08c Add and apply rubocop rules for empty lines
We were very inconsistent regarding these rules.

Personally I prefer no empty lines around blocks, clases, etc... as
recommended by the Ruby style guide [1], and they're the default values
in rubocop, so those are the settings I'm applying.

The exception is the `private` access modifier, since we were leaving
empty lines around it most of the time. That's the default rubocop rule
as well. Personally I don't have a strong preference about this one.


[1] https://rubystyle.guide/#empty-lines-around-bodies
2019-10-24 17:11:47 +02:00
Javi Martín
a5ba13b599 Apply Rails/Presence rubocop rule 2019-09-10 21:43:38 +02:00
Julian Herrero
28835a29ef Share helper between class Proposal and Legislation::Proposal 2019-05-30 11:19:38 +02:00
Julian Herrero
b460c024f3 Use double quotes in app/helpers 2019-03-15 09:26:49 +01:00
decabeza
3ab80b229f Use interpolation instead of concatenation on legislation helper 2019-02-20 13:32:35 +01:00
decabeza
e1bbd0eef0 Add default colours for legislation processes header 2019-02-20 13:32:31 +01:00
decabeza
5893ed7587 Create helper for legislation process header with custom colors 2019-01-30 13:15:42 +01:00
Manu
b6cfe92d76 fixed banner styles issues 2019-01-21 12:02:27 -05:00
dperez
bef404c443 add homepage for legislation processes 2018-12-15 18:04:24 +01:00
Javi Martín
03dc43a500 Manage legislation process milestones 2018-12-11 20:18:53 +01:00
Javi Martín
9ad8c5728a Refactor legislation process subnav 2018-11-30 18:09:52 +01:00
decabeza
5abeeb8588 Fixes date format on legislation helper 2018-11-14 12:41:22 +01:00
Javi Martín
4c84a3a854 Move logic from view to helper 2018-10-04 16:31:00 +02:00
Javi Martín
f93281fd02 Extract link text to a helper
This way we can use the same code in custom views which won't use the
same text.
2018-10-03 22:06:20 +02:00
Bertocq
bb1e5e4608 Fixed output 2017-11-17 00:21:16 +01:00
Amaia Castro
9c8102b9f3 Refactor path helpers for comments 2017-01-18 16:58:16 +01:00
Amaia Castro
b8f034d896 Legislation annotations/comments page 2017-01-09 09:29:15 +01:00
Amaia Castro
d29a9fe761 Match js calendar date format in admin process form text fields 2017-01-02 13:22:33 +01:00
Amaia Castro
de5df61359 Legislation question comments spec 2016-12-23 15:40:52 +01:00
Amaia Castro
36399277ec Legislation Process page 2016-12-22 11:23:49 +01:00
Amaia Castro
a4055a1578 Legislation processes home page 2016-12-16 17:59:44 +01:00