<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[BuddyPress][13275] branches/10.0/src: BP Nouveau: support custom slugs in Messages UI</title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { white-space: pre-line; overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<dl class="meta" style="font-size: 105%">
<dt style="float: left; width: 6em; font-weight: bold">Revision</dt> <dd><a style="font-weight: bold" href="http://buddypress.trac.wordpress.org/changeset/13275">13275</a><script type="application/ld+json">{"@context":"http://schema.org","@type":"EmailMessage","description":"Review this Commit","action":{"@type":"ViewAction","url":"http://buddypress.trac.wordpress.org/changeset/13275","name":"Review Commit"}}</script></dd>
<dt style="float: left; width: 6em; font-weight: bold">Author</dt> <dd>imath</dd>
<dt style="float: left; width: 6em; font-weight: bold">Date</dt> <dd>2022-04-29 20:00:56 +0000 (Fri, 29 Apr 2022)</dd>
</dl>
<pre style='padding-left: 1em; margin: 2em 0; border-left: 2px solid #ccc; line-height: 1.25; font-size: 105%; font-family: sans-serif'>BP Nouveau: support custom slugs in Messages UI
The Messages UI Backbone Router is no more using hardcoded slugs to define its routes. It's now possible to use customized slugs for the BP Messages component and still enjoy this UI.
Fixes <a href="http://buddypress.trac.wordpress.org/ticket/8691">#8691</a> (branch 10.0)</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#branches100srcbpmessagesclassesclassbpmessagescomponentphp">branches/10.0/src/bp-messages/classes/class-bp-messages-component.php</a></li>
<li><a href="#branches100srcbptemplatesbpnouveauincludesmessagesfunctionsphp">branches/10.0/src/bp-templates/bp-nouveau/includes/messages/functions.php</a></li>
<li><a href="#branches100srcbptemplatesbpnouveaujsbuddypressmessagesjs">branches/10.0/src/bp-templates/bp-nouveau/js/buddypress-messages.js</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="branches100srcbpmessagesclassesclassbpmessagescomponentphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/10.0/src/bp-messages/classes/class-bp-messages-component.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/10.0/src/bp-messages/classes/class-bp-messages-component.php 2022-04-29 19:49:38 UTC (rev 13274)
+++ branches/10.0/src/bp-messages/classes/class-bp-messages-component.php 2022-04-29 20:00:56 UTC (rev 13275)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -268,37 +268,28 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'user_has_access' => $access
</span><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Show certain screens only if the current user is the displayed user.
- if ( bp_is_my_profile() ) {
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Show "Compose" on the logged-in user's profile only.
+ $sub_nav[] = array(
+ 'name' => __( 'Compose', 'buddypress' ),
+ 'slug' => 'compose',
+ 'parent_url' => $messages_link,
+ 'parent_slug' => $slug,
+ 'screen_function' => 'messages_screen_compose',
+ 'position' => 30,
+ 'user_has_access' => bp_is_my_profile(),
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- // Show "Compose" on the logged-in user's profile only.
- $sub_nav[] = array(
- 'name' => __( 'Compose', 'buddypress' ),
- 'slug' => 'compose',
- 'parent_url' => $messages_link,
- 'parent_slug' => $slug,
- 'screen_function' => 'messages_screen_compose',
- 'position' => 30,
- 'user_has_access' => $access
- );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Show "Notices" to community admins only.
+ $sub_nav[] = array(
+ 'name' => __( 'Notices', 'buddypress' ),
+ 'slug' => 'notices',
+ 'parent_url' => $messages_link,
+ 'parent_slug' => $slug,
+ 'screen_function' => 'messages_screen_notices',
+ 'position' => 90,
+ 'user_has_access' => bp_current_user_can( 'bp_moderate' )
+ );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- /*
- * Show "Notices" on the logged-in user's profile only
- * and then only if the user can create notices.
- */
- if ( bp_current_user_can( 'bp_moderate' ) ) {
- $sub_nav[] = array(
- 'name' => __( 'Notices', 'buddypress' ),
- 'slug' => 'notices',
- 'parent_url' => $messages_link,
- 'parent_slug' => $slug,
- 'screen_function' => 'messages_screen_notices',
- 'position' => 90,
- 'user_has_access' => true
- );
- }
- }
-
</del><span class="cx" style="display: block; padding: 0 10px"> parent::setup_nav( $main_nav, $sub_nav );
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span></span></pre></div>
<a id="branches100srcbptemplatesbpnouveauincludesmessagesfunctionsphp"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/10.0/src/bp-templates/bp-nouveau/includes/messages/functions.php</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/10.0/src/bp-templates/bp-nouveau/includes/messages/functions.php 2022-04-29 19:49:38 UTC (rev 13274)
+++ branches/10.0/src/bp-templates/bp-nouveau/includes/messages/functions.php 2022-04-29 20:00:56 UTC (rev 13275)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -3,7 +3,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> * Messages functions
</span><span class="cx" style="display: block; padding: 0 10px"> *
</span><span class="cx" style="display: block; padding: 0 10px"> * @since 3.0.0
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- * @version 10.0.0
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ * @version 10.3.0
</ins><span class="cx" style="display: block; padding: 0 10px"> */
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Exit if accessed directly.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -90,17 +90,58 @@
</span><span class="cx" style="display: block; padding: 0 10px"> return $params;
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ $bp = buddypress();
+ $slug = bp_nouveau_get_component_slug( 'messages' );
+
+ // Use the primary nav to get potential custom slugs.
+ $primary_nav = $bp->members->nav->get( $slug );
+ if ( isset( $primary_nav->link ) && $primary_nav->link ) {
+ $root_url = $primary_nav->link;
+
+ // Make sure to use the displayed user domain.
+ if ( bp_loggedin_user_domain() ) {
+ $root_url = str_replace( bp_loggedin_user_domain(), bp_displayed_user_domain(), $root_url );
+ }
+ } else {
+ $root_url = trailingslashit( bp_displayed_user_domain() . $slug );
+ }
+
+ // Build default routes list.
+ $routes = array(
+ 'inbox' => 'inbox',
+ 'sentbox' => 'sentbox',
+ 'compose' => 'compose',
+ );
+
+ if ( bp_is_active( 'messages', 'star' ) ) {
+ $routes['starred'] = 'starred';
+ }
+
+ // Use the secondary nav to get potential custom slugs.
+ $secondary_nav = $bp->members->nav->get_secondary( array( 'parent_slug' => $slug ), false );
+
+ // Resets the routes list using link slugs.
+ if ( $secondary_nav ) {
+ foreach ( $secondary_nav as $subnav_item ) {
+ $routes[ $subnav_item->slug ] = trim( str_replace( $root_url, '', $subnav_item->link ), '/' );
+
+ if ( ! $routes[ $subnav_item->slug ] ) {
+ $routes[ $subnav_item->slug ] = $subnav_item->slug;
+ }
+ }
+ }
+
</ins><span class="cx" style="display: block; padding: 0 10px"> $params['messages'] = array(
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'errors' => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'errors' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'send_to' => __( 'Please add at least one recipient.', 'buddypress' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'subject' => __( 'Please add a subject to your message.', 'buddypress' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'message_content' => __( 'Please add some content to your message.', 'buddypress' ),
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'nonces' => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'nonces' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'send' => wp_create_nonce( 'messages_send_message' ),
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'loading' => __( 'Loading messages. Please wait.', 'buddypress' ),
- 'doingAction' => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'loading' => __( 'Loading messages. Please wait.', 'buddypress' ),
+ 'doingAction' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'read' => __( 'Marking messages as read. Please wait.', 'buddypress' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'unread' => __( 'Marking messages as unread. Please wait.', 'buddypress' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'delete' => __( 'Deleting messages. Please wait.', 'buddypress' ),
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -107,16 +148,17 @@
</span><span class="cx" style="display: block; padding: 0 10px"> 'star' => __( 'Starring messages. Please wait.', 'buddypress' ),
</span><span class="cx" style="display: block; padding: 0 10px"> 'unstar' => __( 'Unstarring messages. Please wait.', 'buddypress' ),
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'bulk_actions' => bp_nouveau_messages_get_bulk_actions(),
- 'howto' => __( 'Click on the message title to preview it in the Active conversation box below.', 'buddypress' ),
- 'howtoBulk' => __( 'Use the select box to define your bulk action and click on the ✓ button to apply.', 'buddypress' ),
- 'toOthers' => array(
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'bulk_actions' => bp_nouveau_messages_get_bulk_actions(),
+ 'howto' => __( 'Click on the message title to preview it in the Active conversation box below.', 'buddypress' ),
+ 'howtoBulk' => __( 'Use the select box to define your bulk action and click on the ✓ button to apply.', 'buddypress' ),
+ 'toOthers' => array(
</ins><span class="cx" style="display: block; padding: 0 10px"> 'one' => __( '(and 1 other)', 'buddypress' ),
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> /* translators: %s: number of message recipients */
</span><span class="cx" style="display: block; padding: 0 10px"> 'more' => __( '(and %d others)', 'buddypress' ),
</span><span class="cx" style="display: block; padding: 0 10px"> ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'rootUrl' => parse_url( trailingslashit( bp_displayed_user_domain() . bp_nouveau_get_component_slug( 'messages' ) ), PHP_URL_PATH ),
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ 'rootUrl' => parse_url( $root_url, PHP_URL_PATH ),
+ 'supportedRoutes' => $routes,
</ins><span class="cx" style="display: block; padding: 0 10px"> );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Star private messages.
</span></span></pre></div>
<a id="branches100srcbptemplatesbpnouveaujsbuddypressmessagesjs"></a>
<div class="modfile"><h4 style="background-color: #eee; color: inherit; margin: 1em 0; padding: 1.3em; font-size: 115%">Modified: branches/10.0/src/bp-templates/bp-nouveau/js/buddypress-messages.js</h4>
<pre class="diff"><span>
<span class="info" style="display: block; padding: 0 10px; color: #888">--- branches/10.0/src/bp-templates/bp-nouveau/js/buddypress-messages.js 2022-04-29 19:49:38 UTC (rev 13274)
+++ branches/10.0/src/bp-templates/bp-nouveau/js/buddypress-messages.js 2022-04-29 20:00:56 UTC (rev 13275)
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1,7 +1,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> /* global wp, BP_Nouveau, _, Backbone, tinymce, tinyMCE */
</span><span class="cx" style="display: block; padding: 0 10px"> /* jshint devel: true */
</span><span class="cx" style="display: block; padding: 0 10px"> /* @since 3.0.0 */
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">-/* @version 10.2.0 */
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+/* @version 10.3.0 */
</ins><span class="cx" style="display: block; padding: 0 10px"> window.wp = window.wp || {};
</span><span class="cx" style="display: block; padding: 0 10px"> window.bp = window.bp || {};
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -36,6 +36,9 @@
</span><span class="cx" style="display: block; padding: 0 10px"> this.router = new bp.Nouveau.Messages.Router();
</span><span class="cx" style="display: block; padding: 0 10px"> this.box = 'inbox';
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ // Set up supported routes.
+ this.supportedRoutes = BP_Nouveau.messages.supportedRoutes;
+
</ins><span class="cx" style="display: block; padding: 0 10px"> this.setupNav();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> Backbone.history.start( {
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -53,7 +56,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> // Then listen to nav click and load the appropriate view.
</span><span class="cx" style="display: block; padding: 0 10px"> $( '#subnav a' ).on( 'click', function( event ) {
</span><span class="cx" style="display: block; padding: 0 10px"> var view_id = $( event.target ).prop( 'id' ),
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- supportedView = [ 'inbox', 'starred', 'sentbox', 'compose' ];
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ supportedView = _.keys( self.supportedRoutes );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> if ( -1 === _.indexOf( supportedView, view_id ) || 'unsupported' === self.box ) {
</span><span class="cx" style="display: block; padding: 0 10px"> return event;
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -78,11 +81,11 @@
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Navigate back to current box.
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self.router.navigate( self.box + '/', { trigger: true } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.router.navigate( self.supportedRoutes[ self.box ] + '/', { trigger: true } );
</ins><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Otherwise load it.
</span><span class="cx" style="display: block; padding: 0 10px"> } else {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self.router.navigate( 'compose/', { trigger: true } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.router.navigate( self.supportedRoutes.compose + '/', { trigger: true } );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> // Other views are classic.
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -91,7 +94,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> if ( self.box !== view_id || ! _.isUndefined( self.views.get( 'compose' ) ) ) {
</span><span class="cx" style="display: block; padding: 0 10px"> self.clearViews();
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- self.router.navigate( view_id + '/', { trigger: true } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ self.router.navigate( self.supportedRoutes[ view_id ] + '/', { trigger: true } );
</ins><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> }
</span><span class="cx" style="display: block; padding: 0 10px"> } );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -676,7 +679,7 @@
</span><span class="cx" style="display: block; padding: 0 10px"> form.get( 'view' ).remove();
</span><span class="cx" style="display: block; padding: 0 10px"> bp.Nouveau.Messages.views.remove( { id: 'compose', view: form } );
</span><span class="cx" style="display: block; padding: 0 10px">
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- bp.Nouveau.Messages.router.navigate( 'sentbox/', { trigger: true } );
</del><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ bp.Nouveau.Messages.router.navigate( bp.Nouveau.Messages.supportedRoutes.sentbox + '/', { trigger: true } );
</ins><span class="cx" style="display: block; padding: 0 10px"> } ).fail( function( response ) {
</span><span class="cx" style="display: block; padding: 0 10px"> if ( response.feedback ) {
</span><span class="cx" style="display: block; padding: 0 10px"> bp.Nouveau.Messages.displayFeedback( response.feedback, response.type );
</span><span class="lines" style="display: block; padding: 0 10px; color: #888">@@ -1400,15 +1403,29 @@
</span><span class="cx" style="display: block; padding: 0 10px">
</span><span class="cx" style="display: block; padding: 0 10px"> bp.Nouveau.Messages.Router = Backbone.Router.extend( {
</span><span class="cx" style="display: block; padding: 0 10px"> routes: {
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'compose/' : 'composeMessage',
</del><span class="cx" style="display: block; padding: 0 10px"> 'view/:id/' : 'viewMessage',
</span><del style="background-color: #fdd; text-decoration:none; display:block; padding: 0 10px">- 'sentbox/' : 'sentboxView',
- 'starred/' : 'starredView',
- 'inbox/' : 'inboxView',
</del><span class="cx" style="display: block; padding: 0 10px"> '' : 'inboxView',
</span><span class="cx" style="display: block; padding: 0 10px"> '*unSupported': 'unSupported'
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span><span class="cx" style="display: block; padding: 0 10px">
</span><ins style="background-color: #dfd; text-decoration:none; display:block; padding: 0 10px">+ initialize: function() {
+ var self = this;
+
+ _.each( BP_Nouveau.messages.supportedRoutes, function( route, slug ) {
+ self.route( route + '/', slug + 'Route', function() {
+ if ( 'compose' === slug ) {
+ self.composeMessage();
+ } else if ( 'sentbox' === slug ) {
+ self.sentboxView();
+ } else if ( 'starred' === slug ) {
+ self.starredView();
+ } else if ( 'inbox' === slug ) {
+ self.inboxView();
+ }
+ } );
+ } );
+ },
+
</ins><span class="cx" style="display: block; padding: 0 10px"> composeMessage: function() {
</span><span class="cx" style="display: block; padding: 0 10px"> bp.Nouveau.Messages.composeView();
</span><span class="cx" style="display: block; padding: 0 10px"> },
</span></span></pre>
</div>
</div>
</body>
</html>