WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 6 years ago

#30116 closed enhancement (fixed)

Themes: turn route paths into reusable router properties

Reported by: matveb Owned by: johnbillion
Milestone: 4.1 Priority: normal
Severity: normal Version: 3.9
Component: Themes Keywords: has-patch
Focuses: javascript Cc:

Description

Avoid repeating the same fragment path over and over for the themes.php and theme-install.php routes. Abstracting this into centralized router attributes will also help with porting the themes UX to .org/themes directory.

Attachments (1)

30116.diff (2.5 KB) - added by matveb 6 years ago.

Download all attachments as: .zip

Change History (8)

@matveb
6 years ago

#1 @obenland
6 years ago

  • Keywords has-patch added
  • Milestone changed from Awaiting Review to 4.1
  • Type changed from enhancement to defect (bug)
  • Version changed from trunk to 3.9

This ticket was mentioned in Slack in #core by obenland. View the logs.


6 years ago

This ticket was mentioned in Slack in #core by obenland. View the logs.


6 years ago

#4 @ocean90
6 years ago

  • Type changed from defect (bug) to enhancement

What about the routes events?

#5 @obenland
6 years ago

They can be overwritten by extending the corresponding Router as is.
In the case of the theme repo, it looks like this:

        _.extend( wp.themes.InstallerRouter.prototype, {
                routes: {
                        '/:slug/': 'preview',
                        '/browse/:sort/': 'sort',
                        '/?upload': 'upload',
                        '/search.php?q=:query': 'search',
                        '': 'sort'
                },

                baseUrl: function( url ) {
                        return '/' + url;
                },

                themePath: 'themes/',
                browsePath: 'browse/',
                searchPath: 'search.php?q='
        });

This ticket was mentioned in Slack in #core by obenland. View the logs.


6 years ago

#7 @johnbillion
6 years ago

  • Owner set to johnbillion
  • Resolution set to fixed
  • Status changed from new to closed

In 30508:

Abstract the theme browser route paths into attributes so they can be easily overridden.

Fixes #30116
Props matveb

Note: See TracTickets for help on using tickets.