Sha256: e79df31a7f3a4e0c6cf1d2eff881b594de3ceb193e8233ac336dab8b7a60b3f4
Contents?: true
Size: 988 Bytes
Versions: 34
Compression:
Stored size: 988 Bytes
Contents
Spud = (typeof(Spud) == 'undefined') ? {} : Spud; Spud.Blog = new function(){ var self = this; this.init = function(){ $('.spud_blog_filter_form').live('submit', self.didSubmitFilterForm) }; this.didSubmitFilterForm = function(event){ event.preventDefault(); var form = $(this); var base = form.attr('action'); var url = ''; // find filter values var category_select = $(this).find('select[rel=category]'); if(category_select){ var category = category_select.val(); } var archive_select = $(this).find('select[rel=archive]'); if(archive_select){ var archive = archive_select.val(); } // build url and redirect if(category && archive){ url = '/category/' + category + '/' + archive; } else if(category){ url = '/category/' + category; } else if(archive){ url = '/archive/' + archive; } window.location = base + url; }; }; $(document).ready(Spud.Blog.init);
Version data entries
34 entries across 34 versions & 1 rubygems