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

Show edit and export on small screens #4839

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions app/assets/javascripts/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -79,8 +79,11 @@ $(document).ready(function () {

if (windowWidth < compactWidth) {
$("body").removeClass("compact-nav").addClass("small-nav");
// Toggling the classes is needed until https://github.com/twbs/bootstrap/issues/39213 is added
$("nav.primary > .btn-group").removeClass("btn-group").addClass("btn-group-vertical");
} else if (windowWidth < headerWidth) {
$("body").addClass("compact-nav").removeClass("small-nav");
$("nav.primary > .btn-group").removeClass("btn-group-vertical").addClass("btn-group");
} else {
$("body").removeClass("compact-nav").removeClass("small-nav");
}
Expand Down
15 changes: 11 additions & 4 deletions app/assets/stylesheets/common.scss
Original file line number Diff line number Diff line change
Expand Up @@ -199,20 +199,27 @@ body.small-nav {
}
}

#sidebar .search_forms,
#edit_tab,
#export_tab {
#sidebar .search_forms {
display: none;
}

nav.primary {
margin-right: 0;
padding: 0;

.btn-group {
> .btn-group,
> .btn-group-vertical {
width: 100%;
padding: 10px;
}

// Fix Bootstrap 5 bug, see https://github.com/twbs/bootstrap/pull/40488
.btn-group-vertical>.btn-group:not(:first-child)>.btn,
.btn-group-vertical>.btn:nth-child(n+3),
.btn-group-vertical>:not(.btn-check)+.btn {
border-top-left-radius: 0;
border-top-right-radius: 0;
}
}

nav.secondary {
Expand Down
8 changes: 4 additions & 4 deletions app/views/layouts/_header.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -8,14 +8,14 @@
<a href="#" id="menu-icon"></a>
<nav class='primary'>
<%= content_for :header %>
<div class="btn-group">
<div id="edit_tab" class="btn-group">
<div class="btn-group" role="group">
<div id="edit_tab" class="btn-group" role="group">
<%= link_to t("layouts.edit"),
edit_path,
:class => "btn btn-outline-primary geolink editlink",
:class => "btn btn-outline-primary geolink editlink w-100",
:id => "editanchor",
:data => { :editor => preferred_editor } %>
<button class='btn btn-outline-primary dropdown-toggle dropdown-toggle-split' type='button' data-bs-toggle='dropdown'></button>
<button class='btn btn-outline-primary dropdown-toggle dropdown-toggle-split px-3 px-md-2' type='button' data-bs-toggle='dropdown'></button>
<ul class='dropdown-menu'>
<% Editors::RECOMMENDED_EDITORS.each do |editor| %>
<li>
Expand Down