Nicolae Claudius
12 years ago
14 changed files with 28 additions and 52 deletions
@ -1,24 +1,12 @@ |
|||||||
$ -> |
$ -> |
||||||
$(document).popover(selector: '[rel=popover]') |
$(document).popover(selector: '[rel=popover]') |
||||||
$(document).tooltip(selector: '[rel=tooltip]') |
$(document).tooltip(selector: '[rel=tooltip]') |
||||||
|
|
||||||
pjaxContainer = '[data-pjax-container]' |
# fix for Turbolinks with Bootstrap |
||||||
$pjaxContainer = $(pjaxContainer) |
# https://github.com/rails/turbolinks/issues/16 |
||||||
$pjaxContainerParent = $(pjaxContainer).parent() |
proto = $.fn.dropdown.Constructor.prototype |
||||||
$body = $('body') |
toggle = '[data-toggle=dropdown]' |
||||||
fixLayout = -> |
$(document) |
||||||
if $pjaxContainer.find('.container').length > 0 |
.on('click.dropdown touchstart.dropdown.data-api', '.dropdown form', (e) -> e.stopPropagation()) |
||||||
$pjaxContainerParent.removeClass 'container' |
.on('click.dropdown.data-api touchstart.dropdown.data-api', toggle, proto.toggle) |
||||||
else |
.on('keydown.dropdown.data-api touchstart.dropdown.data-api', toggle + ', [role=menu]', proto.keydown) |
||||||
$pjaxContainerParent.addClass 'container' |
|
||||||
if $body.has('.page-home-section').length > 0 |
|
||||||
$body.addClass('with-home-section') |
|
||||||
else |
|
||||||
$body.removeClass('with-home-section') |
|
||||||
fixLayout() |
|
||||||
|
|
||||||
$('.pjax-nav a:not([data-remote]):not([data-behavior]):not([data-skip-pjax])').pjax(pjaxContainer) |
|
||||||
$pjaxContainer.on 'pjax:success', (event, data, status, xhr, options) -> |
|
||||||
$('.pjax-nav').find('li.active').removeClass 'active' |
|
||||||
$(".pjax-nav a[href=\"#{window.location.pathname}\"]").parents('li').addClass 'active' |
|
||||||
fixLayout() |
|
||||||
|
Loading…
Reference in new issue