Adding operation number to create a unique href for the <a/> tag.

This commit is contained in:
Alberto Pose
2012-11-22 16:40:42 -03:00
parent a1337cf118
commit 75ff471425
3 changed files with 14 additions and 7 deletions

View File

@@ -4,11 +4,18 @@ class ResourceView extends Backbone.View
render: ->
$(@el).html(Handlebars.templates.resource(@model))
@number = 0
# Render each operation
@addOperation operation for operation in @model.operationsArray
@
addOperation: (operation) ->
operation.number = @number
# Render an operation and add it to operations li
operationView = new OperationView({model: operation, tagName: 'li', className: 'endpoint'})
$('.endpoints', $(@el)).append operationView.render().el
$('.endpoints', $(@el)).append operationView.render().el
@number++