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

Simplify code in the admin menu #4274

Merged
merged 7 commits into from
Dec 2, 2020
Merged

Simplify code in the admin menu #4274

merged 7 commits into from
Dec 2, 2020

Conversation

javierm
Copy link
Member

@javierm javierm commented Nov 26, 2020

Objectives

  • Fix the "statistics" link so it looks the same way the other links do
  • Reduce code duplication
  • Make it easier to write similar menus

Visual Changes

Before these changes

All links are bold except the one leading to the statistics section

After these changes

All links are bold, including the one leading to the statistics section

This way adding new methods will be easier.
We no longer need to use the `menu_` prefix, since now these methods
aren't helper methods anymore, and so their names won't collide with
other helpers.
The HTML `class` attribute was declared twice and so the second one was
being ignored.

In the case of messages, it was "working" properly because the
`class=is-active` part is not used on `<li>` tags when they've got a
`<ul>` inside them.
Now that there's no naming confict with the helper method used in the
ProposalsDashboardHelper, we can easily simplify the view, moving the
logic to the Ruby class.
It isn't used anywhere, and we could achieve the same result using the
CSS child selector `> li`.
From a semantic point of view, there's no reason to add a strong
emphasis to the menu items.

Besides, using CSS simplifies the code and is less error-prone. For
instance, the "stats" section didn't have a <strong> tag, and so it was
the only one which wasn't bold.
@javierm javierm self-assigned this Nov 26, 2020
@javierm javierm added this to Reviewing in Consul Democracy via automation Nov 26, 2020
This way we simplify the HTML and generating similar menus will be
easier. We also improve the experience for screen reader users, who
might have been hearing the icons as text because we weren't using the
`aria-hidden` attribute.

We're still keeping the "icon-" classes for compatibility with CONSUL
installations which might have changed this code.
Consul Democracy automation moved this from Reviewing to Testing Dec 2, 2020
@javierm javierm merged commit e19bc59 into master Dec 2, 2020
Consul Democracy automation moved this from Testing to Release 1.3.0 Dec 2, 2020
@javierm javierm deleted the admin_menu branch December 2, 2020 10:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants