[wp-trac] [WordPress Trac] #30116: Themes: turn route paths into reusable router properties

WordPress Trac noreply at wordpress.org
Thu Nov 20 10:51:47 UTC 2014


#30116: Themes: turn route paths into reusable router properties
-------------------------+-------------------------
 Reporter:  matveb       |       Owner:
     Type:  enhancement  |      Status:  new
 Priority:  normal       |   Milestone:  4.1
Component:  Themes       |     Version:  3.9
 Severity:  normal       |  Resolution:
 Keywords:  has-patch    |     Focuses:  javascript
-------------------------+-------------------------

Comment (by obenland):

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

 {{{
 #!javascript

         _.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='
         });
 }}}

--
Ticket URL: <https://core.trac.wordpress.org/ticket/30116#comment:5>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list