Skip to content
Extraits de code Groupes Projets
Valider f02c13ee rédigé par danielvincent's avatar danielvincent
Parcourir les fichiers

filters are now working in ajax. inf. scroll and publisher pending ajax.

parent c64865d3
Aucune branche associée trouvée
Aucune étiquette associée trouvée
Aucune requête de fusion associée trouvée
$('#main_stream').html("<%= escape_javascript(render('shared/stream', :posts => @post_hashes)) %>");
......@@ -44,7 +44,7 @@
#aspect_nav
%ul
%li{:class => ("selected" if @aspect == :all)}
= link_to t('_home'), root_path
= link_to t('_home'), root_path, :class => 'home_selector'
- for aspect in @all_aspects
%li{:data=>{:guid=>aspect.id}, :class => ("selected" if current_aspect?(aspect))}
......
......@@ -17,13 +17,18 @@ $(function(){
});
$("#aspect_nav a.aspect_selector").click(function(e){
e.preventDefault();
// loading animation
$("#main_stream").fadeTo(100, 0.4);
// filtering //////////////////////
var $this = $(this),
listElement = $this.parent(),
guid = listElement.attr('data-guid'),
baseURL = location.href.split("?")[0];
baseURL = location.href.split("?")[0],
homeListElement = $("#aspect_nav a.home_selector").parent();
if( listElement.hasClass('selected') ){
// remove filter
......@@ -31,12 +36,20 @@ $(function(){
if( idx != -1 ){
selectedGUIDS.splice(idx,1);
}
listElement.removeClass('selected');
if(selectedGUIDS.length == 0){
homeListElement.addClass('selected');
}
} else {
// append filter
if(selectedGUIDS.indexOf( guid == 1)){
selectedGUIDS.push( guid );
}
listElement.addClass('selected');
homeListElement.removeClass('selected');
}
// generate new url
......@@ -45,7 +58,17 @@ $(function(){
baseURL += 'a_ids[]='+ selectedGUIDS[i] +'&';
}
baseURL = baseURL.slice(0,baseURL.length-1);
///////////////////////////////////
//window.location = baseURL;
$.ajax({
url : baseURL,
dataType : 'script',
success : function(data){
$("#main_stream").fadeTo(100, 1);
}
});
window.location = baseURL;
});
});
0% Chargement en cours ou .
You are about to add 0 people to the discussion. Proceed with caution.
Terminez d'abord l'édition de ce message.
Veuillez vous inscrire ou vous pour commenter