Optimisation: pages are displayed without layout, when called from a xhr request.
Should be useful to speed up paginations
This commit is contained in:
parent
69dcb84780
commit
a9c5d6bc55
@ -6,7 +6,7 @@ $(document).on 'turbolinks:load', ->
|
||||
if $('#event_start_time').val() >= $('#event_end_time').val()
|
||||
$('#event_start_time').val($('#event_end_time').val())
|
||||
|
||||
# Quick mechanism so that the ice cube rule only appears when useful
|
||||
# Quick mechanism so that the ice cube rule only appears when useful
|
||||
$('#event_repeat').each ->
|
||||
if $(this).val() == '0'
|
||||
$('.field.rule').hide()
|
||||
|
@ -5,6 +5,8 @@ class ApplicationController < ActionController::Base
|
||||
# For APIs, you may want to use :null_session instead.
|
||||
protect_from_forgery prepend: true, with: :exception
|
||||
|
||||
layout :handle_xhr_layout
|
||||
|
||||
private
|
||||
|
||||
def set_locale
|
||||
@ -26,4 +28,9 @@ class ApplicationController < ActionController::Base
|
||||
def set_mailer_host
|
||||
ActionMailer::Base.default_url_options[:host] = request.host_with_port
|
||||
end
|
||||
|
||||
# If the request is an xhr, we don't render any layout
|
||||
def handle_xhr_layout
|
||||
request.xhr? ? false : 'application'
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user