Skip to content
Closed
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
1 change: 0 additions & 1 deletion app/assets/javascripts/rails_admin/rails_admin.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
//= require 'rails_admin/ra.filtering-multiselect'
//= require 'rails_admin/ra.filtering-select'
//= require 'rails_admin/ra.remote-form'
//= require 'rails_admin/jquery.pjax'
//= require 'jquery_nested_form'
//= require 'rails_admin/ra.nested-form-hooks'
//= require 'rails_admin/ra.i18n'
Expand Down
47 changes: 0 additions & 47 deletions app/assets/javascripts/rails_admin/ui.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,48 +3,6 @@
$("#list [name='bulk_ids[]']").prop("checked", $(this).is(":checked"));
});

$(document).on("click", ".pjax", function (event) {
if (event.which > 1 || event.metaKey || event.ctrlKey) {
return;
}

if ($.support.pjax) {
event.preventDefault();
$.pjax({
container: $(this).data("pjax-container") || "[data-pjax-container]",
url: $(this).data("href") || $(this).attr("href"),
timeout: 2000,
});
return;
}

if ($(this).data("href")) {
window.location = $(this).data("href");
}
});

$(document).on("submit", ".pjax-form", function (event) {
if ($.support.pjax) {
event.preventDefault();
$.pjax({
container: $(this).data("pjax-container") || "[data-pjax-container]",
url:
this.action +
(this.action.indexOf("?") !== -1 ? "&" : "?") +
$(this).serialize(),
timeout: 2000,
});
}
});

$(document)
.on("pjax:start", function () {
return $("#loading").show();
})
.on("pjax:end", function () {
return $("#loading").hide();
});

$(document).on("click", "[data-target]", function () {
if (!$(this).hasClass("disabled")) {
if ($(this).has("i.fa-chevron-down").length) {
Expand Down Expand Up @@ -99,11 +57,6 @@
document.dispatchEvent(event);
});

$(document).on("pjax:end", function () {
const event = new CustomEvent("rails_admin.dom_ready");
document.dispatchEvent(event);
});

document.addEventListener("rails_admin.dom_ready", function () {
$(".nav.nav-pills li.active").removeClass("active");
$(
Expand Down
2 changes: 1 addition & 1 deletion app/helpers/rails_admin/application_helper.rb
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ def menu_for(parent, abstract_model = nil, object = nil, only_icon = false)
else
'javascript:void(0)'
end
content_tag(:a, label, {href: href}.merge(action.pjax? ? {class: ['pjax']} : {}))
content_tag(:a, label, {href: href})
else
content_tag(:span, label)
end
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<ul class="nav navbar-nav navbar-right root_links">
<% actions(:root).select(&:show_in_navigation).each do |action| %>
<li class="<%= action.action_name %>_root_link">
<%= link_to wording_for(:menu, action), { action: action.action_name, controller: 'rails_admin/main' }, class: action.pjax? ? "pjax" : "" %>
<%= link_to wording_for(:menu, action), { action: action.action_name, controller: 'rails_admin/main' } %>
</li>
<% end %>
<% if main_app_root_path = (main_app.root_path rescue false) %>
Expand Down
7 changes: 2 additions & 5 deletions app/views/layouts/rails_admin/application.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,6 @@
</head>
<body class="rails_admin">
<div data-i18n-options="<%= I18n.t("admin.js").to_json %>" id="admin-js"></div>
<div class="label label-warning" id="loading" style="display:none; position:fixed; right:20px; bottom:20px; z-index:100000">
<%= t('admin.loading') %>
</div>
<nav class="navbar navbar-default navbar-fixed-top">
<%= render "layouts/rails_admin/navigation" %>
</nav>
Expand All @@ -17,8 +14,8 @@
<%= render "layouts/rails_admin/sidebar_navigation" %>
</div>
<div class="col-sm-9 col-sm-offset-3 col-md-10 col-md-offset-2">
<div class="content" data-pjax-container="<%= true %>">
<%= render template: 'layouts/rails_admin/pjax' %>
<div class="content">
<%= render template: 'layouts/rails_admin/content' %>
</div>
</div>
</div>
Expand Down
2 changes: 1 addition & 1 deletion app/views/rails_admin/main/history.html.erb
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
<% selected = (sort == property_name) %>
<% sort_direction = (sort_reverse ? "headerSortUp" : "headerSortDown" if selected) %>
<% sort_location = send(path_method, params.except("sort_reverse").merge(model_name: @abstract_model.to_param, sort: property_name).merge(selected && sort_reverse != "true" ? {sort_reverse: "true"} : {})) %>
<th class="header pjax <%= column[:css_class] %> <%= sort_direction if selected %>" data-href="<%= sort_location %>">
<th class="header <%= column[:css_class] %> <%= sort_direction if selected %>">
<%= column[:link_text] %>
</th>
<% end %>
Expand Down
1 change: 0 additions & 1 deletion config/locales/rails_admin.en.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ en:
too_many_objects: "Too many objects, use search box above"
no_objects: "No objects found"
clear: Clear
loading: "Loading..."
toggle_navigation: Toggle navigation
home:
name: "Home"
Expand Down
5 changes: 0 additions & 5 deletions lib/rails_admin/config/actions/base.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,11 +73,6 @@ class Base
false
end

# Render via pjax?
register_instance_option :pjax? do
true
end

# This block is evaluated in the context of the controller when action is called
# You can access:
# - @objects if you're on a model scope
Expand Down
4 changes: 0 additions & 4 deletions lib/rails_admin/config/actions/show_in_app.rb
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ class ShowInApp < RailsAdmin::Config::Actions::Base
register_instance_option :link_icon do
'fas fa-eye'
end

register_instance_option :pjax? do
false
end
end
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/rails_admin/config/fields/association.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def method_name
am = amc.abstract_model
wording = associated.send(amc.object_label_method)
can_see = !am.embedded? && (show_action = v.action(:show, am, associated))
can_see ? v.link_to(wording, v.url_for(action: show_action.action_name, model_name: am.to_param, id: associated.id), class: 'pjax') : ERB::Util.html_escape(wording)
can_see ? v.link_to(wording, v.url_for(action: show_action.action_name, model_name: am.to_param, id: associated.id)) : ERB::Util.html_escape(wording)
end.to_sentence.html_safe.presence || '-'
end

Expand Down
5 changes: 0 additions & 5 deletions lib/rails_admin/engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
require 'jquery-ui-rails'
require 'kaminari'
require 'nested_form'
require 'rack-pjax'
require 'rails'
require 'rails_admin'
require 'remotipart'
Expand All @@ -20,10 +19,6 @@ class Engine < Rails::Engine
]
end

initializer 'RailsAdmin setup middlewares' do |app|
app.config.middleware.use Rack::Pjax
end

initializer 'RailsAdmin reload config in development' do |app|
config.initializer_path = app.root.join('config/initializers/rails_admin.rb')

Expand Down
1 change: 0 additions & 1 deletion rails_admin.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ Gem::Specification.new do |spec|
spec.add_dependency 'jquery-ui-rails', ['>= 6.0', '< 7']
spec.add_dependency 'kaminari', '>= 0.14', '< 2.0'
spec.add_dependency 'nested_form', '~> 0.3'
spec.add_dependency 'rack-pjax', '>= 0.7'
spec.add_dependency 'rails', ['>= 6.0', '< 8']
spec.add_dependency 'remotipart', '~> 1.3'
spec.add_dependency 'sassc-rails', ['>= 1.3', '< 3']
Expand Down
Loading