Event Reference - B3ST/B3 GitHub Wiki
View Events
ArchiveView
archive:view:display:post
Triggered when a post is selected. The event will send an object containing:
slug- the slug of the post;post- the Post model corresponding to the clicked post in the collection.
archive:view:display:category
Triggered when a category is clicked. The event will send an object containing:
id- the id of the category;slug- the slug of the category;type- always set to "category".
archive:view:display:tag
Triggered when a tag is clicked. The event will send an object containing:
id- the id of the tag;slug- the slug of the tag;type- always set to "post_tag".
archive:view:display:author
Triggered when an author is clicked. The event will send an object containing:
id- the id of the author;slug- the slug of the author;type- always set to "author".
archive:view:display:taxonomy
Triggered when a taxonomy is clicked. The event will send an object containing:
href- the link of the clicked taxonomy.
archive:view:link:clicked
Triggered when a link is clicked. The event will send an object containing:
href- the link of the clicked link.
SingleView
single:view:display:author
Triggered when an author is clicked. The event will send an object containing:
slug- the slug of the author;type- always set to "author".
single:view:display:category
Triggered when an category is clicked. The event will send an object containing:
slug- the slug of the category;type- always set to "category".
single:view:display:post_tag
Triggered when an tag is clicked. The event will send an object containing:
slug- the slug of the tag;type- always set to "post_tag".
single:view:display:taxonomy
Triggered when a taxonomy is clicked. The event will send an object containing:
href- the link of the taxonomy.
single:view:link:clicked
Triggered when a link is clicked. The event will send an object containing:
href- the link of the clicked link.
PaginationView
pagination:view:display:next:page
Triggered when the next button is clicked. The event will send an object containing:
page- the number of the next page.
pagination:view:display:page
Triggered when a given page is clicked. The event will send an object containing:
page- the number of the page that was clicked.
pagination:view:display:previous:page
Triggered when the previous button is clicked. The event will send an object containing:
page- the number of the previous page.
ReplyFormView
replyform:view:cancel
Triggered when the cancel button is clicked. The event will not send any data.
replyform:view:reply
Triggered when a reply is posted. The event will send an object containing:
content- the content of the reply;post- the reply's post;parent_comment- the ID of reply at which the posted comment is replying (if any);author- a User model containing the data of the reply's author.
SearchView
search:view:search:empty
Triggered when the search box is empty. The event will not send any data.
search:view:search:submit
Triggered when a submit event is made by the user. The event will send an object containing:
search- the keywords of the search box.
search:view:search:term
Triggered when the user starts typing on the search box. The event will send an object containing:
search- the search terms written on the search box.
SidebarView
sidebar:view:link
Triggered when the a link is clicked. The event will send an object containing:
link- the link of the clicked link.
HeaderView
header:view:index
Triggered when the header is clicked. It will send an object containing
id- set to -1. This is merely informative for theMenuItemViewto deselect any selected resource.
MenuItemView
menu-item:view:navigate
Triggered when a link is clicked. It will send an object containing:
link- the link of the clicked resource.
menu-item:view:select
Triggered when a link is clicked. It will send an object containing:
id- the ID of the clicked resource;parent- indicates the ID of the parent of the clicked resource.
Controller Events
archive:show
Triggered by the HomeAPI or the SingleController when the page_on_front is set to the post archive. The event will send an object containing:
paged- the number of the page to display.
single:show
Triggered by the HomeAPI when the page_on_front is set to a given post or page. It will send an object containing:
id- the id of the page or post.
PaginationController
pagination:next:page
Triggered when the next button is clicked. It will send an object equal to the one sent by PaginationView.
pagination:previous:page
Triggered when the previous button is clicked. It will send an object equal to the one sent by PaginationView.
pagination:select:page
Triggered when a page is clicked. It will send an object equal to the one sent by PaginationView.
ReplyFormController
comment:create
Triggered when a comment is successfully posted. The event will send a Comment model.
replyform:cancel
Triggered when a user clicks in the cancel button. The event will send an object containing:
id- if the reply form is displayed to reply to a post, this will be 0. If the reply form is displayed to reply to another reply, this will contain the ID of that reply.
Miscellaneous
Loading resources
The following events will only be triggered when used alongside the BaseController and LoadingController mechanism. None of them return any results, as the results are used in the callbacks provided by the Controller that began the process.
fetch:start
Indicates when a fetch is starting.
fetch:done
Indicates when a fetch is successful.
fetch:fail
Indicates when a fetch fails.
save:start
Indicates when a save is starting.
save:done
Indicates when a save is successful.
save:fail
Indicates when a save fails.
Other
router:nav
Indicates that there will be a navigation (changing browser page content). The event will send an object containing:
route- the route to which the navigation will go;options- an object containing:trigger- true or false, indicating if Backbone will trigger the route (automatic navigation) or not.
title:change
Indicates that the title will change. It will send a string with the new title.