Skip to content

Instantly share code, notes, and snippets.

@unamashana
Last active January 1, 2016 04:19
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save unamashana/8091134 to your computer and use it in GitHub Desktop.
Save unamashana/8091134 to your computer and use it in GitHub Desktop.
SB.Views.Main = Backbone.View.extend(
...
setupRoutes: ->
@router = new SB.Routers.AgentHome
@router.route ":id", "ticket_open", @openTicket
@router.route "labels/:name", "label_open", @openLabelsListing
@router.route "labels/:name/page:page", "label_open_paginated", @openLabelsListing
@router.route /^\/*$/, "open_default_screen", @openDefaultScreen
@router.route "search/:query", "search", @openSearchListing
@router.route "search/:query/page:page", "search_paginated", @openSearchListing
@router.route ":listingName/page:n", "listing_pagination", @openListingPaginated
openTicket: (ticket_id) ->
ticketView = new SB.Views.TicketView(model: new SB.Models.Ticket(id: ticket_id))
# Render the ticket
@$('.center').html ticketView.el
)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment