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

Bootstrap 5 updates #329

Merged
merged 50 commits into from
May 21, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
a67f7d0
Update bootstrap dependency to 5.0.0.beta2
mhw Mar 29, 2021
641ae99
.custom-* styles merged in to native ones
mhw Apr 3, 2021
e8f5b84
Use map-merge to add custom colors to theme
mhw Mar 30, 2021
a73b8df
Update header markup
mhw Mar 30, 2021
a1fa3e8
Breadcrumbs have no padding now
mhw Mar 30, 2021
5cd4f73
data-toggle and data-target get 'bs-' prefix
mhw Mar 30, 2021
08772f3
data-placement gets 'bs-' prefix; drop data-trigger
mhw Mar 30, 2021
9e5fe7d
Drop top margin; update horizontal margin
mhw Mar 30, 2021
05a5ffc
Rework stack/split button group
mhw Mar 30, 2021
08d330e
Hide toggle buttons below medium breakpoint
mhw Mar 30, 2021
91283a9
data-dismiss gets 'bs-' prefix on modal
mhw Mar 30, 2021
ccd1ad6
Use bootstrap's close button on modal
mhw Mar 30, 2021
f3c113e
.form-text now subsumes <small> and .text-muted
mhw Apr 2, 2021
cbe9b25
Drop .form-group-{invalid,valid}
mhw Apr 2, 2021
3cc0fb6
verticals: .form-group -> .mb-3
mhw Apr 2, 2021
8b36400
verticals: labels need .form-label
mhw Apr 2, 2021
b57bce2
verticals: .form-control-file -> .form-control
mhw Apr 2, 2021
3acd1ba
verticals: .form-control -> .form-select
mhw Apr 3, 2021
bfd4988
verticals: .form-control-range -> .form-range
mhw Apr 3, 2021
d0f0a4a
verticals: address layout issue with boolean
mhw Apr 3, 2021
94b936a
Rework event handling for stack/split toggle
mhw Apr 3, 2021
44c9954
Get stack/split state from radio buttons
mhw Apr 3, 2021
8b783f2
horizontals: .form-group -> .mb-3
mhw Apr 4, 2021
2372204
horizontals: .form-control-file -> .form-control
mhw Apr 4, 2021
cc59ab0
horizontals: .form-control -> .form-select
mhw Apr 5, 2021
2cbe2cf
horizontals: .form-control-range -> .form-range
mhw Apr 5, 2021
f090c66
horizontals: better range label/input alignment
mhw Apr 5, 2021
a293bbc
horizontals: remove duplicate label on boolean
mhw Apr 5, 2021
28cce78
horizontals: fix margin at bottom of form
mhw Apr 5, 2021
cbc23eb
inlines: .sr-only -> .visually-hidden
mhw Apr 5, 2021
a83c110
inlines: .form-inline replaced with grid
mhw Apr 5, 2021
d7fada1
.custom-* form styles have been dropped
mhw Apr 5, 2021
d44ef66
input_groups: .form-group -> .mb-3
mhw Apr 5, 2021
f70b8c2
input_groups: labels need .form-label
mhw Apr 5, 2021
f7ad0d8
input_groups: prepend/append wrapper div dropped
mhw Apr 6, 2021
90e0331
input_groups: fix password js
mhw Apr 6, 2021
c5e3649
floating_labels: built in with v5
mhw Apr 6, 2021
9816838
floating_labels: remove `<select multiple>` example
mhw Apr 6, 2021
f0e5674
floating_labels: .custom-select -> .form-select
mhw Apr 6, 2021
59a709d
floating_labels: docs recommend against rows=""
mhw Apr 6, 2021
013e7f7
input_groups: add .has-validation, move feedback
mhw Apr 6, 2021
48e2504
remove .d-block where it is not needed
mhw Apr 6, 2021
0be6423
fix inclusion of stylesheets in documentation
mhw Apr 6, 2021
3e58a8c
Update version number on home page
mhw Apr 6, 2021
9ed2d86
Replace .media and .media-body
mhw Apr 6, 2021
e4f1535
`div` is the default for `tag` in wrappers
mhw Apr 6, 2021
5574235
Update bootstrap dependency to 5.0.0
mhw May 14, 2021
fafe2d9
Add `offcanvas` to `application.scss`
mhw May 14, 2021
ccf76a7
Bump bootstrap rubygem to v5.0.1
m5o May 21, 2021
5aa5db0
Merge branch 'master' into bootstrap-5
m5o May 21, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ gem 'tzinfo-data', platforms: [:mingw, :mswin, :x64_mingw, :jruby]


# Custom
gem 'bootstrap', '~> 4.6.0'
gem 'bootstrap', '~> 5.0.1'
gem 'inline_svg', '~> 1.7'
gem 'jquery-rails'
gem 'kramdown', '~> 2.3'
Expand Down
14 changes: 7 additions & 7 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,14 @@ GEM
zeitwerk (~> 2.3)
addressable (2.7.0)
public_suffix (>= 2.0.2, < 5.0)
autoprefixer-rails (10.2.0.0)
execjs
autoprefixer-rails (10.2.5.0)
execjs (< 2.8.0)
bindex (0.8.1)
bootsnap (1.7.2)
msgpack (~> 1.0)
bootstrap (4.6.0)
bootstrap (5.0.1)
autoprefixer-rails (>= 9.1.0)
popper_js (>= 1.14.3, < 2)
popper_js (>= 2.9.2, < 3)
sassc-rails (>= 2.0.0)
builder (3.2.4)
byebug (11.1.3)
Expand All @@ -89,7 +89,7 @@ GEM
nokogiri (>= 1.4.3)
erubi (1.10.0)
execjs (2.7.0)
ffi (1.14.2)
ffi (1.15.0)
globalid (0.4.2)
activesupport (>= 4.2.0)
i18n (1.8.10)
Expand Down Expand Up @@ -126,7 +126,7 @@ GEM
mini_portile2 (~> 2.5.0)
racc (~> 1.4)
pg (1.2.3)
popper_js (1.16.0)
popper_js (2.9.2)
public_suffix (4.0.6)
puma (5.3.1)
nio4r (~> 2.0)
Expand Down Expand Up @@ -229,7 +229,7 @@ PLATFORMS

DEPENDENCIES
bootsnap (>= 1.4.4)
bootstrap (~> 4.6.0)
bootstrap (~> 5.0.1)
byebug
capybara (>= 3.26)
diffy
Expand Down
Binary file removed app/assets/images/custom.png
Binary file not shown.
8 changes: 4 additions & 4 deletions app/assets/javascripts/password_controller.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
$(document).ready(function() {
'use strict';

var $bootstrap = $('#exampleInputPassword').next('.input-group-append');
var $simple_form = $('#user_password').next('.input-group-append');
var $bootstrap = $("#exampleInputPassword").next(".input-group-text");
var $simple_form = $("#user_password").next(".input-group-text");

var $pw_appends = $bootstrap.add($simple_form);

Expand All @@ -11,10 +11,10 @@ $(document).ready(function() {
$(this).toggleClass('active');
if ( $(this).hasClass('active') ) {
$(this).prev().prop("type", "text");
$(this).find('.input-group-text').html("🙈");
$(this).text("🙈");
} else {
$(this).prev().prop("type", "password");
$(this).find('.input-group-text').html("🙊");
$(this).text("🙊");
}
$(this).prev().focus();
});
Expand Down
10 changes: 5 additions & 5 deletions app/assets/javascripts/toggle_controller.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ $(document).ready(function() {
'use strict';

var $grid_target = $('[data-target="toggle.grid"]');
var $button = $('[data-toggle="button"]');
var $buttons = $('[data-toggle="buttons"]');
var $button = $('[data-bs-toggle="button"]');
var $buttons = $('[data-bs-toggle="buttons"]');

// init
if ( $grid_target.length >= 2 ) {
Expand All @@ -18,9 +18,9 @@ $(document).ready(function() {

// stack / split view
$buttons.click(function(event) {
event.preventDefault();
if ( $(event.target).hasClass("active") ) { return }
$grid_target.toggleClass("col-md-12");
if ( $(event.target).hasClass("btn") ) { return; }
var stack = $buttons.find(":checked").attr("id") === "stack";
$grid_target.toggleClass("col-md-12", stack);
});

// swap by press "s"
Expand Down
55 changes: 53 additions & 2 deletions app/assets/stylesheets/application.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,56 @@
$theme-colors: ( "bootstrap": #563d7c, "simpleform": #00617f );
@import "bootstrap";
/*
* Keep in sync with `assets/stylesheets/_bootstrap.scss` from
* `bootstrap-rubygem`.
*/

@import "bootstrap/functions";

$custom-colors: ( "bootstrap": #563d7c, "simpleform": #00617f );

@import "bootstrap/variables";
@import "bootstrap/mixins";

$theme-colors: map-merge($theme-colors, $custom-colors);

@import "bootstrap/utilities";

// Layout & components
@import "bootstrap/root";
@import "bootstrap/reboot";
@import "bootstrap/type";
@import "bootstrap/images";
@import "bootstrap/containers";
@import "bootstrap/grid";
@import "bootstrap/tables";
@import "bootstrap/forms";
@import "bootstrap/buttons";
@import "bootstrap/transitions";
@import "bootstrap/dropdown";
@import "bootstrap/button-group";
@import "bootstrap/nav";
@import "bootstrap/navbar";
@import "bootstrap/card";
@import "bootstrap/accordion";
@import "bootstrap/breadcrumb";
@import "bootstrap/pagination";
@import "bootstrap/badge";
@import "bootstrap/alert";
@import "bootstrap/progress";
@import "bootstrap/list-group";
@import "bootstrap/close";
@import "bootstrap/toasts";
@import "bootstrap/modal";
@import "bootstrap/tooltip";
@import "bootstrap/popover";
@import "bootstrap/carousel";
@import "bootstrap/spinners";
@import "bootstrap/offcanvas";

// Helpers
@import "bootstrap/helpers";

// Utilities
@import "bootstrap/utilities/api";

// App sections
@import "application/breadcrumb";
Expand Down
4 changes: 2 additions & 2 deletions app/assets/stylesheets/application/_breadcrumb.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
.app-breadcrumb {
[data-toggle] {
@include media-breakpoint-down(sm) {
[data-bs-toggle] {
@include media-breakpoint-down(md) {
& { display: none; }
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,27 +7,3 @@
}
}
}

// optional custom form spacing
.custom-control-inline {
.custom-control-label {
&.collection_check_boxes,
&.collection_radio_buttons {
margin-right: .265625rem;
}
}
}

// required custom form radio button fix
.form-group.radio_buttons {
> .custom-control {
@extend .custom-radio;
}
}

// required custom form check box fix
.form-group.check_boxes {
> .custom-control {
@extend .custom-checkbox;
}
}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
// In bootstrap 5 legend floats left and requires the following element
// to be cleared. In a radio button or checkbox group the element after
// the legend will be the automatically generated hidden input; the fix
// in https://github.com/twbs/bootstrap/pull/30345 applies to the hidden
// input and has no visual effect. Here we try to fix matters by
// applying the clear to the div wrapping the first following radio button
// or checkbox.
legend ~ div.form-check:first-of-type {
clear: left;
}
Original file line number Diff line number Diff line change
@@ -1,17 +1,8 @@
.custom-select,
.form-control {
.form-select {
&.date,
&.datetime,
&.time {
&:first-of-type { margin-left: 0 !important; }
&:last-of-type { margin-right: 0 !important; }
}
}

.custom-select {
&[multiple],
&:only-child {
margin-left: 0 !important;
margin-right: 0 !important;
}
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@import "form_abbr";
@import "form_button";
@import "form_collection_label";
@import "form_floating_labels";
@import "form_legend_clear";
@import "form_multi_select";
2 changes: 1 addition & 1 deletion app/controllers/examples/base_controller.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
class Examples::BaseController < ApplicationController
TYPES = [:vertical, :horizontal, :inline, :custom, :input_group, :floating_label]
TYPES = [:vertical, :horizontal, :inline, :input_group, :floating_label]

private

Expand Down
15 changes: 0 additions & 15 deletions app/controllers/examples/customs_controller.rb

This file was deleted.

10 changes: 6 additions & 4 deletions app/helpers/error_messages_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,13 @@ def error_messages_for(*objects)
messages = objects.compact.flat_map { |o| o.errors.full_messages }
unless messages.empty?
content_tag(:div, class: "alert alert-danger alert-form alert-dismissible") do
content_tag(:div, class: "media") do
icon_svg("alerts/error.svg", class: "d-flex mr-3 icon icon-3x") +
content_tag(:div, class: "media-body") do
content_tag(:div, class: "d-flex") do
content_tag(:div, class: "flex-shrink-0") do
icon_svg("alerts/error.svg", class: "icon icon-3x")
end +
content_tag(:div, class: "flex-grow-1 ms-3") do
list_items = messages.map { |msg| content_tag(:li, msg) }
content_tag(:a, "×", href: "#", class: "close", data: { dismiss: "alert" }) +
content_tag(:a, "×", href: "#", class: "close", data: { "bs-dismiss": "alert" }) +
content_tag(:h6, options[:template_header], class: "text-uppercase text-reset my-1") +
content_tag(:p, options[:template_body]) +
content_tag(:ul, list_items.join.html_safe, class: "mb-0")
Expand Down