Make WordPress Core

Opened 17 years ago

Closed 16 years ago

Last modified 6 months ago

#5908 closed enhancement (worksforme)

Manage post category filter should reflect the chosen date range

Reported by: youngmicroserf's profile youngmicroserf Owned by:
Milestone: Priority: low
Severity: minor Version: 2.5
Component: Administration Keywords: admin manage UI has-patch has-unit-tests
Focuses: Cc:

Description

The category filter on the manage posts UI indicates the number of posts in each category regardless of the date range specified. If there are 10 posts in a given category but only one of them has been published during the chosen date range, the category filter will still display "category x (10)". This is even the case when no posts in this category have been posted in the chosen month. I think this is counter-intuitive. The category list should reflect the date range chosen if a date range is chosen. Moreover, if possible, the date range should also reflect if a category has been chosen and only display months in which posts in the respective category have been written, possible even indicating the number of posts.

Attachments (1)

CropperCapture[16].jpg (7.5 KB) - added by youngmicroserf 17 years ago.
Screenshot of manage page with selected category and date-range

Download all attachments as: .zip

Change History (16)

@youngmicroserf
17 years ago

Screenshot of manage page with selected category and date-range

#1 @ffemtcj
17 years ago

  • Milestone changed from 2.5 to 2.6

#2 @mrmist
16 years ago

  • Milestone 2.9 deleted
  • Resolution set to worksforme
  • Status changed from new to closed

This works as expected in 2.7.

This ticket was mentioned in PR #6020 on WordPress/wordpress-develop by @jonsurrell.


7 months ago
#3

  • Keywords has-patch has-unit-tests added

Trac Ticket: Core-61549

See HTML Spec: Add an implementation and tests for "reset the insertion mode appropriately".

This unblocks work to support more tags:

The HTML standard describes an algorithm to "reset the insertion mode appropriately" that will be necessary for the HTML API to support a number of different tags such as TABLE or SELECT.
An implementation should be added so that the HTML Processor can continue to add tag support.

@dmsnell commented on PR #6020:


7 months ago
#4

@sirreal I've merged in trunk after adding the new insertion modes. I hope that's helpful, as it was clouding the diff for me.

@jonsurrell commented on PR #6020:


6 months ago
#6

At this point I feel pretty good about the implementation and whatever direction you want to take it.

@dmsnell I think you wanted to move it to the HTML Processor, that's fine with me. That's where I put it originally and only moved it so it was easily testable. I'm fine with removing the internals tests and moving the implementation 👍

@dmsnell commented on PR #6020:


6 months ago
#7

Noting that because of the inherent challenges in testing this change, we're going to lean on the existing html5lib test suite, and new tests introduced with additional tag support in order to verify the behavior of the implementation.

The challenge is that this is an internal implementation and it's difficult to ascertain what the tests should be verifying. The test cases are unclear, and testing it in isolation doesn't bear a direct impact on whether the HTML API is working properly or not.

Therefore in order to avoid accidentally encoding incorrect behaviors in a unit test suite on an internal details, and to avoid architecting our code around the ability to test such internal details, we're foregoing specific new tests for this code.

This ticket was mentioned in PR #6040 on WordPress/wordpress-develop by @jonsurrell.


6 months ago
#9

Includes #5908 (merged here).

Trac ticket:

@jonsurrell commented on PR #6040:


6 months ago
#10

@dmsnell This is ready for review.

@dmsnell commented on PR #6040:


6 months ago
#11

@sirreal I've merged trunk into this branch, and resolved conflicts. Please review and ensure I didn't accidentally break your changes.

@jonsurrell commented on PR #6040:


6 months ago
#12

There's an error in the new form test with the change to auto-close the form where the form closer is not visited by next_token. It's fixed with this patch, although I haven't investigated why:

  • src/wp-includes/html-api/class-wp-html-processor.php

    diff --git before/src/wp-includes/html-api/class-wp-html-processor.php after/src/wp-includes/html-api/class-wp-html-processor.php
    index 1e6a18389b..0d1c7c1496 100644
    old new class WP_HTML_Processor extends WP_HTML_Tag_Processor { 
    23562356                                }
    23572357
    23582358                                // This FORM is special because it immediately closes and cannot have other children.
    2359                                 $this->state->current_token->has_self_closing_flag = true;
    2360 
    23612359                                $this->insert_html_element( $this->state->current_token );
    23622360                                $this->state->form_element = $this->state->current_token;
     2361                                $this->state->stack_of_open_elements->pop();
    23632362                                return true;
    23642363                }

I'll push that change and tests should be passing again. It's effectively reverting part of your updates so happy to discuss further.

@jonsurrell commented on PR #6040:


6 months ago
#13

@dmsnell The changes you've pushed look good, thanks for catching a couple of bugs and I do like the method for creating virtual nodes.

The last remaining thing is to sort out the FORM element in table insertion mode that's immediately popped.

@dmsnell commented on PR #6040:


6 months ago
#14

I'll push that change and tests should be passing again. It's effectively reverting part of your updates so happy to discuss further.

I was considering this because I wanted the code to function as the void tags function, but I can't figure out what's wrong. Along the way I found some bugs in next_token() I introduced when fixing breadcrumbs, but the fix is incoming and easy. We don't close out the remaining open stack elements at the end of the document _because they never get popped_.

Note: See TracTickets for help on using tickets.