Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix styles for polls table and polls dates #5499

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Conversation

javierm
Copy link
Member

@javierm javierm commented Apr 22, 2024

Objectives

  • Display the polls table the same way we display other tables in the admin section
  • Apply the styles meant to be used in poll dates
  • Allow customizing the text to display poll dates
  • Simplify conditions to render the poll status icon
  • Remove unused CSS

Visual Changes

Before these changes

Poll dates are styled like regular text

There are no borders between rows in the polls administration table

After these changes

Poll dates are styled similar to other dates in the application

There are borders between rows in the polls administration table

This code isn't used since commit 5fdbc7b.
@javierm javierm self-assigned this Apr 22, 2024
@javierm javierm added this to Reviewing in Consul Democracy Apr 22, 2024
This is consistent with the way we've got partials to render debates,
proposals and legislation processes on their index pages.

Note that, while adding the tests for the status icon, we're keeping one
system test because it also tests the process of voting. We're adding a
new, similar component test, where the voter is created in the database,
so all possible statuses are tested in the component.
We were using a redundant `elsif` instead of an `else`. We were also
using a negative condition in the main `if`, which made the code a bit
harder to read.

Since we usually use `current_user` instead of `user_signed_in?`, we're
also changing that for consistency.Extract component to render the status of a poll
We accidentally introduced a typo in commit f497227 which caused the
dates to be rendered outside the element where the dates styles are
applied.
The rows in these tables were using the styles from the `.poll`
selector, and the `position: relative` property defined there caused the
inner borders to disappear.

So we're adding the `public` class to the selector; this way, it doesn't
affect elements in the admin section.

Even though it's only necessary to add the `.public` prefix to the
`.poll` selector in one place in order to fix this issue, we're doing it
everywhere for consistency.
When this code was added, in commit 1a20a3c, we had no validation
rules checking the presence of the start and end dates of a poll. Now we
do, so we don't have to check this condition in the view.
Since we were using `I18n.t`, our monkey-patch of the `t` helper wasn't
being applied.

Note that polls with no start or end date are invalid, so I don't think
it makes sense to write a test for the `polls.no_dates` scenario. I
wonder whether we should remove the code for this condition.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Consul Democracy
  
Reviewing
Development

Successfully merging this pull request may close these issues.

None yet

1 participant