Simplify code to have an off-canvas menu

While Foundations's off-canvas menu allows us to forget about writing
CSS, it also leads to complicated HTML.

Ideally Foundation would provide an easy way to simplify what we're
doing, but I haven't found anything in the documentation.

We could simplify the HTML a bit more if we used a CSS grid layout
instead of a flex one, but old browsers have better support for the
latter.

Note we're using `breakpoint(medium)` so we can group the CSS for small
screens and follow SCSS-Lint rules at the same time.

Also note behavior of the main area when the menu appears on small
screens is slightly different: it doesn't move the main content to the
right. I've done it this way so we don't have any overflow issues,
unlike the previous version.

There's a small issue using a label and a checkbox to enable/disable the
menu: sighted keyboard users with a small screen might not be able to
enable the menu. So we're adding the `:focus-within` pseudoclass so the
menu can be normally navigated using the keyboard. Even if old browsers
don't support this pseudoclass, we believe the probability of a sighted
user using a small screen, navigating with the keyboard and using an old
browser is really low, particularly in the admin area.

We're also adding the `aria-hidden` attribute on the label, since the
menu is never hidden for screen readers and so having a control to show
it could be confusing. Since the label is not focusable, we're complying
with the fourth ARIA rule:

> Do not use role="presentation" or aria-hidden="true" on a focusable
> element .
>
> Using either of these on a focusable element will result in some users
> focusing on 'nothing'.
This commit is contained in:
Javi Martín
2020-04-30 16:51:24 +02:00
parent 2363aa4c76
commit 125106f9c0
8 changed files with 453 additions and 452 deletions

View File

@@ -31,7 +31,6 @@
@include foundation-responsive-embed;
@include foundation-label;
@include foundation-media-object;
@include foundation-off-canvas;
@include foundation-orbit;
@include foundation-pagination;
@include foundation-progress-bar;

View File

@@ -436,10 +436,6 @@ a {
display: table-cell;
}
.off-canvas-content {
box-shadow: none;
}
.uppercase {
text-transform: uppercase;
}
@@ -450,21 +446,62 @@ a {
}
.menu-and-content {
display: flex;
$side-menu-min-width: 250px;
> :first-child {
flex: 25%;
min-width: 250px;
@include breakpoint(medium) {
display: flex;
> :first-child {
height: 100%;
> nav {
flex: 25%;
min-width: $side-menu-min-width;
+ * {
flex: 75%;
padding: $line-height !important;
}
}
[for="show_menu"] {
display: none;
}
}
> :last-child {
flex: 75%;
overflow-x: auto;
padding: $line-height !important;
@include breakpoint(small only) {
> nav {
height: 100%;
left: -$side-menu-min-width;
overflow-y: auto;
position: fixed;
top: 0;
transition: left 0.5s ease;
width: $side-menu-min-width;
z-index: 12;
+ * {
padding: $line-height !important;
}
}
[name="show_menu"]:checked + nav,
> nav:focus-within {
left: 0;
+ * {
overflow-x: hidden;
[for="show_menu"]::after {
@include reveal-overlay;
content: "";
cursor: pointer;
display: block;
z-index: 11;
}
}
}
}
[name="show_menu"] {
display: none;
}
}

View File

@@ -1,281 +1,279 @@
<div class="admin-sidebar">
<ul id="admin_menu" data-accordion-menu data-multi-open="true">
<% if feature?(:proposals) %>
<li class="section-title">
<%= link_to admin_proposals_path do %>
<span class="icon-proposals"></span>
<strong><%= t("admin.menu.proposals") %></strong>
<% end %>
</li>
<% end %>
<% if feature?(:debates) %>
<li class="section-title <%= "is-active" if controller_name == "debates" %>">
<%= link_to admin_debates_path do %>
<span class="icon-debates"></span>
<strong><%= t("admin.menu.debates") %></strong>
<% end %>
</li>
<% end %>
<li class="section-title <%= "is-active" if controller_name == "comments" %>">
<%= link_to admin_comments_path do %>
<span class="icon-comments"></span>
<strong><%= t("admin.menu.comments") %></strong>
<ul id="admin_menu" data-accordion-menu data-multi-open="true">
<% if feature?(:proposals) %>
<li class="section-title">
<%= link_to admin_proposals_path do %>
<span class="icon-proposals"></span>
<strong><%= t("admin.menu.proposals") %></strong>
<% end %>
</li>
<% end %>
<% if feature?(:polls) %>
<li class="section-title <%= "is-active" if menu_polls? %>">
<%= link_to admin_polls_path do %>
<span class="icon-checkmark-circle"></span>
<strong><%= t("admin.menu.polls") %></strong>
<% end %>
</li>
<% end %>
<% if feature?(:legislation) %>
<li class="section-title <%= "is-active" if controller.class.parent == Admin::Legislation %>">
<%= link_to admin_legislation_processes_path do %>
<span class="icon-file-text"></span>
<strong><%= t("admin.menu.legislation") %></strong>
<% end %>
</li>
<% end %>
<% if feature?(:budgets) %>
<li class="section-title <%= "is-active" if menu_budgets? %>">
<%= link_to admin_budgets_path do %>
<span class="icon-budget"></span>
<strong><%= t("admin.menu.budgets") %></strong>
<% end %>
</li>
<% end %>
<li class="section-title">
<a href="#">
<span class="icon-box"></span>
<strong><%= t("admin.menu.title_booths") %></strong>
</a>
<ul id="booths_menu" <%= "class=is-active" if menu_booths? %>>
<li <%= "class=is-active" if %w[officers officer_assignments].include?(controller_name) %>>
<%= link_to t("admin.menu.poll_officers"), admin_officers_path %>
</li>
<li <%= "class=is-active" if controller_name == "booths" &&
action_name != "available" %>>
<%= link_to t("admin.menu.poll_booths"), admin_booths_path %>
</li>
<li <%= "class=is-active" if (controller_name == "polls" &&
action_name == "booth_assignments") ||
controller_name == "booth_assignments" &&
action_name == "manage" %>>
<%= link_to t("admin.menu.poll_booth_assignments"), booth_assignments_admin_polls_path %>
</li>
<li <%= "class=is-active" if %w[shifts booths].include?(controller_name) &&
%w[available new].include?(action_name) %>>
<%= link_to t("admin.menu.poll_shifts"), available_admin_booths_path %>
</li>
</ul>
</li>
<% if feature?(:signature_sheets) %>
<li class="section-title <%= "is-active" if controller_name == "signature_sheets" %>">
<%= link_to admin_signature_sheets_path do %>
<span class="icon-file-text-o"></span>
<strong><%= t("admin.menu.signature_sheets") %></strong>
<% end %>
</li>
<% end %>
<% messages_sections = %w[newsletters emails_download admin_notifications system_emails] %>
<% messages_menu_active = messages_sections.include?(controller_name) %>
<li class="section-title" <%= "class=is-active" if messages_menu_active %>>
<a href="#">
<span class="icon-zip"></span>
<strong><%= t("admin.menu.messaging_users") %></strong>
</a>
<ul id="messaging_users_menu" <%= "class=is-active" if messages_menu_active %>>
<li <%= "class=is-active" if controller_name == "newsletters" %>>
<%= link_to t("admin.menu.newsletters"), admin_newsletters_path %>
</li>
<li <%= "class=is-active" if controller_name == "admin_notifications" %>>
<%= link_to t("admin.menu.admin_notifications"), admin_admin_notifications_path %>
</li>
<li <%= "class=is-active" if controller_name == "system_emails" %>>
<%= link_to t("admin.menu.system_emails"), admin_system_emails_path %>
</li>
<li <%= "class=is-active" if controller_name == "emails_download" %>>
<%= link_to t("admin.menu.emails_download"), admin_emails_download_index_path %>
</li>
</ul>
</li>
<li class="section-title">
<a href="#">
<span class="icon-edit"></span>
<strong><%= t("admin.menu.title_site_customization") %></strong>
</a>
<ul <%= "class=is-active" if menu_customization? &&
controller.class.parent != Admin::Poll::Questions::Answers %>>
<li <%= "class=is-active" if menu_homepage? %>>
<%= link_to t("admin.menu.site_customization.homepage"), admin_homepage_path %>
</li>
<li <%= "class=is-active" if menu_pages? || controller_name == "pages" %>>
<%= link_to t("admin.menu.site_customization.pages"), admin_site_customization_pages_path %>
</li>
<li <%= "class=is-active" if controller_name == "banners" %>>
<%= link_to t("admin.menu.banner"), admin_banners_path %>
</li>
<li <%= "class=is-active" if controller_name == "information_texts" %>>
<%= link_to t("admin.menu.site_customization.information_texts"), admin_site_customization_information_texts_path %>
</li>
<li <%= "class=is-active" if controller_name == "documents" %>>
<%= link_to t("admin.menu.site_customization.documents"),
admin_site_customization_documents_path %>
</li>
</ul>
</li>
<li class="section-title">
<a href="#">
<span class="icon-eye"></span>
<strong><%= t("admin.menu.title_moderated_content") %></strong>
</a>
<ul <%= "class=is-active" if menu_moderated_content? %>>
<% if feature?(:proposals) %>
<li <%= "class=is-active" if controller_name == "hidden_proposals" %>>
<%= link_to t("admin.menu.hidden_proposals"), admin_hidden_proposals_path %>
</li>
<% end %>
<% if feature?(:debates) %>
<li <%= "class=is-active" if controller_name == "hidden_debates" %>>
<%= link_to t("admin.menu.hidden_debates"), admin_hidden_debates_path %>
</li>
<% end %>
<% if feature?(:budgets) %>
<li <%= "class=is-active" if controller_name == "hidden_budget_investments" %>>
<%= link_to t("admin.menu.hidden_budget_investments"), admin_hidden_budget_investments_path %>
</li>
<% end %>
<li <%= "class=is-active" if controller_name == "hidden_comments" %>>
<%= link_to t("admin.menu.hidden_comments"), admin_hidden_comments_path %>
</li>
<li <%= "class=is-active" if controller_name == "hidden_proposal_notifications" %>>
<%= link_to t("admin.menu.hidden_proposal_notifications"), admin_hidden_proposal_notifications_path %>
</li>
<li <%= "class=is-active" if controller_name == "hidden_users" %>>
<%= link_to t("admin.menu.hidden_users"), admin_hidden_users_path %>
</li>
<li <%= "class=is-active" if controller_name == "activity" %>>
<%= link_to t("admin.menu.activity"), admin_activity_path %>
</li>
</ul>
</li>
<li class="section-title">
<a href="#">
<span class="icon-organizations"></span>
<strong><%= t("admin.menu.title_profiles") %></strong>
</a>
<ul <%= "class=is-active" if menu_profiles? %>>
<li <%= "class=is-active" if controller_name == "administrators" %>>
<%= link_to t("admin.menu.administrators"), admin_administrators_path %>
</li>
<li <%= "class=is-active" if controller_name == "organizations" %>>
<%= link_to t("admin.menu.organizations"), admin_organizations_path %>
</li>
<li <%= "class=is-active" if controller_name == "officials" %>>
<%= link_to t("admin.menu.officials"), admin_officials_path %>
</li>
<li <%= "class=is-active" if controller_name == "moderators" %>>
<%= link_to t("admin.menu.moderators"), admin_moderators_path %>
</li>
<li <%= "class=is-active" if controller_name == "valuators" %>>
<%= link_to t("admin.menu.valuators"), admin_valuators_path %>
</li>
<li <%= "class=is-active" if controller_name == "managers" %>>
<%= link_to t("admin.menu.managers"), admin_managers_path %>
</li>
<li <%= "class=is-active" if controller_name == "users" %>>
<%= link_to t("admin.menu.users"), admin_users_path %>
</li>
</ul>
</li>
<li class="section-title" <%= "class=is-active" if controller_name == "stats" %>>
<%= link_to admin_stats_path do %>
<span class="icon-stats"></span><%= t("admin.menu.stats") %>
<% if feature?(:debates) %>
<li class="section-title <%= "is-active" if controller_name == "debates" %>">
<%= link_to admin_debates_path do %>
<span class="icon-debates"></span>
<strong><%= t("admin.menu.debates") %></strong>
<% end %>
</li>
<% end %>
<li class="section-title">
<a href="#">
<span class="icon-settings"></span>
<strong><%= t("admin.menu.title_settings") %></strong>
</a>
<ul <%= "class=is-active" if menu_settings? %>>
<li <%= "class=is-active" if controller_name == "settings" %>>
<%= link_to t("admin.menu.settings"), admin_settings_path %>
</li>
<li class="section-title <%= "is-active" if controller_name == "comments" %>">
<%= link_to admin_comments_path do %>
<span class="icon-comments"></span>
<strong><%= t("admin.menu.comments") %></strong>
<% end %>
</li>
<li <%= "class=is-active" if controller_name == "tags" %>>
<%= link_to t("admin.menu.proposals_topics"), admin_tags_path %>
</li>
<li <%= "class=is-active" if controller_name == "geozones" %>>
<%= link_to t("admin.menu.geozones"), admin_geozones_path %>
</li>
<li <%= "class=is-active" if controller_name == "images" &&
controller.class.parent != Admin::Poll::Questions::Answers %>>
<%= link_to t("admin.menu.site_customization.images"), admin_site_customization_images_path %>
</li>
<li <%= "class=is-active" if controller_name == "content_blocks" %>>
<%= link_to t("admin.menu.site_customization.content_blocks"), admin_site_customization_content_blocks_path %>
</li>
<li <%= "class=is-active" if submenu_local_census_records? %>>
<%= link_to t("admin.menu.local_census_records"), admin_local_census_records_path %>
</li>
</ul>
<% if feature?(:polls) %>
<li class="section-title <%= "is-active" if menu_polls? %>">
<%= link_to admin_polls_path do %>
<span class="icon-checkmark-circle"></span>
<strong><%= t("admin.menu.polls") %></strong>
<% end %>
</li>
<li class="section-title">
<a href="#">
<span class="icon-check"></span>
<strong><%= t("admin.menu.dashboard") %></strong>
</a>
<ul <%= "class=is-active" if menu_dashboard? %>>
<li <%= "class=is-active" if controller_name == "actions" %>>
<%= link_to t("admin.menu.dashboard_actions"), admin_dashboard_actions_path %>
</li>
<% end %>
<li <%= "class=is-active" if controller_name == "administrator_tasks" %>>
<%= link_to admin_dashboard_administrator_tasks_path do %>
<%= t("admin.menu.administrator_tasks") %>
<% end %>
</li>
</ul>
<% if feature?(:legislation) %>
<li class="section-title <%= "is-active" if controller.class.parent == Admin::Legislation %>">
<%= link_to admin_legislation_processes_path do %>
<span class="icon-file-text"></span>
<strong><%= t("admin.menu.legislation") %></strong>
<% end %>
</li>
</ul>
</div>
<% end %>
<% if feature?(:budgets) %>
<li class="section-title <%= "is-active" if menu_budgets? %>">
<%= link_to admin_budgets_path do %>
<span class="icon-budget"></span>
<strong><%= t("admin.menu.budgets") %></strong>
<% end %>
</li>
<% end %>
<li class="section-title">
<a href="#">
<span class="icon-box"></span>
<strong><%= t("admin.menu.title_booths") %></strong>
</a>
<ul id="booths_menu" <%= "class=is-active" if menu_booths? %>>
<li <%= "class=is-active" if %w[officers officer_assignments].include?(controller_name) %>>
<%= link_to t("admin.menu.poll_officers"), admin_officers_path %>
</li>
<li <%= "class=is-active" if controller_name == "booths" &&
action_name != "available" %>>
<%= link_to t("admin.menu.poll_booths"), admin_booths_path %>
</li>
<li <%= "class=is-active" if (controller_name == "polls" &&
action_name == "booth_assignments") ||
controller_name == "booth_assignments" &&
action_name == "manage" %>>
<%= link_to t("admin.menu.poll_booth_assignments"), booth_assignments_admin_polls_path %>
</li>
<li <%= "class=is-active" if %w[shifts booths].include?(controller_name) &&
%w[available new].include?(action_name) %>>
<%= link_to t("admin.menu.poll_shifts"), available_admin_booths_path %>
</li>
</ul>
</li>
<% if feature?(:signature_sheets) %>
<li class="section-title <%= "is-active" if controller_name == "signature_sheets" %>">
<%= link_to admin_signature_sheets_path do %>
<span class="icon-file-text-o"></span>
<strong><%= t("admin.menu.signature_sheets") %></strong>
<% end %>
</li>
<% end %>
<% messages_sections = %w[newsletters emails_download admin_notifications system_emails] %>
<% messages_menu_active = messages_sections.include?(controller_name) %>
<li class="section-title" <%= "class=is-active" if messages_menu_active %>>
<a href="#">
<span class="icon-zip"></span>
<strong><%= t("admin.menu.messaging_users") %></strong>
</a>
<ul id="messaging_users_menu" <%= "class=is-active" if messages_menu_active %>>
<li <%= "class=is-active" if controller_name == "newsletters" %>>
<%= link_to t("admin.menu.newsletters"), admin_newsletters_path %>
</li>
<li <%= "class=is-active" if controller_name == "admin_notifications" %>>
<%= link_to t("admin.menu.admin_notifications"), admin_admin_notifications_path %>
</li>
<li <%= "class=is-active" if controller_name == "system_emails" %>>
<%= link_to t("admin.menu.system_emails"), admin_system_emails_path %>
</li>
<li <%= "class=is-active" if controller_name == "emails_download" %>>
<%= link_to t("admin.menu.emails_download"), admin_emails_download_index_path %>
</li>
</ul>
</li>
<li class="section-title">
<a href="#">
<span class="icon-edit"></span>
<strong><%= t("admin.menu.title_site_customization") %></strong>
</a>
<ul <%= "class=is-active" if menu_customization? &&
controller.class.parent != Admin::Poll::Questions::Answers %>>
<li <%= "class=is-active" if menu_homepage? %>>
<%= link_to t("admin.menu.site_customization.homepage"), admin_homepage_path %>
</li>
<li <%= "class=is-active" if menu_pages? || controller_name == "pages" %>>
<%= link_to t("admin.menu.site_customization.pages"), admin_site_customization_pages_path %>
</li>
<li <%= "class=is-active" if controller_name == "banners" %>>
<%= link_to t("admin.menu.banner"), admin_banners_path %>
</li>
<li <%= "class=is-active" if controller_name == "information_texts" %>>
<%= link_to t("admin.menu.site_customization.information_texts"), admin_site_customization_information_texts_path %>
</li>
<li <%= "class=is-active" if controller_name == "documents" %>>
<%= link_to t("admin.menu.site_customization.documents"),
admin_site_customization_documents_path %>
</li>
</ul>
</li>
<li class="section-title">
<a href="#">
<span class="icon-eye"></span>
<strong><%= t("admin.menu.title_moderated_content") %></strong>
</a>
<ul <%= "class=is-active" if menu_moderated_content? %>>
<% if feature?(:proposals) %>
<li <%= "class=is-active" if controller_name == "hidden_proposals" %>>
<%= link_to t("admin.menu.hidden_proposals"), admin_hidden_proposals_path %>
</li>
<% end %>
<% if feature?(:debates) %>
<li <%= "class=is-active" if controller_name == "hidden_debates" %>>
<%= link_to t("admin.menu.hidden_debates"), admin_hidden_debates_path %>
</li>
<% end %>
<% if feature?(:budgets) %>
<li <%= "class=is-active" if controller_name == "hidden_budget_investments" %>>
<%= link_to t("admin.menu.hidden_budget_investments"), admin_hidden_budget_investments_path %>
</li>
<% end %>
<li <%= "class=is-active" if controller_name == "hidden_comments" %>>
<%= link_to t("admin.menu.hidden_comments"), admin_hidden_comments_path %>
</li>
<li <%= "class=is-active" if controller_name == "hidden_proposal_notifications" %>>
<%= link_to t("admin.menu.hidden_proposal_notifications"), admin_hidden_proposal_notifications_path %>
</li>
<li <%= "class=is-active" if controller_name == "hidden_users" %>>
<%= link_to t("admin.menu.hidden_users"), admin_hidden_users_path %>
</li>
<li <%= "class=is-active" if controller_name == "activity" %>>
<%= link_to t("admin.menu.activity"), admin_activity_path %>
</li>
</ul>
</li>
<li class="section-title">
<a href="#">
<span class="icon-organizations"></span>
<strong><%= t("admin.menu.title_profiles") %></strong>
</a>
<ul <%= "class=is-active" if menu_profiles? %>>
<li <%= "class=is-active" if controller_name == "administrators" %>>
<%= link_to t("admin.menu.administrators"), admin_administrators_path %>
</li>
<li <%= "class=is-active" if controller_name == "organizations" %>>
<%= link_to t("admin.menu.organizations"), admin_organizations_path %>
</li>
<li <%= "class=is-active" if controller_name == "officials" %>>
<%= link_to t("admin.menu.officials"), admin_officials_path %>
</li>
<li <%= "class=is-active" if controller_name == "moderators" %>>
<%= link_to t("admin.menu.moderators"), admin_moderators_path %>
</li>
<li <%= "class=is-active" if controller_name == "valuators" %>>
<%= link_to t("admin.menu.valuators"), admin_valuators_path %>
</li>
<li <%= "class=is-active" if controller_name == "managers" %>>
<%= link_to t("admin.menu.managers"), admin_managers_path %>
</li>
<li <%= "class=is-active" if controller_name == "users" %>>
<%= link_to t("admin.menu.users"), admin_users_path %>
</li>
</ul>
</li>
<li class="section-title" <%= "class=is-active" if controller_name == "stats" %>>
<%= link_to admin_stats_path do %>
<span class="icon-stats"></span><%= t("admin.menu.stats") %>
<% end %>
</li>
<li class="section-title">
<a href="#">
<span class="icon-settings"></span>
<strong><%= t("admin.menu.title_settings") %></strong>
</a>
<ul <%= "class=is-active" if menu_settings? %>>
<li <%= "class=is-active" if controller_name == "settings" %>>
<%= link_to t("admin.menu.settings"), admin_settings_path %>
</li>
<li <%= "class=is-active" if controller_name == "tags" %>>
<%= link_to t("admin.menu.proposals_topics"), admin_tags_path %>
</li>
<li <%= "class=is-active" if controller_name == "geozones" %>>
<%= link_to t("admin.menu.geozones"), admin_geozones_path %>
</li>
<li <%= "class=is-active" if controller_name == "images" &&
controller.class.parent != Admin::Poll::Questions::Answers %>>
<%= link_to t("admin.menu.site_customization.images"), admin_site_customization_images_path %>
</li>
<li <%= "class=is-active" if controller_name == "content_blocks" %>>
<%= link_to t("admin.menu.site_customization.content_blocks"), admin_site_customization_content_blocks_path %>
</li>
<li <%= "class=is-active" if submenu_local_census_records? %>>
<%= link_to t("admin.menu.local_census_records"), admin_local_census_records_path %>
</li>
</ul>
</li>
<li class="section-title">
<a href="#">
<span class="icon-check"></span>
<strong><%= t("admin.menu.dashboard") %></strong>
</a>
<ul <%= "class=is-active" if menu_dashboard? %>>
<li <%= "class=is-active" if controller_name == "actions" %>>
<%= link_to t("admin.menu.dashboard_actions"), admin_dashboard_actions_path %>
</li>
<li <%= "class=is-active" if controller_name == "administrator_tasks" %>>
<%= link_to admin_dashboard_administrator_tasks_path do %>
<%= t("admin.menu.administrator_tasks") %>
<% end %>
</li>
</ul>
</li>
</ul>

View File

@@ -7,34 +7,22 @@
</head>
<body class="admin">
<div class="off-canvas-wrapper">
<div class="off-canvas-wrapper-inner" data-off-canvas-wrapper>
<div class="off-canvas position-left" id="offCanvas" data-off-canvas>
<%= render "layouts/admin_header" %>
<div class="show-for-small-only">
<%= side_menu %>
</div>
</div>
<div class="menu-and-content no-margin-top">
<%= check_box_tag :show_menu, nil, false, role: "switch" %>
<div class="off-canvas-content" data-off-canvas-content>
<%= render "layouts/admin_header" %>
<nav id="side_menu" class="admin-sidebar">
<%= side_menu %>
</nav>
<div class="menu-and-content no-margin-top">
<div id="side_menu" class="hide-for-small-only">
<%= side_menu %>
</div>
<div class="admin-content">
<%= label_tag :show_menu, t("admin.menu.admin"),
"aria-hidden": true, class: "button hollow expanded" %>
<div class="admin-content">
<div class="show-for-small-only">
<button type="button" class="button hollow expanded" data-toggle="offCanvas"><%= t("admin.menu.admin") %></button>
</div>
<%= render "layouts/flash" %>
<%= render "layouts/officing_booth" if controller.class.parent == Officing && session[:booth_id].present? %>
<%= yield %>
</div>
</div>
</div>
<%= render "layouts/flash" %>
<%= render "layouts/officing_booth" if controller.class.parent == Officing && session[:booth_id].present? %>
<%= yield %>
</div>
</div>
</body>

View File

@@ -25,40 +25,23 @@
<h1 class="show-for-sr"><%= setting["org_name"] %></h1>
<div class="off-canvas-wrapper">
<div class="off-canvas-wrapper-inner" data-off-canvas-wrapper>
<div class="off-canvas position-left" id="offCanvas" data-off-canvas>
<div class="show-for-small-only">
<div class="dashboard-sidebar">
<%= render "dashboard/menu" %>
</div>
</div>
</div>
<%= render "layouts/header", with_subnavigation: false %>
<div class="off-canvas-content" data-off-canvas-content>
<%= render "layouts/header", with_subnavigation: false %>
<div class="menu-and-content no-margin-top">
<%= check_box_tag :show_menu, nil, false, role: "switch" %>
<div class="menu-and-content no-margin-top">
<div id="side_menu" class="hide-for-small-only">
<div class="dashboard-sidebar">
<%= render "dashboard/menu" %>
</div>
</div>
<nav id="side_menu" class="dashboard-sidebar">
<%= render "dashboard/menu" %>
</nav>
<div class="admin-content">
<div class="show-for-small-only">
<button type="button" class="button hollow expanded" data-toggle="offCanvas">
<%= t("admin.menu.admin") %>
</button>
</div>
<div class="admin-content">
<%= label_tag :show_menu, t("admin.menu.admin"),
"aria-hidden": true, class: "button hollow expanded" %>
<%= render "layouts/flash" %>
<%= render "layouts/dashboard/proposal_totals" %>
<%= render "layouts/dashboard/proposal_header" %>
<%= yield %>
</div>
</div>
</div>
<%= render "layouts/flash" %>
<%= render "layouts/dashboard/proposal_totals" %>
<%= render "layouts/dashboard/proposal_header" %>
<%= yield %>
</div>
</div>
</body>

View File

@@ -46,7 +46,7 @@
</header>
<main class="no-margin-top row expanded collapse">
<div class="small-12 medium-3 column">
<div class="small-12 medium-3 column admin-sidebar">
<%= render "/management/menu" %>
</div>

View File

@@ -1,68 +1,66 @@
<div class="admin-sidebar">
<ul id="admin_menu" data-accordion-menu>
<li class="section-title">
<a href="#">
<span class="icon-user"></span>
<strong><%= t("management.menu.users") %></strong>
</a>
<ul class="is-active">
<ul id="admin_menu" data-accordion-menu>
<li class="section-title">
<a href="#">
<span class="icon-user"></span>
<strong><%= t("management.menu.users") %></strong>
</a>
<ul class="is-active">
<li <%= "class=is-active" if menu_users? %>>
<%= link_to t("management.menu.select_user"), management_document_verifications_path %>
</li>
<% if managed_user.email %>
<li <%= "class=is-active" if menu_edit_password_email? %>>
<%= link_to t("management.account.menu.reset_password_email"), edit_password_email_management_account_path %>
</li>
<% end %>
<li <%= "class=is-active" if menu_edit_password_manually? %>>
<%= link_to t("management.account.menu.reset_password_manually"), edit_password_manually_management_account_path %>
</li>
<li <%= "class=is-active" if menu_create_proposal? %>>
<%= link_to t("management.menu.create_proposal"), new_management_proposal_path %>
</li>
<li <%= "class=is-active" if menu_support_proposal? %>>
<%= link_to t("management.menu.support_proposals"), management_proposals_path %>
</li>
<% if Setting["process.budgets"] %>
<li <%= "class=is-active" if menu_create_investments? %>>
<%= link_to t("management.menu.create_budget_investment"), create_investments_management_budgets_path %>
</li>
<li <%= "class=is-active" if menu_support_investments? %>>
<%= link_to t("management.menu.support_budget_investments"), support_investments_management_budgets_path %>
</li>
<% end %>
<li <%= "class=is-active" if menu_users? %>>
<%= link_to t("management.menu.select_user"), management_document_verifications_path %>
</li>
</ul>
<% if managed_user.email %>
<li <%= "class=is-active" if menu_edit_password_email? %>>
<%= link_to t("management.account.menu.reset_password_email"), edit_password_email_management_account_path %>
</li>
<% end %>
<li <%= "class=is-active" if menu_edit_password_manually? %>>
<%= link_to t("management.account.menu.reset_password_manually"), edit_password_manually_management_account_path %>
</li>
<li <%= "class=is-active" if menu_create_proposal? %>>
<%= link_to t("management.menu.create_proposal"), new_management_proposal_path %>
</li>
<li <%= "class=is-active" if menu_support_proposal? %>>
<%= link_to t("management.menu.support_proposals"), management_proposals_path %>
</li>
<% if Setting["process.budgets"] %>
<li <%= "class=is-active" if menu_create_investments? %>>
<%= link_to t("management.menu.create_budget_investment"), create_investments_management_budgets_path %>
</li>
<li <%= "class=is-active" if menu_support_investments? %>>
<%= link_to t("management.menu.support_budget_investments"), support_investments_management_budgets_path %>
</li>
<% end %>
</li>
</ul>
</li>
<% if Setting["process.budgets"] %>
<li <%= "class=is-active" if menu_print_investments? %>>
<%= link_to print_investments_management_budgets_path do %>
<span class="icon-print"></span>
<%= t("management.menu.print_budget_investments") %>
<% end %>
</li>
<% if Setting["process.budgets"] %>
<li <%= "class=is-active" if menu_print_investments? %>>
<%= link_to print_investments_management_budgets_path do %>
<span class="icon-print"></span>
<%= t("management.menu.print_budget_investments") %>
<% end %>
</li>
<% end %>
<li <%= "class=is-active" if menu_print_proposals? %>>
<%= link_to print_management_proposals_path do %>
<span class="icon-print"></span>
<%= t("management.menu.print_proposals") %>
<% end %>
</li>
<li <%= "class=is-active" if menu_print_proposals? %>>
<%= link_to print_management_proposals_path do %>
<span class="icon-print"></span>
<%= t("management.menu.print_proposals") %>
<% end %>
</li>
<li <%= "class=is-active" if menu_user_invites? %>>
<%= link_to new_management_user_invite_path do %>
<span class="icon-letter"></span>
<%= t("management.menu.user_invites") %>
<% end %>
</li>
</ul>
</div>
<li <%= "class=is-active" if menu_user_invites? %>>
<%= link_to new_management_user_invite_path do %>
<span class="icon-letter"></span>
<%= t("management.menu.user_invites") %>
<% end %>
</li>
</ul>

View File

@@ -1,55 +1,53 @@
<nav class="admin-sidebar">
<ul id="moderation_menu">
<li>
<%= link_to t("moderation.dashboard.index.title"), moderation_root_path %>
</li>
<ul id="moderation_menu">
<li>
<%= link_to t("moderation.dashboard.index.title"), moderation_root_path %>
</li>
<% if feature?(:proposals) %>
<li <%= "class=is-active" if controller_name == "proposals" %>>
<%= link_to moderation_proposals_path do %>
<span class="icon-proposals"></span>
<%= t("moderation.menu.proposals") %>
<% end %>
</li>
<li <%= "class=is-active" if controller_name == "proposal_notifications" %>>
<%= link_to moderation_proposal_notifications_path do %>
<span class="icon-proposals"></span>
<%= t("moderation.menu.proposal_notifications") %>
<% end %>
</li>
<% end %>
<% if feature?(:debates) %>
<li <%= "class=is-active" if controller_name == "debates" %>>
<%= link_to moderation_debates_path do %>
<span class="icon-debates"></span>
<%= t("moderation.menu.flagged_debates") %>
<% end %>
</li>
<% end %>
<% if feature?(:budgets) %>
<li <%= "class=is-active" if controller_name == "investments" %>>
<%= link_to moderation_budget_investments_path do %>
<span class="icon-budget"></span>
<%= t("moderation.menu.flagged_investments") %>
<% end %>
</li>
<% end %>
<li <%= "class=is-active" if controller_name == "comments" %>>
<%= link_to moderation_comments_path do %>
<span class="icon-comments"></span>
<%= t("moderation.menu.flagged_comments") %>
<% if feature?(:proposals) %>
<li <%= "class=is-active" if controller_name == "proposals" %>>
<%= link_to moderation_proposals_path do %>
<span class="icon-proposals"></span>
<%= t("moderation.menu.proposals") %>
<% end %>
</li>
<li <%= "class=is-active" if controller_name == "users" %>>
<%= link_to moderation_users_path do %>
<span class="icon-user"></span>
<%= t("moderation.menu.users") %>
<li <%= "class=is-active" if controller_name == "proposal_notifications" %>>
<%= link_to moderation_proposal_notifications_path do %>
<span class="icon-proposals"></span>
<%= t("moderation.menu.proposal_notifications") %>
<% end %>
</li>
</ul>
</nav>
<% end %>
<% if feature?(:debates) %>
<li <%= "class=is-active" if controller_name == "debates" %>>
<%= link_to moderation_debates_path do %>
<span class="icon-debates"></span>
<%= t("moderation.menu.flagged_debates") %>
<% end %>
</li>
<% end %>
<% if feature?(:budgets) %>
<li <%= "class=is-active" if controller_name == "investments" %>>
<%= link_to moderation_budget_investments_path do %>
<span class="icon-budget"></span>
<%= t("moderation.menu.flagged_investments") %>
<% end %>
</li>
<% end %>
<li <%= "class=is-active" if controller_name == "comments" %>>
<%= link_to moderation_comments_path do %>
<span class="icon-comments"></span>
<%= t("moderation.menu.flagged_comments") %>
<% end %>
</li>
<li <%= "class=is-active" if controller_name == "users" %>>
<%= link_to moderation_users_path do %>
<span class="icon-user"></span>
<%= t("moderation.menu.users") %>
<% end %>
</li>
</ul>