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

Migrate admin site to tabler #313

Draft
wants to merge 26 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b99e99c
Replace admin-lte packages with tabler
mickzijdel Jun 20, 2024
5a2af17
Fix displaying the styling on the dashboard widget
mickzijdel Jun 20, 2024
bfc6cf6
Fix tabler import. It imports bootstrap itself, so duplicating this w…
mickzijdel Jun 21, 2024
b0707cf
Add autosize to the md-editor fields
mickzijdel Jun 21, 2024
b7123ef
Update md-editor to use bootstrap 5 style tab panes
mickzijdel Jun 21, 2024
01517e0
Import popper bootstrap 5 style
mickzijdel Jun 21, 2024
829080c
Add spacing to form fields.
mickzijdel Jun 21, 2024
1e5a47c
Create horizontal_boolean_search wrapper for booleans in the search f…
mickzijdel Jun 21, 2024
bf580db
Import autosize package
mickzijdel Jun 21, 2024
d3b0fae
Popover and Dropdown bootstrap test bits
mickzijdel Jun 21, 2024
dfaa388
Use indicators from tabler for sort_link
mickzijdel Jun 21, 2024
86c9e6a
Apply tabler markup to breadcrumbs
mickzijdel Jun 21, 2024
154322a
Fix collapse button on dashboard widgets
mickzijdel Jun 21, 2024
56a263b
Remove redundant * in require fields from simple_form as it is added …
mickzijdel Jun 21, 2024
e706fec
Fix content justification in the header
mickzijdel Jun 21, 2024
792eaf4
Display amount of items in the table card header of the index pages, …
mickzijdel Jun 21, 2024
0c983bf
Display amount of items in the table card header of the index pages, …
mickzijdel Jun 21, 2024
e75cf08
Fix alignment on the admin dashboard page by removing redundant conta…
mickzijdel Jun 21, 2024
8b92317
Merge branch 'migrate-admin-site-to-tabler' of https://github.com/mic…
mickzijdel Jun 21, 2024
35414fe
Rename alerts_div to alerts_script and move it to head
mickzijdel Jun 21, 2024
1779922
Remove the wrapping <p> tag of rendered markdown. Fixes #262
mickzijdel Jun 21, 2024
43f58ef
Remove headers from sections using a collapse
mickzijdel Jun 22, 2024
a2aaebe
Fix display_entries text for paginator as it still included the entry…
mickzijdel Jun 22, 2024
e1a4298
Use a small edit button for index tables
mickzijdel Jun 22, 2024
1b39afc
Remove another header above a collapse
mickzijdel Jun 22, 2024
b6c2ac5
Replace text-justify with text-start
mickzijdel Jun 23, 2024
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
53,015 changes: 0 additions & 53,015 deletions app/assets/stylesheets/admin/adminlte.css

This file was deleted.

4 changes: 2 additions & 2 deletions app/assets/stylesheets/admin/customisations.scss
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
.btn-tool {
padding: 1rem .5rem !important;
.col-min-width-3 {
min-width: 25%;
}

.preloader{
Expand Down
2 changes: 0 additions & 2 deletions app/assets/stylesheets/application.bootstrap.scss

This file was deleted.

2 changes: 0 additions & 2 deletions app/assets/stylesheets/bootstrap5_customisations.scss
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,3 @@ $danger: #212529;

$link-color: $red;
$headings-color: $red;

@import "bootstrap/scss/bootstrap";
2 changes: 1 addition & 1 deletion app/assets/stylesheets/entrypoints/admin.scss
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@

@import '../admin/customisations';

@import '../admin/adminlte';
@import "@tabler/core/dist/css/tabler";
1 change: 1 addition & 0 deletions app/assets/stylesheets/entrypoints/application.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
// NOTE THAT THINGS PLACED HERE DO NOT WORK FOR THE BACKEND
// This file has to be at the top because it also loads Bootstrap 5.
@import '../bootstrap5_customisations';
@import "bootstrap/scss/bootstrap";

@import '../form_additions';
@import '../shared_additions';
Expand Down
18 changes: 18 additions & 0 deletions app/helpers/builders/tabler_breadcrumbs_builder.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Formats breadcrumbs according to the tabler specification: https://tabler.io/docs/components/breadcrumb
class Builders::TablerBreadcrumbsBuilder < BreadcrumbsOnRails::Breadcrumbs::Builder
def render
content = @elements.collect { |element| render_element(element) }.join("\n")

return "<ol class=\"breadcrumb\" aria-label=\"breadcrumbs\">\n#{content}\n</ol>".html_safe
end

def render_element(element)
if element.path.nil?
content = compute_name(element)
else
content = @context.link_to_unless_current(compute_name(element), compute_path(element), element.options)
end

return @context.content_tag(:li, content, class: "breadcrumb-item #{'active' if @context.current_page?(compute_path(element))}", 'aria-current': 'page')
end
end
7 changes: 7 additions & 0 deletions app/helpers/form_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,13 @@ def horizontal_form_options
}
end

# Search forms are horizontal, but have a special boolean search field that takes up less space.
def search_form_options
options = horizontal_form_options
options[:wrapper_mappings][:boolean] = :horizontal_boolean_search
return options
end

def simple_horizontal_form_for(object, *args, &block)
options = args.extract_options!
new_options = horizontal_form_options
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/md_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ module MdHelper
def render_markdown(md)
return '' if md.nil?

return Kramdown::Document.new(md, input: 'BKramdown').to_html.html_safe
return Kramdown::Document.new(md, input: 'BKramdown').to_html.gsub(/(^[ ]*<p>[ ]*)|([ ]*<\/p>[ ]*$)/, '').html_safe
end

def render_plain(md)
Expand Down
13 changes: 3 additions & 10 deletions app/javascript/admin.js
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
import 'popper.js'

// The customisations are just two lines: https://www.diffchecker.com/LT8Mt2Hd/
// Line 1855: $preloader.css('height', 0); -> $preloader.css('opacity', 0);
// Between line 1857 and 1858, insert: $preloader.hide(); // Also hide the preloader itself, and not just the children.
import './src/vendor/adminlte.customised.js'

import './src/admin/cookies.js'

// This is a Bootstrap 4 install, which is still needed for adminlte. Once you upgrade to Bootstrap 5, remove it, and just load Bootstrap 5 in shared.
import './src/vendor/bootstrap.bundle.min.js'

import './src/admin/user_modal_script.js'

import "./src/admin/techie_tree.js"

import 'moment'

// Loads all Bootstrap javascripts automatically.
import 'autosize'
Loading