Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add filters on taxonomy and post page #1373

Merged
merged 30 commits into from
Sep 5, 2018

Commits on Aug 28, 2018

  1. Add a 'type' to all validation errors

    Like Weston suggested, add this to the
    amp_validation_error term description.
    This will aid in searching that taxonomy page
    by error type.
    At the moment, there are only 3 types:
    HTML, JS, and CSS.
    kienstra committed Aug 28, 2018
    Configuration menu
    Copy the full SHA
    0017edf View commit details
    Browse the repository at this point in the history
  2. If an on* attribute is removed, make type js_error

    For example, onclick.
    This will have JS in it, so this error code is more accurate.
    On Weston's suggestion in code review.
    kienstra committed Aug 28, 2018
    Configuration menu
    Copy the full SHA
    3e9a81e View commit details
    Browse the repository at this point in the history
  3. In unit test assertions, change to js_error

    These were for an onload attribute,
    so update them for the latest commit.
    kienstra committed Aug 28, 2018
    Configuration menu
    Copy the full SHA
    0ae789d View commit details
    Browse the repository at this point in the history

Commits on Aug 29, 2018

  1. Add a query var to filter by type

    Borrowing heavily from:
    add_group_terms_clauses_filter(),
    filter the 'where' clause,
    to filter the taxonomy page by type.
    kienstra committed Aug 29, 2018
    Configuration menu
    Copy the full SHA
    3433791 View commit details
    Browse the repository at this point in the history
  2. Filter the term redirect location, to possibly add a query var

    On clicking the 'Filter' button on the 'AMP Validation Errors' taxonomy page,
    edit-tags.php processes the POST request that this submits.
    Then, it redirects to a URL to display the page again.
    This filter callback looks for a value for VALIDATION_ERROR_TYPE_QUERY_VAR in the  request.
    That means that the user filtered by error type, like 'js_error'.
    It then passes that value to the redirect URL as a query var,
    So that the taxonomy page will be filtered for that error type.
    @see AMP_Validation_Error_Taxonomy::add_error_type_clauses_filter() for the filtering of the 'where' clause, based on that query var.
    kienstra committed Aug 29, 2018
    Configuration menu
    Copy the full SHA
    8dd3f01 View commit details
    Browse the repository at this point in the history
  3. Render the taxonomy filter for this taxonomy type

    Allows filtering by error_type,
    like only viewing JS errors.
    This UI now works for error_type,
    though work is probably needed for accepted status.
    kienstra committed Aug 29, 2018
    Configuration menu
    Copy the full SHA
    5f92cc2 View commit details
    Browse the repository at this point in the history
  4. Add a filter <select> element for error type, like 'Accepted'

    This still doesn't use the new terminology, like 'Identified.'
    There wasn't much to change,
    as filtering by error type worked thanks to Weston.
    kienstra committed Aug 29, 2018
    Configuration menu
    Copy the full SHA
    3d17734 View commit details
    Browse the repository at this point in the history
  5. Remove views for filtering taxonomy, but reuse their counts

    Though these views are now applied in a <select> filter,
    this uses much of their infrastructure.
    Also, it uses their counts for each status.
    For example, if there are 0 accepted errors,
    this won't display the <option> for 'Accepted Error'.
    kienstra committed Aug 29, 2018
    Configuration menu
    Copy the full SHA
    c2656a3 View commit details
    Browse the repository at this point in the history
  6. Add the option value for 'All Statuses' to the whitelist

    Create a new constant, NO_FILTER_VALUE.
    This is for the existing value of -1.
    And add this to the whitelist: in_array().
    kienstra committed Aug 29, 2018
    Configuration menu
    Copy the full SHA
    fe43d31 View commit details
    Browse the repository at this point in the history
  7. Use the new terminology for the error taxonomy page name

    Change this to 'Errors by Type,'
    to match the Sketch design.
    kienstra committed Aug 29, 2018
    Configuration menu
    Copy the full SHA
    1e135d2 View commit details
    Browse the repository at this point in the history
  8. Configuration menu
    Copy the full SHA
    f1d4bea View commit details
    Browse the repository at this point in the history

Commits on Aug 30, 2018

  1. Restore error counts by status in <option>

    There were counts earlier,
    when filtering by status was done by clicking an <a>.
    Thanks to Weston's work.
    Mainly copy the previous logic to add the counts.
    kienstra committed Aug 30, 2018
    Configuration menu
    Copy the full SHA
    caa2a26 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    7b937b1 View commit details
    Browse the repository at this point in the history
  3. Add error types for HTML (Element) and HTML (Attribute)

    Before, there was only HTML_ERROR_TYPE.
    Based on comments in issues like 1361,
    this adds 2 types of errors for HTML.
    kienstra committed Aug 30, 2018
    Configuration menu
    Copy the full SHA
    13d5caf View commit details
    Browse the repository at this point in the history

Commits on Aug 31, 2018

  1. Refactor logic in render_taxonomy_filters() into 2 methods

    The AMP validation error page also needs these filters,
    but it doesn't need all of
    render_taxonomy_filters().
    So abstract it into 2 functions that can be reused.
    kienstra committed Aug 31, 2018
    Configuration menu
    Copy the full SHA
    b74854c View commit details
    Browse the repository at this point in the history
  2. Add filters on the 'Errors by URL' page

    Using the functions created earlier,
    output the filter <select> elements on this page.
    There's more work remaining,
    like ensuring the query vars work.
    kienstra committed Aug 31, 2018
    Configuration menu
    Copy the full SHA
    0397a52 View commit details
    Browse the repository at this point in the history

Commits on Sep 3, 2018

  1. Filter for error type on Errors by URL page

    Mainly by using the method that Weston wrote:
    filter_posts_where_for_validation_error_status()
    Look for the query var of the error type.
    And if that's present, add to the WHERE clause.
    kienstra committed Sep 3, 2018
    Configuration menu
    Copy the full SHA
    228eb81 View commit details
    Browse the repository at this point in the history
  2. Output the 'View errors by URL' link from the design

    This is at the top of the taxonomy page (Errors by Type),
    and links to the post page (Errors by URL).
    kienstra committed Sep 3, 2018
    Configuration menu
    Copy the full SHA
    a567047 View commit details
    Browse the repository at this point in the history
  3. Simplify add_term_filter_query_var()

    Instead of an if block for most of the method,
    simply return if the condition is false.
    Then, the remaining if blocks aren't nested.
    kienstra committed Sep 3, 2018
    Configuration menu
    Copy the full SHA
    3bcfc03 View commit details
    Browse the repository at this point in the history
  4. Make the error status counts accurate on the Errors by URL page

    Before, that didn't take account of the filter for error type
    So if that filtered for js_error,
    the total count of error status was the same as if it
    were for 'All Error Types.'
    So look for the query var for the error type,
    and pass that to the WP_Query if it's valid.
    kienstra committed Sep 3, 2018
    Configuration menu
    Copy the full SHA
    13a8648 View commit details
    Browse the repository at this point in the history
  5. On the 'Errors by URL' page, use 'With New Errors' instead of 'New Er…

    …rors'
    
    This is how the text was when it was inside a link.
    Check for the current screen,
    and conditionally add the 'With'.
    kienstra committed Sep 3, 2018
    Configuration menu
    Copy the full SHA
    6c5c06d View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    6c262f0 View commit details
    Browse the repository at this point in the history
  7. Fix an issue where filtering by 'All Error Types' wasn't reflected in…

    … redirect
    
    Before, the filter for the redirect URL
    did not accept -1,
    which is for 'All Error Types' and 'All Statuses'.
    This means that the URL sometimes did not redirect,
    and it sometimes showed the same results as before.
    kienstra committed Sep 3, 2018
    Configuration menu
    Copy the full SHA
    3694bb9 View commit details
    Browse the repository at this point in the history
  8. Improve inline documentation, address Travis error.

    Make PHP DocBlocks more clear,
    especially when they needed to be updated.
    kienstra committed Sep 3, 2018
    Configuration menu
    Copy the full SHA
    8443fd8 View commit details
    Browse the repository at this point in the history

Commits on Sep 5, 2018

  1. Configuration menu
    Copy the full SHA
    a13c91e View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    61c6095 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    364944e View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    ea15a2e View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    2882262 View commit details
    Browse the repository at this point in the history
  6. Opt to output all status options even when empty to prevent de-select…

    …ion when changing selected error type
    westonruter committed Sep 5, 2018
    Configuration menu
    Copy the full SHA
    3b87595 View commit details
    Browse the repository at this point in the history