Join GitHub today
GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
AO3-5263: More filters! #3194
Conversation
elzj
and others
added some commits
Dec 1, 2017
| @@ -12,6 +12,7 @@ class WorkSearch < Search | ||
| :revised_at, | ||
| :language_id, | ||
| :complete, | ||
| + :crossover, |
| @@ -34,6 +35,10 @@ class WorkSearch < Search | ||
| :relationship_ids, | ||
| :freeform_names, | ||
| :freeform_ids, | ||
| + :date_from, |
| @@ -34,6 +35,10 @@ class WorkSearch < Search | ||
| :relationship_ids, | ||
| :freeform_names, | ||
| :freeform_ids, | ||
| + :date_from, | ||
| + :date_to, |
| @@ -34,6 +35,10 @@ class WorkSearch < Search | ||
| :relationship_ids, | ||
| :freeform_names, | ||
| :freeform_ids, | ||
| + :date_from, | ||
| + :date_to, | ||
| + :words_from, |
| + :date_from, | ||
| + :date_to, | ||
| + :words_from, | ||
| + :words_to, |
| @@ -8,7 +8,7 @@ $j(document).ready(function() { | ||
| // e.g. Fandoms dt should have a button to toggle dd with Fandom tags | ||
| // (actual toggling done with setupAccordion in application.js) | ||
| function setupFilterToggles() { | ||
| - var filter_option = $j('.filters').find('dt.tags'); | ||
| + var filter_option = $j('.filters').find('dt.filter-toggle'); |
| function showFilters() { | ||
| - var filters = $j('.filters').find('dd.tags'); | ||
| + var filters = $j('.filters').find('dd.expandable'); |
| + // selected), so we only want to look at inputs with an existing value | ||
| + // attribute that is not blank | ||
| + // https://stackoverflow.com/questions/17248915/ | ||
| + var inputs = $j(filter).find('input').filter('[value]:not([value=""])'); |
| + // We've already excluded inputs with blank values, so any | ||
| + // text fields in this array will be non-blank and therefore need to be | ||
| + //expanded | ||
| + if ($j(input).is(':checked, [type="text"]')) { |
| @@ -1 +1 @@ | ||
| -function setupFilterToggles(){var e=$j(".filters").find("dt.tags");e.each(function(){var e=$j(this).next().attr("id");$j(this).wrapInner('<button type="button" class="expander" aria-expanded="false" aria-controls="'+e+'"></button>')}),$j("dt.tags button").on("click",function(){"false"==$j(this).attr("aria-expanded")?$j(this).attr("aria-expanded","true"):$j(this).attr("aria-expanded","false")})}function showFilters(){var e=$j(".filters").find("dd.tags");e.each(function(e,t){var a=$j(t).find("input"),r=$j(t).attr("id"),n=$j("#toggle_"+r),i=$j('[aria-controls="'+r+'"]');a.each(function(e,a){$j(a).is(":checked")&&($j(t).removeClass("hidden"),$j(n).removeClass("collapsed").addClass("expanded"),$j(i).attr("aria-expanded","true"))})})}function setupNarrowScreenFilters(){var e=$j("form.filters"),t=$j("#outer"),a=$j("#go_to_filters"),r=$j("#leave_filters");a.click(function(a){a.preventDefault(),e.removeClass("narrow-hidden"),t.addClass("filtering"),e.find(":focusable").first().focus(),e.trap()}),r.click(function(r){r.preventDefault(),t.removeClass("filtering"),e.addClass("narrow-hidden"),a.focus()})}$j(document).ready(function(){setupFilterToggles(),showFilters(),setupNarrowScreenFilters()}); | ||
| +function setupFilterToggles(){var e=$j(".filters").find("dt.filter-toggle");e.each(function(){var e=$j(this).next().attr("id");$j(this).wrapInner('<button type="button" class="expander" aria-expanded="false" aria-controls="'+e+'"></button>')}),$j("dt.tags button").on("click",function(){"false"==$j(this).attr("aria-expanded")?$j(this).attr("aria-expanded","true"):$j(this).attr("aria-expanded","false")})}function showFilters(){var e=$j(".filters").find("dd.expandable");e.each(function(e,t){var a=$j(t).find("input").filter('[value]:not([value=""])'),r=$j(t).attr("id"),n=$j("#toggle_"+r),i=$j('[aria-controls="'+r+'"]');a.each(function(e,a){$j(a).is(':checked, [type="text"]')&&($j(t).removeClass("hidden"),$j(n).removeClass("collapsed").addClass("expanded"),$j(i).attr("aria-expanded","true"))})})}function setupNarrowScreenFilters(){var e=$j("form.filters"),t=$j("#outer"),a=$j("#go_to_filters"),r=$j("#leave_filters");a.click(function(a){a.preventDefault(),e.removeClass("narrow-hidden"),t.addClass("filtering"),e.find(":focusable").first().focus(),e.trap()}),r.click(function(r){r.preventDefault(),t.removeClass("filtering"),e.addClass("narrow-hidden"),a.focus()})}$j(document).ready(function(){setupFilterToggles(),showFilters(),setupNarrowScreenFilters()}); |
houndci-bot
Dec 2, 2017
Line is too long.
Mixed double and single quotes.
Missing semicolon.
Expected an assignment or function call and instead saw an expression.
'$j' is not defined.
| @@ -58,7 +58,7 @@ | ||
| it "should allow you to filter for complete works" do | ||
| q = WorkQuery.new(complete: true) | ||
| - expect(q.filters).to include({term: { complete: 'true'} }) | ||
| + expect(q.filters).to include({ term: { complete: true } }) |
redsummernight
added
the
Awaiting review
label
Dec 2, 2017
sarken
approved these changes
Dec 4, 2017
Elz reviewed my frontend changes and I reviewed her backend changes, so let's call this mergeable.
sarken
added
Reviewed: Ready to Merge
and removed
Awaiting review
labels
Dec 4, 2017
sarken
merged commit 0736a7d
into
otwcode:master
Dec 4, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
elzj commentedDec 2, 2017
Issue
https://otwarchive.atlassian.net/browse/AO3-5263
Purpose
Adds some additional filtering options and also updates the class used for toggling filters.
Testing
New filters should work, old filters should expand/collapse properly.