Opened 4 years ago
Closed 4 years ago
#8430 closed defect (bug) (fixed)
Adding a new subnav item in Nouveau messages breaks nouveau js
Reported by: | Venutius | Owned by: | imath |
---|---|---|---|
Milestone: | 8.0.0 | Priority: | normal |
Severity: | normal | Version: | 3.0.0 |
Component: | Templates | Keywords: | has-patch commit |
Cc: |
Description
With Nouveau the provide messages functions changes so that the subnav items - compose, starred etc. load via js.
The problem comes when one wishes to add a new subnav item to the messages screen, if you use the traditional method the js for the other subnav breaks - underscores reporting that 'i' is not defined.
When I say the traditional method, I means as per the following:
class BP_Message_Archive_Component extends BP_Component { function setup_nav($main_nav = array(), $sub_nav = array()) { bp_core_new_subnav_item( array( 'name' => 'Archive', 'slug' => 'archive', 'parent_url' => trailingslashit( $user_domain . 'messages' ), 'parent_slug' => 'messages', 'screen_function' => 'messages_profile_archive', 'position' => 25, 'item_css_id' => 'member-messages-archive' ) ); } function setup_admin_bar() { $wp_admin_nav[] = array( 'parent' => 'my-account-messages', 'id' => 'my-account-messages-archive', 'title' => 'Archive', 'href' => trailingslashit( $item_link ) . 'archive'); parent::setup_admin_bar( $wp_admin_nav ); } } function messages_profile_archive() { add_action( 'bp_template_content', 'messages_profile_archive_screen' ); bp_core_load_template( 'members/single/plugins' ); } function messages_profile_archive_screen() { bp_get_template_part('members/single/profile-messages-archive'); } // The template profile-messages-archive.php simply contains <div><p>Hello</p></div>
This method works fine with BP Legacy, however with Nouveau if you select the messages archive link from the admin bar, it takes you to the correct page, the template message displays and you are placed in the profile>>messages>>archive page. However clicking on any of the other messages subnav items fails, giving a js error as mentioned above.
Is there some secret sauce to preventing this error?
Attachments (1)
Change History (5)
#3
@
4 years ago
- Keywords has-patch commit added
- Version changed from 7.1.0 to 3.0.0
8430.patch is making sure only supported Backbone views are handled in JavaScript. In case of an unknown view like one screen added by a plugin, it simply loads the page location.
Good question, I need to refresh my memory about it. But at the minimum we should provide guidance to do so using JavaScript. I'm going to look at it during 8.0.0. Thanks for reporting this 👍