- 
      
 - 
        
Save axsuul/4c91435aefde9ad5846f to your computer and use it in GitHub Desktop.  
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | %ul#filters | |
| - @filters.each do |filter| | |
| %li{:"data-name" => filter.name, :href => filter_url(@url_filters.add_to_url(filter.name))} | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | $('#filters li a').live 'click', -> | |
| history.pushState(null, "", @href) # This changes the url (not using hash bangs) | |
| $.getScript(@href) # This will call index.js.coffee | |
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | class FiltersController < ApplicationController | |
| def index | |
| @url_filters = URLFilters.parse(request.fullpath) | |
| end | |
| end | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | = javascript_include_tag :filters | |
| = render "filters" | 
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | $('#filters li a').each -> | |
| # This is the part I'm having trouble with. The code below obviously won't work but hopefully it'll give you an idea of what I'm trying to do | |
| # But basically I want to update each url filter url to account for the new url when the url changes | |
| $(this).attr('href', '<%= @url_filters.add_to_url($(this).data("name")) %>') | 
  
    Sign up for free
    to join this conversation on GitHub.
    Already have an account?
    Sign in to comment