From b22b13d73fc4dc8d75a0af9cd8568b336172e997 Mon Sep 17 00:00:00 2001 From: danielgrippi <daniel@joindiaspora.com> Date: Thu, 31 Mar 2011 01:30:02 -0700 Subject: [PATCH] Revert "popstate now in aspect-filters. back button now actually works on aspect/index." This reverts commit 326155af54525d23bd817dcea5a9e6ebb6e45ed7. --- app/views/aspects/index.js.erb | 22 -------------------- features/saved_state.feature | 2 -- public/javascripts/aspect-filters.js | 31 ++++++++++------------------ 3 files changed, 11 insertions(+), 44 deletions(-) diff --git a/app/views/aspects/index.js.erb b/app/views/aspects/index.js.erb index a0fd82732f..8e1bf9dd60 100644 --- a/app/views/aspects/index.js.erb +++ b/app/views/aspects/index.js.erb @@ -2,28 +2,6 @@ $('#aspect_stream_container').html("<%= escape_javascript(render('aspects/aspect $('#aspect_listings').html("<%= escape_javascript(render('aspects/aspect_listings', :aspects => @aspects)) %>"); $('a[rel*=facebox]').facebox(); - -var aspectIds = <%= @aspect_ids.to_json %>, - selectors = $("li", "#aspect_nav"); - -if( selectors.length-2 != aspectIds.length ) { - $.each( selectors, function(){ - var element = $(this); - - if( $.inArray( parseInt(element.attr('data-guid')), aspectIds) != -1 ){ - element.addClass('selected'); - } else { - element.removeClass('selected'); - } - }); -} else { - $.each( selectors, function(){ - $(this).removeClass('selected'); - }); - - selectors.first().addClass('selected'); -} - $(document).ready(function() { $('#main_stream').infinitescroll({ navSelector : "#main_stream + div.pagination", diff --git a/features/saved_state.feature b/features/saved_state.feature index ffc1e2b2cc..d327e57073 100644 --- a/features/saved_state.feature +++ b/features/saved_state.feature @@ -12,9 +12,7 @@ Feature: saved state And I go to the aspects page When I follow "Open 1" - And I wait for the ajax to finish And I follow "Open 2" - And I wait for the ajax to finish Then aspect "Open 1" should be selected And aspect "Open 2" should be selected But aspect "Closed 1" should not be selected diff --git a/public/javascripts/aspect-filters.js b/public/javascripts/aspect-filters.js index 2c1ff1388d..89b74a9cb4 100644 --- a/public/javascripts/aspect-filters.js +++ b/public/javascripts/aspect-filters.js @@ -17,11 +17,6 @@ $(document).ready(function(){ } }); - // popstate - $(window).bind("popstate", function(){ - $.getScript(location.href); - return false; - }); $("a.hard_aspect_link").live("click", function(e){ var link = $(this); @@ -93,23 +88,19 @@ $(document).ready(function(){ function generateURL(){ var baseURL = location.href.split("?")[0]; - if(selectedGUIDS.length != $('li', '#aspect_nav').length-2) { - // generate new url - baseURL = baseURL.replace('#',''); - baseURL += '?'; - for(i=0; i < selectedGUIDS.length; i++){ - baseURL += 'a_ids[]='+ selectedGUIDS[i] +'&'; - } + // generate new url + baseURL = baseURL.replace('#',''); + baseURL += '?'; + for(i=0; i < selectedGUIDS.length; i++){ + baseURL += 'a_ids[]='+ selectedGUIDS[i] +'&'; + } - if(!$("#publisher").hasClass("closed")) { - // open publisher - baseURL += "op=true"; - } else { - // slice last '&' - baseURL = baseURL.slice(0,baseURL.length-1); - } + if(!$("#publisher").hasClass("closed")) { + // open publisher + baseURL += "op=true"; } else { - selectedGUIDS = []; + // slice last '&' + baseURL = baseURL.slice(0,baseURL.length-1); } return baseURL; } -- GitLab