-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Upgrade Bootstrap to 5.1.3 with migrating datetimepicker to Flatpickr #3455
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
Changes from all commits
a4e513d
15d8404
dbd01d6
242ada3
16e72b5
9776139
c2b155e
7911dbd
f75c853
4ea777a
e83801c
49fec4e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
@charset "UTF-8"; | ||
|
||
/*** Variables ***/ | ||
|
||
@import "rails_admin/custom/variables"; | ||
@import "rails_admin/styles/base/variables"; | ||
|
||
/*** Mixins ***/ | ||
|
||
@import "rails_admin/styles/base/mixins"; | ||
@import "rails_admin/custom/mixins"; | ||
|
||
/*** Bootstrap ***/ | ||
|
||
@import "rails_admin/bootstrap/bootstrap"; | ||
|
||
/*** Libraries ***/ | ||
|
||
@import "rails_admin/flatpickr"; | ||
@import "rails_admin/styles/filtering-select"; | ||
@import "rails_admin/styles/filtering-multiselect"; | ||
@import "rails_admin/styles/widgets"; | ||
|
||
/*** Font-awesome ***/ | ||
|
||
@import "rails_admin/font-awesome"; | ||
|
||
/*** RailsAdmin Theming ***/ | ||
|
||
@import "rails_admin/styles/base/theming"; | ||
@import "rails_admin/custom/theming"; |
This file was deleted.
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,7 +28,7 @@ def edit_user_link | |
content_tag(:span, _current_user.email), | ||
].compact.join.html_safe | ||
if (edit_action = RailsAdmin::Config::Actions.find(:edit, controller: controller, abstract_model: abstract_model, object: _current_user)).try(:authorized?) | ||
link_to content, rails_admin.url_for(action: edit_action.action_name, model_name: abstract_model.to_param, id: _current_user.id, controller: 'rails_admin/main') | ||
link_to content, rails_admin.url_for(action: edit_action.action_name, model_name: abstract_model.to_param, id: _current_user.id, controller: 'rails_admin/main'), class: 'nav-link' | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Most of these kind of changes are to keep up with the change in Bootstrap 5, like |
||
else | ||
content_tag :span, content | ||
end | ||
|
@@ -87,7 +87,7 @@ def root_navigation | |
url = rails_admin.url_for(action: node.action_name, controller: 'rails_admin/main') | ||
nav_icon = node.link_icon ? %(<i class="#{node.link_icon}"></i>).html_safe : '' | ||
content_tag :li do | ||
link_to nav_icon + " " + wording_for(:menu, node), url, class: "pjax" | ||
link_to nav_icon + " " + wording_for(:menu, node), url, class: "nav-link pjax" | ||
end | ||
end.join.html_safe | ||
label ||= t('admin.misc.root_navigation') | ||
|
@@ -98,7 +98,7 @@ def root_navigation | |
|
||
def static_navigation | ||
li_stack = RailsAdmin::Config.navigation_static_links.collect do |title, url| | ||
content_tag(:li, link_to(title.to_s, url, target: '_blank', rel: 'noopener noreferrer')) | ||
content_tag(:li, link_to(title.to_s, url, target: '_blank', rel: 'noopener noreferrer', class: 'nav-link')) | ||
end.join | ||
|
||
label = RailsAdmin::Config.navigation_static_label || t('admin.misc.navigation_static_label') | ||
|
@@ -114,7 +114,7 @@ def navigation(parent_groups, nodes, level = 0) | |
level_class = " nav-level-#{level}" if level > 0 | ||
nav_icon = node.navigation_icon ? %(<i class="#{node.navigation_icon}"></i>).html_safe : '' | ||
li = content_tag :li, data: {model: model_param} do | ||
link_to nav_icon + node.label_plural, url, class: "pjax#{level_class}" | ||
link_to nav_icon + node.label_plural, url, class: "nav-link pjax#{level_class}" | ||
end | ||
child_nodes = parent_groups[abstract_model.model_name] | ||
child_nodes ? li + navigation(parent_groups, child_nodes, level + 1) : li | ||
|
@@ -130,7 +130,7 @@ def breadcrumb(action = @action, _acc = []) | |
parent_actions.collect do |a| | ||
am = a.send(:eval, 'bindings[:abstract_model]') | ||
o = a.send(:eval, 'bindings[:object]') | ||
content_tag(:li, class: current_action?(a, am, o) && 'active') do | ||
content_tag(:li, class: ['breadcrumb-item', current_action?(a, am, o) && 'active']) do | ||
if current_action?(a, am, o) | ||
wording_for(:breadcrumb, a, am, o) | ||
elsif a.http_methods.include?(:get) | ||
|
@@ -151,19 +151,18 @@ def menu_for(parent, abstract_model = nil, object = nil, only_icon = false) | |
actions = actions(parent, abstract_model, object).select { |a| a.http_methods.include?(:get) && a.show_in_menu } | ||
actions.collect do |action| | ||
wording = wording_for(:menu, action) | ||
li_class = ['icon', "#{action.key}_#{parent}_link"]. | ||
concat(current_action?(action) ? ['active'] : []). | ||
li_class = ['nav-item', 'icon', "#{action.key}_#{parent}_link"]. | ||
concat(action.enabled? ? [] : ['disabled']) | ||
content_tag(:li, {class: li_class}.merge(only_icon ? {title: wording, rel: 'tooltip'} : {})) do | ||
label = content_tag(:i, '', {class: action.link_icon}) + content_tag(:span, wording, (only_icon ? {style: 'display:none'} : {})) | ||
label = content_tag(:i, '', {class: action.link_icon}) + ' ' + content_tag(:span, wording, (only_icon ? {style: 'display:none'} : {})) | ||
if action.enabled? || !only_icon | ||
href = | ||
if action.enabled? | ||
rails_admin.url_for(action: action.action_name, controller: 'rails_admin/main', model_name: abstract_model.try(:to_param), id: (object.try(:persisted?) && object.try(:id) || nil)) | ||
else | ||
'javascript:void(0)' | ||
end | ||
content_tag(:a, label, {href: href, target: action.link_target}.merge(action.pjax? ? {class: ['pjax']} : {})) | ||
content_tag(:a, label, {href: href, target: action.link_target, class: ['nav-link', action.pjax? && 'pjax', current_action?(action) && 'active', !action.enabled? && 'disabled'].compact}) | ||
else | ||
content_tag(:span, label) | ||
end | ||
|
@@ -175,12 +174,12 @@ def bulk_menu(abstract_model = @abstract_model) | |
actions = actions(:bulkable, abstract_model) | ||
return '' if actions.empty? | ||
|
||
content_tag :li, class: 'dropdown', style: 'float:right' do | ||
content_tag(:a, class: 'dropdown-toggle', data: {toggle: 'dropdown'}, href: '#') { t('admin.misc.bulk_menu_title').html_safe + ' ' + '<b class="caret"></b>'.html_safe } + | ||
content_tag :li, class: 'nav-item dropdown dropdown-menu-end' do | ||
content_tag(:a, class: 'nav-link dropdown-toggle', data: {'bs-toggle': 'dropdown'}, href: '#') { t('admin.misc.bulk_menu_title').html_safe + ' ' + '<b class="caret"></b>'.html_safe } + | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also |
||
content_tag(:ul, class: 'dropdown-menu', style: 'left:auto; right:0;') do | ||
actions.collect do |action| | ||
content_tag :li do | ||
link_to wording_for(:bulk_link, action, abstract_model), '#', class: 'bulk-link', data: {action: action.action_name} | ||
link_to wording_for(:bulk_link, action, abstract_model), '#', class: 'dropdown-item bulk-link', data: {action: action.action_name} | ||
end | ||
end.join.html_safe | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -43,9 +43,9 @@ def field_wrapper_for(field, nested_in) | |
# do not show nested field if the target is the origin | ||
return if nested_field_association?(field, nested_in) | ||
|
||
@template.content_tag(:div, class: "form-group control-group #{field.type_css_class} #{field.css_class} #{'error' if field.errors.present?}", id: "#{dom_id(field)}_field") do | ||
@template.content_tag(:div, class: "control-group row mb-3 #{field.type_css_class} #{field.css_class} #{'error' if field.errors.present?}", id: "#{dom_id(field)}_field") do | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
if field.label | ||
label(field.method_name, field.label, class: 'col-sm-2 control-label') + | ||
label(field.method_name, field.label, class: 'col-sm-2 col-form-label text-md-end') + | ||
(field.nested_form ? field_for(field) : input_for(field)) | ||
else | ||
field.nested_form ? field_for(field) : input_for(field) | ||
|
@@ -68,7 +68,7 @@ def errors_for(field) | |
end | ||
|
||
def help_for(field) | ||
field.help.present? ? @template.content_tag(:span, field.help, class: 'help-block') : ''.html_safe | ||
field.help.present? ? @template.content_tag(:div, field.help, class: 'form-text') : ''.html_safe | ||
end | ||
|
||
def field_for(field) | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
<li class="disabled"> | ||
<a href="#"> | ||
<li class="page-item disabled"> | ||
<a href="#" class="page-link"> | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Pagination structure was also updated in Bootstrap 5. |
||
<%= raw(t 'admin.pagination.truncate') %> | ||
</a> | ||
</li> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<% if current_page.last? %> | ||
<li class="next disabled"> | ||
<%= link_to raw(t 'admin.pagination.next'), '#' %> | ||
<li class="page-item next disabled"> | ||
<%= link_to raw(t 'admin.pagination.next'), '#', class: 'page-link' %> | ||
</li> | ||
<% else %> | ||
<li class="next"> | ||
<%= link_to raw(t 'admin.pagination.next'), url, class: (remote ? 'pjax' : '') %> | ||
<li class="page-item next"> | ||
<%= link_to raw(t 'admin.pagination.next'), url, class: ['page-link', ('pjax' if remote)].compact %> | ||
</li> | ||
<% end %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<% if page.current? %> | ||
<li class="active"> | ||
<%= link_to page, url, class: (remote ? 'pjax' : '') %> | ||
<li class="page-item active"> | ||
<%= link_to page, url, class: ['page-link', ('pjax' if remote)].compact %> | ||
</li> | ||
<% else %> | ||
<li> | ||
<%= link_to page, url, class: (remote ? 'pjax' : '') %> | ||
<li class="page-item"> | ||
<%= link_to page, url, class: ['page-link', ('pjax' if remote)].compact %> | ||
</li> | ||
<% end %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,13 +1,15 @@ | ||
<%= paginator.render do %> | ||
<ul class="pagination"> | ||
<%= prev_page_tag %> | ||
<% each_page do |page| %> | ||
<% if page.left_outer? or page.right_outer? or page.inside_window? %> | ||
<%= page_tag page %> | ||
<% elsif !page.was_truncated? %> | ||
<%= gap_tag %> | ||
<nav aria-label="Page navigation"> | ||
<ul class="pagination"> | ||
<%= prev_page_tag %> | ||
<% each_page do |page| %> | ||
<% if page.left_outer? or page.right_outer? or page.inside_window? %> | ||
<%= page_tag page %> | ||
<% elsif !page.was_truncated? %> | ||
<%= gap_tag %> | ||
<% end %> | ||
<% end %> | ||
<% end %> | ||
<%= next_page_tag %> | ||
</ul> | ||
<%= next_page_tag %> | ||
</ul> | ||
</nav> | ||
<% end %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<% if current_page.first? %> | ||
<li class="prev disabled"> | ||
<%= link_to raw(t 'admin.pagination.previous'), '#' %> | ||
<li class="page-item prev disabled"> | ||
<%= link_to raw(t 'admin.pagination.previous'), '#', class: 'page-link' %> | ||
</li> | ||
<% else %> | ||
<li class="prev"> | ||
<%= link_to raw(t 'admin.pagination.previous'), url, class: (remote ? 'pjax' : '') %> | ||
<li class="page-item prev"> | ||
<%= link_to raw(t 'admin.pagination.previous'), url, class: ['page-link', ('pjax' if remote)].compact %> | ||
</li> | ||
<% end %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<% if current_page.last? %> | ||
<li class="next disabled"> | ||
<%= link_to raw(t 'admin.pagination.next'), '#' %> | ||
<li class="page-item next disabled"> | ||
<%= link_to raw(t 'admin.pagination.next'), '#', class: 'page-link' %> | ||
</li> | ||
<% else %> | ||
<li class="next"> | ||
<%= link_to raw(t 'admin.pagination.next'), url, class: (remote ? 'pjax' : '') %> | ||
<li class="page-item next"> | ||
<%= link_to raw(t 'admin.pagination.next'), url, class: ['page-link', ('pjax' if remote)].compact %> | ||
</li> | ||
<% end %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,8 @@ | ||
<%= paginator.render do %> | ||
<ul class="pagination"> | ||
<%= prev_page_tag if !current_page.first? %> | ||
<%= next_page_tag %> | ||
</ul> | ||
<nav aria-label="Page navigation"> | ||
<ul class="pagination"> | ||
<%= prev_page_tag if !current_page.first? %> | ||
<%= next_page_tag %> | ||
</ul> | ||
</nav> | ||
<% end %> |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,9 @@ | ||
<% if current_page.first? %> | ||
<li class="prev disabled"> | ||
<%= link_to raw(t 'admin.pagination.previous'), '#' %> | ||
<li class="page-item prev disabled"> | ||
<%= link_to raw(t 'admin.pagination.previous'), '#', class: 'page-link' %> | ||
</li> | ||
<% else %> | ||
<li class="prev"> | ||
<%= link_to raw(t 'admin.pagination.previous'), url, class: (remote ? 'pjax' : '') %> | ||
<li class="page-item prev"> | ||
<%= link_to raw(t 'admin.pagination.previous'), url, class: ['page-link', ('pjax' if remote)].compact %> | ||
</li> | ||
<% end %> |
Uh oh!
There was an error while loading. Please reload this page.