Add aspectLis to aspectNavigation widget
This commit is contained in:
parent
04786bc43e
commit
37c67c23cf
1 changed files with 9 additions and 11 deletions
|
|
@ -11,6 +11,7 @@
|
||||||
$.extend(self, {
|
$.extend(self, {
|
||||||
aspectNavigation: aspectNavigation,
|
aspectNavigation: aspectNavigation,
|
||||||
aspectSelectors: aspectNavigation.find("a.aspect_selector[data-guid]"),
|
aspectSelectors: aspectNavigation.find("a.aspect_selector[data-guid]"),
|
||||||
|
aspectLis: aspectNavigation.find("li[data-aspect_id]"),
|
||||||
toggleSelector: aspectNavigation.find("a.toggle_selector")
|
toggleSelector: aspectNavigation.find("a.toggle_selector")
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
@ -43,21 +44,18 @@
|
||||||
this.toggleAll = function(evt) {
|
this.toggleAll = function(evt) {
|
||||||
evt.preventDefault();
|
evt.preventDefault();
|
||||||
|
|
||||||
var aspectLis = self.aspectSelectors.parent();
|
if (self.aspectLis.not(".active").length === 0) {
|
||||||
|
self.aspectLis.removeClass("active");
|
||||||
if (aspectLis.not(".active").length === 0) {
|
|
||||||
aspectLis.removeClass("active");
|
|
||||||
self.abortAjax();
|
self.abortAjax();
|
||||||
} else {
|
} else {
|
||||||
aspectLis.addClass("active");
|
self.aspectLis.addClass("active");
|
||||||
self.performAjax();
|
self.performAjax();
|
||||||
}
|
}
|
||||||
self.calculateToggleText();
|
self.calculateToggleText();
|
||||||
};
|
};
|
||||||
|
|
||||||
this.calculateToggleText = function() {
|
this.calculateToggleText = function() {
|
||||||
var aspectLis = self.aspectSelectors.parent();
|
if (self.aspectLis.not(".active").length === 0) {
|
||||||
if (aspectLis.not(".active").length === 0) {
|
|
||||||
self.toggleSelector.text(Diaspora.I18n.t('aspect_navigation.deselect_all'));
|
self.toggleSelector.text(Diaspora.I18n.t('aspect_navigation.deselect_all'));
|
||||||
} else {
|
} else {
|
||||||
self.toggleSelector.text(Diaspora.I18n.t('aspect_navigation.select_all'));
|
self.toggleSelector.text(Diaspora.I18n.t('aspect_navigation.select_all'));
|
||||||
|
|
@ -71,10 +69,10 @@
|
||||||
baseURL = baseURL.replace('#','');
|
baseURL = baseURL.replace('#','');
|
||||||
baseURL += '?';
|
baseURL += '?';
|
||||||
|
|
||||||
self.aspectSelectors.each(function() {
|
self.aspectLis.each(function() {
|
||||||
var aspectSelector = $(this);
|
var aspectLi = $(this);
|
||||||
if(aspectSelector.parent().hasClass("active")) {
|
if (aspectLi.hasClass("active")) {
|
||||||
baseURL += "a_ids[]=" + aspectSelector.data("guid") + "&";
|
baseURL += "a_ids[]=" + aspectLi.data("aspect_id") + "&";
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue