This file contains hidden or 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()) |
This file contains hidden or 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.TicketView = Backbone.View.extend( | |
... | |
renderNewReplyBox: -> | |
@new_reply_box = new SB.Views.NewReply(reply_list: @reply_list) | |
@$(".new_reply").html @new_reply_box.render().el | |
... |
This file contains hidden or 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.Collections.ReplyList = Backbone.Collection.extend( | |
model: SB.Models.Reply | |
ticket_id: null | |
name: "replies" | |
initialize: (models, options) -> | |
@ticket = options.ticket | |
url: -> |
This file contains hidden or 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.Models.Reply = SB.Models.Post.extend( | |
name: "reply" | |
) |
This file contains hidden or 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.Ticket = Backbone.View.extend( | |
initialize: -> | |
@model = @options.model | |
$(@el).html SB.Utils.renderTemplate('tickets/template')(@model.toJSON()) | |
@buildView() | |
buildView: -> | |
@renderReplies() | |
@renderNewReplyBox() |
This file contains hidden or 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
view = new SB.Views.TicketList() | |
$('body').append view.el |