Commit 1bf00339 authored by Birger Schacht's avatar Birger Schacht
Browse files

Refactor the main page

This commit makes users mobile friendly. To not have to maintain two
menus, the menu was exported to a _menu.html.erb and is included as
part of a navbar that is only visible on small devices and contains
a hamburger dropdown menu. The menu is also as a side menu for devices
that have bigger screens.
The main navigation items (username and logout) as well as the language
menu were integrated in the menu, so that we don't have to maintain
3 menus (which we would have to somehow display on mobile).
The 'card' container was replaced, because with the elements in the
card-title integrated in the menu and without a border it did not
make sense anymore.
parent 80612fa9
Pipeline #1393 failed with stage
<%= link_to current_user, '/', class: "list-group-item list-group-item-action" %>
<%= link_to (t :logout), '/logout_local', class: "list-group-item list-group-item-action" %>
<li class="dropdown">
<a class="dropdown-toggle list-group-item list-group-item-action border-top-0 border-bottom-0" href="#" data-toggle="dropdown"><%= t(:Language) %></a>
<div class="dropdown-menu">
<% available_locales.select{|l| l != I18n.locale }.each do |l| %>
<%= link_to l, { :l => l }, class: "dropdown-item" %>
<% end %>
</div>
</li>
<% if Admin::Enabled %>
<h4 class="list-group-item list-group-item-heading text-uppercase"><%= t(:accounts) %></h4>
<%= link_to t(:generate_invites), invites_path, class: "list-group-item list-group-item-action" %>
<h4 class="list-group-item list-group-item-heading text-uppercase"><%= t(:email) %></h4>
<%= link_to t(:manage_users), users_path, class: "list-group-item list-group-item-action" %>
<%= link_to t(:manage_domains), domains_path, class: "list-group-item list-group-item-action" %>
<h4 class="list-group-item list-group-item-heading text-uppercase"><%= t(:jabber) %></h4>
<%= link_to (t :manage_jabber_ids) , jabber_ids_path, class: "list-group-item list-group-item-action" %>
<%= link_to (t :manage_jabber_domains) , jabber_domains_path, class: "list-group-item list-group-item-action" %>
<h4 class="list-group-item list-group-item-heading text-uppercase"><%= t(:admin) %></h4>
<%= link_to (t :acl) , acl_path, class: "list-group-item list-group-item-action" %></li>
<% else %>
<li class="list-group-item list-group-item-heading text-uppercase small bg-light"><%= t(:settings) %></li>
<%= link_to t(:password), password_path, class: "list-group-item list-group-item-action" %>
<% css_class = recovery_email_set? ? "" : "nudge-dot" %>
<%= link_to (t :recovery_email) , recovery_email_path, class: "list-group-item list-group-item-action #{css_class}" %>
<% css_class = requires_2fa? ? "" : "nudge-dot" %>
<%= link_to t(:tfa), tfa_path, class: "list-group-item list-group-item-action #{css_class}" %>
<%= link_to (t :recovery_token), mail_crypt_token_path, class: "list-group-item list-group-item-action" %>
<% css_class = mail_crypt_enabled? ? "" : "nudge-dot" %>
<%= link_to (t :mail_crypt_settings), mail_crypt_path, class: "list-group-item list-group-item-action #{css_class}" %>
<%= link_to (t :app_passwords), app_passwords_path, class: "list-group-item list-group-item-action" %>
<%= link_to (t :delete_account), delete_account_path, class: "list-group-item list-group-item-action" %>
<%= link_to (t :pgpkeys_title), pgpkeys_path, class: "list-group-item list-group-item-action" %>
<% if any_resources_enabled? -%>
<li class="list-group-item list-group-item-heading text-uppercase small bg-light"><%= t(:services) %></li>
<% if resource_enabled?('jabber') -%>
<%= link_to t(:manage_jabber), jabber_path, class: "list-group-item list-group-item-action" %>
<% end %>
<% end -%>
<% end %>
......@@ -19,92 +19,38 @@
<div class="row">
<div class="logo px-0">
</div>
<div class="col-sm px-0">
<div class="float-right">
<div>
<% available_locales.select{|l| l != I18n.locale }.each do |l| %>
<%= link_to l, { :l => l }, class: "border border-top-0 p-2" %>
<% end %>
</div>
</div>
</div>
</div>
</div>
<div class="container px-0">
<div class="card <% if Admin::Enabled %>border-danger<% end -%>">
<div class="card-header">
<div class="row">
<div class="col-sm-3">
<% if current_user %>
<%= link_to current_user, '/' %>
<% elsif !@handoff %>
<i><%= t(:main_title) %></i>
<% end %>
</div>
<div class="col-sm text-center">
<% if Admin::Enabled %><span class="badge badge-danger mx-auto"><%= t(:admin_mode) %></span><% end -%>
</div>
<div class="col-sm-3">
<% if current_user %>
<%= link_to (t :logout), '/logout_local', class: "float-right" %>
<% end %>
</div>
<% if current_user %>
<!-- this is the navbar that is hidden on screens wider than 'md' (d-md-none)-->
<nav class="navbar navbar-expand-lg navbar-light d-md-none px-0">
<button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarTogglerDemo01" aria-controls="navbarTogglerDemo01" aria-expanded="false" aria-label="Toggle navigation">
<span class="navbar-toggler-icon"></span>
</button>
<div class="collapse navbar-collapse" id="navbarTogglerDemo01">
<%= render "menu" %>
</div>
</div>
<div class="card-body">
<% if current_user %>
<div class="row">
<div class="col-3">
<ul class="list-group">
<% if Admin::Enabled %>
<h4 class="list-group-item list-group-item-heading text-uppercase"><%= t(:accounts) %></h4>
<%= link_to t(:generate_invites), invites_path, class: "list-group-item list-group-item-action" %>
<h4 class="list-group-item list-group-item-heading text-uppercase"><%= t(:email) %></h4>
<%= link_to t(:manage_users), users_path, class: "list-group-item list-group-item-action" %>
<%= link_to t(:manage_domains), domains_path, class: "list-group-item list-group-item-action" %>
<h4 class="list-group-item list-group-item-heading text-uppercase"><%= t(:jabber) %></h4>
<%= link_to (t :manage_jabber_ids) , jabber_ids_path, class: "list-group-item list-group-item-action" %>
<%= link_to (t :manage_jabber_domains) , jabber_domains_path, class: "list-group-item list-group-item-action" %>
<h4 class="list-group-item list-group-item-heading text-uppercase"><%= t(:admin) %></h4>
<%= link_to (t :acl) , acl_path, class: "list-group-item list-group-item-action" %></li>
<% else %>
<h4 class="list-group-item list-group-item-heading text-uppercase"><%= t(:settings) %></h4>
<%= link_to t(:password), password_path, class: "list-group-item list-group-item-action" %>
<% css_class = recovery_email_set? ? "" : "nudge-dot" %>
<%= link_to (t :recovery_email) , recovery_email_path, class: "list-group-item list-group-item-action #{css_class}" %>
<% css_class = requires_2fa? ? "" : "nudge-dot" %>
<%= link_to t(:tfa), tfa_path, class: "list-group-item list-group-item-action #{css_class}" %>
<%= link_to (t :recovery_token), mail_crypt_token_path, class: "list-group-item list-group-item-action" %>
<% css_class = mail_crypt_enabled? ? "" : "nudge-dot" %>
<%= link_to (t :mail_crypt_settings), mail_crypt_path, class: "list-group-item list-group-item-action #{css_class}" %>
<%= link_to (t :app_passwords), app_passwords_path, class: "list-group-item list-group-item-action" %>
<%= link_to (t :delete_account), delete_account_path, class: "list-group-item list-group-item-action" %>
<%= link_to (t :pgpkeys_title), pgpkeys_path, class: "list-group-item list-group-item-action" %>
<% if any_resources_enabled? -%>
<h4 class="list-group-item list-group-item-heading text-uppercase"><%= t(:services) %></h4>
<% if resource_enabled?('jabber') -%>
<%= link_to t(:manage_jabber), jabber_path, class: "list-group-item list-group-item-action" %>
<% end %>
<% end -%>
<% end %>
</ul>
</div>
<div class="col-9">
<% if s=flash[:notice] %>
<div id="flash-notice" class="notice"><%= I18n.exists?(s) ? t(s) : s %></div>
<% end %>
<%= yield %>
</div>
</nav>
<!-- this is the navbar that is hidden on screens smaller than 'md' (d-none d-md-block) -->
<div class="row">
<div class="col-3 d-none d-md-block">
<ul class="nav flex-column">
<%= render "menu" %>
</ul>
</div>
<% else%>
<% if s=flash[:notice] %><div class="alert alert-danger"><%= I18n.exists?(s) ? t(s) : s %></div><% end %>
<div class="col">
<% if s=flash[:notice] %>
<div id="flash-notice" class="notice"><%= I18n.exists?(s) ? t(s) : s %></div>
<% end %>
<%= yield %>
<% end %>
</div>
</div>
</div>
</div>
<% else%>
<% if s=flash[:notice] %><div class="alert alert-danger"><%= I18n.exists?(s) ? t(s) : s %></div><% end %>
<%= yield %>
<% end %>
</div>
</body>
</html>
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment