This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SB.Views.CurrentView = Backbone.View.extend( | |
... | |
initialize: -> | |
... | |
@screens = [] | |
... | |
set: (view, options) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
openSearchListing: (query, page) -> | |
key = "search/#{query}/#{page}" | |
listing = SB.Utils.getfromCache key, () -> | |
new SB.Views.Listings.Search query: query, page: page | |
@currentView.set listing.screenContent |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SB.Utils.getfromCache = (key, fn) -> | |
object = Backbone.CacheStore.get(key) | |
if !object? | |
object = fn.apply(this) | |
Backbone.CacheStore.set(key, object) | |
object |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Backbone.CacheStore = { | |
get: function(key){ | |
this._store || this.reset(); | |
return this._store[key]; | |
}, | |
set: function(key, object){ | |
this._store || this.reset(); | |
this._store[key] = object; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SB.Views.CurrentView = Backbone.View.extend( | |
SB.Views.CurrentView = Backbone.View.extend( | |
initialize: -> | |
_.bindAll this, "set", "render" | |
@setElement @options.el | |
set: (view, options) -> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SB.Views.Main = Backbone.View.extend( | |
... | |
startApp: -> | |
Backbone.history.start({pushState: true, root: "/tickets"}); | |
... | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SB.Views.Main = Backbone.View.extend( | |
initialize: -> | |
@setElement($("#wrapper")) | |
$(@el).html SB.Utils.renderTemplate("main/template")() | |
@setupRoutes() | |
@startApp() | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!doctype html> | |
<html lang="en"> | |
<head> | |
<meta charset="utf-8"> | |
<title>Kickass App</title> | |
<meta name="description" content="My Kickass App"> | |
<link rel="stylesheet" href="/css/styles.css"> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SB.Views.TicketSummary = Backbone.View.extend( | |
events: | |
"click .name": "openTicket" | |
"click .subject": "openTicket" | |
initialize: -> | |
@model = @options.model | |
_.bindAll this, 'openTicket' | |
$(@el).html SB.Utils.renderTemplate("tickets/summary")(@model.toJSON()) |
NewerOlder