datamade / nyc-councilmatic

:statue_of_liberty: a web app for keeping tabs on city council activity in New York City
https://nyc.councilmatic.org
MIT License
39 stars 12 forks source link

filtering options off /search not working #133

Closed davidmooreppf closed 8 years ago

davidmooreppf commented 8 years ago

Usually on /search, after entering a keyword such as "energy", filtering on the left by Intros applies that filter correctly and appends it to the URL.

But currently none of left-hand filters are working, only adding a pound sign to URL.

Same without entering a search term, filters don't change bill listing.

cathydeng commented 8 years ago

hm odd, I can't reproduce - the filters are working fine for me.

there's some javascript that puts together a url when you click on a search filter. what browser are you using? if you right click on the page & select inspect element, & then click on console, do you see any javascript error messages?

davidmooreppf commented 8 years ago

Yeah I thought this was odd as it had been working fine.

Filters aren't working on my machine in both Chrome & Safari 9.0.1, checked that before typing this.

Yes, after clicking on console, there's red error text, displaying "5", and then message:

Uncaught TypeError: current_url.contains is not a function

davidmooreppf commented 8 years ago

When I flip over to Sources, here's the section it brings me to - so yeah, could be JS weirdness on my end:

    $(".filter-value").click(function() {

                var current_url = window.location.href
                var addtl_filter = this.id

                if(current_url.contains('selected_facets')) {
                    window.location = current_url + '&selected_facets=' + addtl_filter;
                } 
                else {
                    window.location = '/search/?q=energy&selected_facets=' + addtl_filter;
                }
            });
        });
    </script>

    <script src="/static/js/analytics_lib.js"></script>
cathydeng commented 8 years ago

oh ok, I know where the issue is. fixing now

cathydeng commented 8 years ago

fixed via https://github.com/datamade/django-councilmatic/commit/f89890de809e393f7d2fb3b32496bc4ea70ad5f6