Fixes popup loader appearing for "other" ajax requests

This commit is contained in:
Samuel Georges 2015-01-29 20:04:47 +11:00
parent b13eb26b52
commit 37a0a8290e
3 changed files with 18 additions and 11 deletions

View File

@ -379,8 +379,7 @@ $link.text(processedTitle).attr('title',title)
$pane.html(content)
this.initTab($tab)
this.updateClasses()}
Tab.prototype.generateTitleText=function(title,tabIndex)
{var newTitle=title
Tab.prototype.generateTitleText=function(title,tabIndex){var newTitle=title
if(this.options.titleAsFileNames)
newTitle=title.replace(/^.*[\\\/]/,'')
if(this.options.maxTitleSymbols&&newTitle.length>this.options.maxTitleSymbols)
@ -696,7 +695,10 @@ $.fn.popup.Constructor=Popup
$.fn.popup.noConflict=function(){$.fn.popup=old
return this}
$(document).on('click.oc.popup','[data-control="popup"]',function(){$(this).popup()
return false});$(document).on('ajaxPromise','[data-popup-load-indicator]',function(){$(this).closest('.control-popup').removeClass('in').popup('setLoading',true)}).on('ajaxFail','[data-popup-load-indicator]',function(){$(this).closest('.control-popup').addClass('in').popup('setLoading',false)}).on('ajaxDone','[data-popup-load-indicator]',function(){$(this).closest('.control-popup').popup('hideLoading')})}(window.jQuery);+function($){"use strict";var GoalMeter=function(element,options){var
return false});$(document).on('ajaxPromise','[data-popup-load-indicator]',function(event,context){if($(this).data('request')!=context.handler)return
$(this).closest('.control-popup').removeClass('in').popup('setLoading',true)}).on('ajaxFail','[data-popup-load-indicator]',function(event,context){if($(this).data('request')!=context.handler)return
$(this).closest('.control-popup').addClass('in').popup('setLoading',false)}).on('ajaxDone','[data-popup-load-indicator]',function(event,context){if($(this).data('request')!=context.handler)return
$(this).closest('.control-popup').popup('hideLoading')})}(window.jQuery);+function($){"use strict";var GoalMeter=function(element,options){var
$el=this.$el=$(element),self=this;this.options=options||{};this.$indicatorBar=$('<span/>').text(this.options.value+'%')
this.$indicatorOuter=$('<span/>').addClass('goal-meter-indicator').append(this.$indicatorBar)
$('p',this.$el).first().before(this.$indicatorOuter)

View File

@ -309,14 +309,20 @@
return false
});
/*
* Only use the popup loading indicator if the handlers are an exact match.
*/
$(document)
.on('ajaxPromise', '[data-popup-load-indicator]', function() {
.on('ajaxPromise', '[data-popup-load-indicator]', function(event, context) {
if ($(this).data('request') != context.handler) return
$(this).closest('.control-popup').removeClass('in').popup('setLoading', true)
})
.on('ajaxFail', '[data-popup-load-indicator]', function() {
.on('ajaxFail', '[data-popup-load-indicator]', function(event, context) {
if ($(this).data('request') != context.handler) return
$(this).closest('.control-popup').addClass('in').popup('setLoading', false)
})
.on('ajaxDone', '[data-popup-load-indicator]', function() {
.on('ajaxDone', '[data-popup-load-indicator]', function(event, context) {
if ($(this).data('request') != context.handler) return
$(this).closest('.control-popup').popup('hideLoading')
})

View File

@ -1,5 +1,5 @@
/*
* Tab control.
* Tab control.
*
* This plugin is a wrapper for the Twitter Bootstrap Tab component. It provides the following features:
* - Adding tabs
@ -55,7 +55,7 @@
* preventDefault() method to cancel the action.
* - afterAllClosed.oc.tab - triggered after all tabs have been closed
*
* Dependences:
* Dependences:
* - DragScroll (october.dragscroll.js)
* - Toolbar (october.toolbar.js)
* - Touchwipe (jquery.touchwipe.min.js)
@ -208,8 +208,7 @@
this.updateClasses()
}
Tab.prototype.generateTitleText = function(title, tabIndex)
{
Tab.prototype.generateTitleText = function(title, tabIndex) {
var newTitle = title
if (this.options.titleAsFileNames)
newTitle = title.replace(/^.*[\\\/]/, '')
@ -225,7 +224,7 @@
if (tabIndex == -1)
return
var
var
$tab = $('> li', this.$tabsContainer).eq(tabIndex),
$pane = $('> div', this.$pagesContainer).eq(tabIndex),
isActive = $tab.hasClass('active'),