From ba982e48c478ee67ee2fc5766299e1b57cc3ba11 Mon Sep 17 00:00:00 2001 From: mxdanger <32040254+mxdanger@users.noreply.github.com> Date: Mon, 8 Feb 2021 17:32:29 -0800 Subject: [PATCH 1/3] Fix unexpected spacing on note buttons when overflowed --- app/views/browse/note.html.erb | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/app/views/browse/note.html.erb b/app/views/browse/note.html.erb index 1a792e873..52ce00b7b 100644 --- a/app/views/browse/note.html.erb +++ b/app/views/browse/note.html.erb @@ -53,10 +53,10 @@
<% if current_user.moderator? -%> - " class="btn btn-light" data-note-id="<%= @note.id %>" data-method="DELETE" data-url="<%= note_url(@note, "json") %>"> + " class="btn btn-light mb-2" data-note-id="<%= @note.id %>" data-method="DELETE" data-url="<%= note_url(@note, "json") %>"> <% end -%> - " class="btn btn-primary" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= close_note_url(@note, "json") %>"> - " class="btn btn-primary" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= comment_note_url(@note, "json") %>" disabled="1"> + " class="btn btn-primary mb-2" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= close_note_url(@note, "json") %>"> + " class="btn btn-primary mb-2" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= comment_note_url(@note, "json") %>" disabled="1">
<% end -%> @@ -65,10 +65,10 @@
<% if current_user and current_user.moderator? -%> - " class="btn btn-light" data-note-id="<%= @note.id %>" data-method="DELETE" data-url="<%= note_url(@note, "json") %>"> + " class="btn btn-light mb-2" data-note-id="<%= @note.id %>" data-method="DELETE" data-url="<%= note_url(@note, "json") %>"> <% end -%> <% if current_user -%> - " class="btn btn-primary" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= reopen_note_url(@note, "json") %>"> + " class="btn btn-primary mb-2" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= reopen_note_url(@note, "json") %>"> <% end -%>
From ea92d66cc0668246f026c5d5394d53180be040c3 Mon Sep 17 00:00:00 2001 From: mxdanger <32040254+mxdanger@users.noreply.github.com> Date: Wed, 17 Feb 2021 18:27:41 -0800 Subject: [PATCH 2/3] Add btn-wrapper class --- app/assets/stylesheets/common.scss | 6 ++++++ app/views/browse/note.html.erb | 14 +++++++------- 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index c010691c6..4664578cd 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -977,6 +977,12 @@ tr.turn:hover { } } +.btn-wrapper { + > .btn { + margin-bottom: $lineheight/4; + } +} + /* Rules for export sidebar */ .export_form { diff --git a/app/views/browse/note.html.erb b/app/views/browse/note.html.erb index 52ce00b7b..6dcd46e76 100644 --- a/app/views/browse/note.html.erb +++ b/app/views/browse/note.html.erb @@ -51,24 +51,24 @@
-
+
<% if current_user.moderator? -%> - " class="btn btn-light mb-2" data-note-id="<%= @note.id %>" data-method="DELETE" data-url="<%= note_url(@note, "json") %>"> + " class="btn btn-light" data-note-id="<%= @note.id %>" data-method="DELETE" data-url="<%= note_url(@note, "json") %>"> <% end -%> - " class="btn btn-primary mb-2" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= close_note_url(@note, "json") %>"> - " class="btn btn-primary mb-2" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= comment_note_url(@note, "json") %>" disabled="1"> + " class="btn btn-primary" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= close_note_url(@note, "json") %>"> + " class="btn btn-primary" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= comment_note_url(@note, "json") %>" disabled="1">
<% end -%> <% else %>
-
+
<% if current_user and current_user.moderator? -%> - " class="btn btn-light mb-2" data-note-id="<%= @note.id %>" data-method="DELETE" data-url="<%= note_url(@note, "json") %>"> + " class="btn btn-light" data-note-id="<%= @note.id %>" data-method="DELETE" data-url="<%= note_url(@note, "json") %>"> <% end -%> <% if current_user -%> - " class="btn btn-primary mb-2" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= reopen_note_url(@note, "json") %>"> + " class="btn btn-primary" data-note-id="<%= @note.id %>" data-method="POST" data-url="<%= reopen_note_url(@note, "json") %>"> <% end -%>
From 00dbe5f4a4bffdac2ac093cbd42e17da9945851c Mon Sep 17 00:00:00 2001 From: Andy Allan Date: Wed, 24 Feb 2021 10:35:28 +0000 Subject: [PATCH 3/3] Use the bootstrap spacer variable as the basis for spacing calcuation, and match mb-1 definition --- app/assets/stylesheets/common.scss | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/app/assets/stylesheets/common.scss b/app/assets/stylesheets/common.scss index 4664578cd..136404858 100644 --- a/app/assets/stylesheets/common.scss +++ b/app/assets/stylesheets/common.scss @@ -977,9 +977,13 @@ tr.turn:hover { } } +/* Bootstrap buttons don't have any vertical margin, so + they touch when adjacent buttons wrap onto a new line + e.g. wide form buttons on a narrow sidebar */ + .btn-wrapper { > .btn { - margin-bottom: $lineheight/4; + margin-bottom: $spacer * 0.25; } }