Skip to content

Apply flash styles to Announcements#11708

Merged
alecslupu merged 19 commits intodevelopfrom
fix/announcement-flashes
Oct 4, 2023
Merged

Apply flash styles to Announcements#11708
alecslupu merged 19 commits intodevelopfrom
fix/announcement-flashes

Conversation

@andreslucena
Copy link
Copy Markdown
Member

🎩 What? Why?

As I mentioned when I introduced the new flashes in the admin panel (#11665):

NOTE: it's out of the scope of the current PR to actually change the announcements/callouts that are mixed in some forms. The idea is to make a new PR after this one is merged with those changes, to keep them small.

So, this is the PR missing, with the change of the announcements to use the new design.

Apart from that, I tuned a bit the CSS of the flashes, as I found them too bold.

Its worth noticing two particular cases where we used links in the texts, so on those cases I preferred to hard-code the styling, as the alternative was relaxing the security in the AnnouncementCell clean_body method and I didn't like that

📌 Related Issues

Testing

  1. Go to a place with announcements, for instance:
  1. See that the styles are new

📷 Screenshots

Screenshot of conference's invitations

♥️ Thank you!

* Remove `.flex-col`, as when there are links it breaks. For instance,
  in the decidim-elections Bulletin Board not configured message in the
  Admin panel.
* Replace `.font-bold` with `.font-semibold`, reducing the boldness
* Add underline to links, so users can know that they're clickable
… with AnnouncementCell

There are some cases where we can't use the Cell, as there are links and
there's a sanititzation process.

On these cases we add a comment and style them manually.
This rule was overriding all of the SVG, so we relax it a bit.
@andreslucena andreslucena added module: core module: admin type: fix PRs that implement a fix for a bug project: redesign Barcelona City Council contract no-backport Pull Requests that should not be backported labels Oct 3, 2023
@andreslucena andreslucena force-pushed the fix/announcement-flashes branch 2 times, most recently from a8eb40b to 1c254bf Compare October 3, 2023 12:10
@andreslucena andreslucena force-pushed the fix/announcement-flashes branch from 1c254bf to 8ec8f85 Compare October 3, 2023 13:19
Until now the Javascript `hidden` function worked without issues, but now that we're
changing classes of this element, as the `flash` class has already a
display, it doesn't get hidden.

The culprit is:

> Web browsers may implement the hidden state using display: none, in which case the
> element will not participate in page layout. This also means that changing the value
> of the CSS display property on an element in the hidden state will override the state.
> For instance, elements styled display: block will be displayed despite the hidden
> attribute's presence.

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden#the_hidden_state

So, with a god old `display: none` we can fix this problem.
While working in the `./decidim-core/spec/system/account_spec.rb`,
I've detected that we have not enabled the headless option, meaning that
it is opening pages in a visibly browser. This is a bit weird because
it's the only driver that's doing that.

This commit disables that behavior so its more consistent.
@andreslucena andreslucena force-pushed the fix/announcement-flashes branch from 8ec8f85 to 4168add Compare October 4, 2023 07:41
andreslucena and others added 2 commits October 4, 2023 11:00
I left a comment on why I'm reverting this. Basically, the offline
navigation feature doesn't work with the headless browser.
@andreslucena andreslucena marked this pull request as ready for review October 4, 2023 10:59
@andreslucena andreslucena requested a review from a team October 4, 2023 11:00
@alecslupu alecslupu self-assigned this Oct 4, 2023
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would change a bit the ones that i have commended on ...

Comment thread decidim-admin/app/views/decidim/admin/static_pages/_form_notable_changes.html.erb Outdated
Suggested by code review
It was implemented in two places and it didn't read well, so we're
removing this altogether.
Copy link
Copy Markdown
Contributor

@alecslupu alecslupu left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@alecslupu alecslupu merged commit 72a7ad0 into develop Oct 4, 2023
@alecslupu alecslupu deleted the fix/announcement-flashes branch October 4, 2023 17:13
entantoencuanto added a commit that referenced this pull request Oct 5, 2023
* develop:
  Fix admin redesign module (#11648)
  Apply flash styles to Announcements (#11708)
  Refactor oneliners of redesigned_a11y.js (#11713)
  Redesign: fix votings admin module issues (#11704)
  Add meta robots noindex to search and profile (#10120)
entantoencuanto added a commit that referenced this pull request Oct 5, 2023
* develop:
  Fix admin redesign module (#11648)
  Apply flash styles to Announcements (#11708)
  Refactor oneliners of redesigned_a11y.js (#11713)
  Redesign: fix votings admin module issues (#11704)
  Add meta robots noindex to search and profile (#10120)
entantoencuanto added a commit that referenced this pull request Oct 6, 2023
* feature/renaming-redesign:
  Use default current participatory space scope as root on scopes_select_tag called from bulk actions
  restore the imports thing (compilation fails for initiatives)
  change testing color: dequelabs/axe-core#3513 (comment)
  Fix admin redesign module (#11648)
  Apply flash styles to Announcements (#11708)
  Refactor oneliners of redesigned_a11y.js (#11713)
  Redesign: fix votings admin module issues (#11704)
  Add meta robots noindex to search and profile (#10120)
  Refactor dropdown scroll to menu (#11710)
  Remove unused partial
  Remove REDESIGN_PENDING obsolete comand
  Redesign: fix assembly members sidebar menu (#11699)
  Redesign: fix conferences admin module issues (#11703)
  Redesign: fix assemblies admin module issues (#11702)
andreslucena added a commit that referenced this pull request Oct 16, 2023
* Apply HTML from flashes to announcements

* Inline CSS classes to HTML callout to fix usage while the flash is actually an announcement

* Migrate hardcoded callouts to AnnouncementCell

* Fix flash styles

* Remove `.flex-col`, as when there are links it breaks. For instance,
  in the decidim-elections Bulletin Board not configured message in the
  Admin panel.
* Replace `.font-bold` with `.font-semibold`, reducing the boldness
* Add underline to links, so users can know that they're clickable

* Make the flash alerts manually in the cases where it can't be created with AnnouncementCell

There are some cases where we can't use the Cell, as there are links and
there's a sanititzation process.

On these cases we add a comment and style them manually.

* Fix bug with size of SVG icons in Admin

This rule was overriding all of the SVG, so we relax it a bit.

* Fix columns on flash when there's a title in the AnnouncementCell

* Fix `have_admin_callout` matcher with multiple flashes in the same page

* Fix specs

* Add full flash messages on 'has questionnaire' shared spec

* Improve `css_class` method when there isn't any `callout_class` argument

* Normalize i18n files with i18n-tasks

* Fix hidding when canceling email change in account#show

Until now the Javascript `hidden` function worked without issues, but now that we're
changing classes of this element, as the `flash` class has already a
display, it doesn't get hidden.

The culprit is:

> Web browsers may implement the hidden state using display: none, in which case the
> element will not participate in page layout. This also means that changing the value
> of the CSS display property on an element in the hidden state will override the state.
> For instance, elements styled display: block will be displayed despite the hidden
> attribute's presence.

https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/hidden#the_hidden_state

So, with a god old `display: none` we can fix this problem.

* Make the `pwa_chrome` Capybara driver not open pages

While working in the `./decidim-core/spec/system/account_spec.rb`,
I've detected that we have not enabled the headless option, meaning that
it is opening pages in a visibly browser. This is a bit weird because
it's the only driver that's doing that.

This commit disables that behavior so its more consistent.

* Revert "Make the pwa_chrome Capybara driver not open pages"

I left a comment on why I'm reverting this. Basically, the offline
navigation feature doesn't work with the headless browser.

* Change CSS class for callout

Suggested by code review

* Drop truncate support from AnnouncementCell

It was implemented in two places and it didn't read well, so we're
removing this altogether.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: admin module: core no-backport Pull Requests that should not be backported project: redesign Barcelona City Council contract type: fix PRs that implement a fix for a bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants