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 UI to select an offline page #28

Merged
merged 31 commits into from
Jul 27, 2018
Merged

Add UI to select an offline page #28

merged 31 commits into from
Jul 27, 2018

Commits on Jul 11, 2018

  1. Begin UI to select an offline page.

    Mainly taken from the privacy policy page
    UI in wp-admin/privacy.php.
    Some items remain,
    including adding the custom post status,
    and adding the href value.
    kienstra committed Jul 11, 2018
    Configuration menu
    Copy the full SHA
    314c472 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    596e44c View commit details
    Browse the repository at this point in the history

Commits on Jul 12, 2018

  1. Change option name to page_for_offline.

    New option name is consistent with the naming structure for static
    special pages.
    hellofromtonya committed Jul 12, 2018
    Configuration menu
    Copy the full SHA
    225ba95 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    53f6533 View commit details
    Browse the repository at this point in the history
  3. Made settings errors appear on loading the Reading page.

    Refactored to move the `add_settings_error` code to a separate method.  Hooked that method to `admin_notices` action.  Now settings errors appear both when saving and upon first loading the Reading page.
    
    Modified the "in the trash" error to link a link to the Page's Trash UI.
    hellofromtonya committed Jul 12, 2018
    Configuration menu
    Copy the full SHA
    8d7aa1c View commit details
    Browse the repository at this point in the history
  4. Configuration menu
    Copy the full SHA
    7d7da59 View commit details
    Browse the repository at this point in the history

Commits on Jul 13, 2018

  1. Remove page attributes support for Offline Page.

    This new strategy works for both the classic and Gutenberg editors.
    hellofromtonya committed Jul 13, 2018
    Configuration menu
    Copy the full SHA
    c683eaf View commit details
    Browse the repository at this point in the history
  2. Optimize the admin initialization by registering one callback.

    Instead of registering multiple callbacks to the `admin_init`, this commit registers `init_admin()`.  Then the new callback method handles the order of calling each of the tasks.
    
    This commit is more performant by O(n-1):
    
    1. Decreases the processing time to do `add_action` as it only have to invoke it once.
    2. Decreases the processing time when `do_action` as it only has to invoke one callback.
    
    It's more readable, as we can quickly read that the callback intent is to initialize the admin.
    hellofromtonya committed Jul 13, 2018
    Configuration menu
    Copy the full SHA
    e76b7f1 View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    83c5604 View commit details
    Browse the repository at this point in the history
  4. Exclude static pages from dropdowns.

    This comment handles excluding special static pages ( i.e. `page_on_front`, `page_for_posts`, and `wp_page_for_privacy_policy`, and `page_for_offline` ) from `wp_dropdown_pages`:
    
    1. When selected, the offline page is excluded from the other dropdowns, preventing it from being selected as anything else but the offline page.
    2. The homepage, posts page, and privacy page are all excluded from the Offline Page's dropdown.
    
    This commit also includes slight performance improvements by:
    
    1. Initializing static pages on init.
    2. Caching the offline page ID within the object itself, while also providing for a hard request (i.e. when true, run `get_option`).
    hellofromtonya committed Jul 13, 2018
    Configuration menu
    Copy the full SHA
    98c6f82 View commit details
    Browse the repository at this point in the history
  5. Add create new page functionality.

    Using the Privacy code, this commit adds the HTML and create new page functionality.  A unique action is added to the Reading URL.  Upon clicking the "create new page" link, the new functionality inserts a new page and assigns it as the Offline Page.
    hellofromtonya committed Jul 13, 2018
    Configuration menu
    Copy the full SHA
    7e6574b View commit details
    Browse the repository at this point in the history
  6. Configuration menu
    Copy the full SHA
    c403da5 View commit details
    Browse the repository at this point in the history
  7. Configuration menu
    Copy the full SHA
    6a7a720 View commit details
    Browse the repository at this point in the history

Commits on Jul 16, 2018

  1. Re-enable page attributes.

    To be consistent with the other special pages (homepage, posts page, and privacy), this commit re-enables the page attributes.
    hellofromtonya committed Jul 16, 2018
    Configuration menu
    Copy the full SHA
    cc997ef View commit details
    Browse the repository at this point in the history
  2. Excluding offline page from menus and search.

    This commit excludes the offline page from all search and the menu builders including Appearance > Menus and Customizer's Menus.
    hellofromtonya committed Jul 16, 2018
    Configuration menu
    Copy the full SHA
    33c461c View commit details
    Browse the repository at this point in the history
  3. Configuration menu
    Copy the full SHA
    c7c96b4 View commit details
    Browse the repository at this point in the history
  4. Exclude offline page from rendering on frontend.

    This commit excludes the offline page from rendering on the frontend.  A 404 is served up.
    
    When using plain permalinks, e.g. https://example.com?page_id=28, it will find and render the offline page.
    
    This is an incompletion strategy per conversations in Issue #23 @see #23 (comment).
    hellofromtonya committed Jul 16, 2018
    Configuration menu
    Copy the full SHA
    c48b36c View commit details
    Browse the repository at this point in the history

Commits on Jul 17, 2018

  1. Split tasks into separate classes.

    Grouped the tasks and split into separate classes, as the previous class design was doing too much.
    hellofromtonya committed Jul 17, 2018
    Configuration menu
    Copy the full SHA
    05b655b View commit details
    Browse the repository at this point in the history
  2. Improve and optimize excluder.

    This commit improves the excluder by:
    
    1. Using parse_query.
    2. Using $query->is_admin.
    3. Checking for the offline page's query first.  If yes, setting a 404 on the frontend.
    hellofromtonya committed Jul 17, 2018
    Configuration menu
    Copy the full SHA
    7104c53 View commit details
    Browse the repository at this point in the history

Commits on Jul 26, 2018

  1. Configuration menu
    Copy the full SHA
    cc40e00 View commit details
    Browse the repository at this point in the history
  2. Include privacy page in get_static_pages().

    We want to include all special pages, as we use this collection to remove these special pages from the page select dropdowns.
    Tonya Mork committed Jul 26, 2018
    Configuration menu
    Copy the full SHA
    846ce07 View commit details
    Browse the repository at this point in the history
  3. Improve tests to ensure privacy page is also excluded from the offlin…

    …e page dropdown
    
    and that the offline page is included and selected.
    Tonya Mork committed Jul 26, 2018
    Configuration menu
    Copy the full SHA
    11b49fc View commit details
    Browse the repository at this point in the history
  4. Change settings label to "Default offline status page".

    This change was requested by Alberto. He's right as the previous label could be confusing as more than one page can be served in offline.  But this specific page is the default offline status page when the one requested is not available.
    Tonya Mork committed Jul 26, 2018
    Configuration menu
    Copy the full SHA
    40f8737 View commit details
    Browse the repository at this point in the history
  5. Configuration menu
    Copy the full SHA
    7ef0dea View commit details
    Browse the repository at this point in the history
  6. Merge the offline page ID with the current "post__not_in" var.

    Being mindful of performance, this commit checks if the "post__not_in" has a value.  If yes, then it merges with the offline page ID and then filters for only the unique values.
    
    Else, it sets the offline ID only, thereby skipping the `array_merge` and `array_unique`.
    
    The code is more complex.  But it serves to only run the the array functions when needed.
    Tonya Mork committed Jul 26, 2018
    Configuration menu
    Copy the full SHA
    eddeb84 View commit details
    Browse the repository at this point in the history
  7. Offline page is a page and singular.

    Tonya Mork committed Jul 26, 2018
    Configuration menu
    Copy the full SHA
    d1dbaf9 View commit details
    Browse the repository at this point in the history
  8. Improve is_offline_page_query().

    Tonya Mork committed Jul 26, 2018
    Configuration menu
    Copy the full SHA
    f8c3137 View commit details
    Browse the repository at this point in the history
  9. Configuration menu
    Copy the full SHA
    ab4cbc6 View commit details
    Browse the repository at this point in the history
  10. Make naming more clear by adding "default".

    Tonya Mork committed Jul 26, 2018
    Configuration menu
    Copy the full SHA
    03e78ba View commit details
    Browse the repository at this point in the history
  11. Exclude the default offline page from robots.

    Tonya Mork committed Jul 26, 2018
    Configuration menu
    Copy the full SHA
    9669026 View commit details
    Browse the repository at this point in the history

Commits on Jul 27, 2018

  1. Separate concerns for no robots. Code formatting.

    Tonya Mork committed Jul 27, 2018
    Configuration menu
    Copy the full SHA
    af9aedd View commit details
    Browse the repository at this point in the history