Refactor DeltaView to use view in template

This commit is contained in:
Scott Erickson 2015-10-26 17:00:52 -07:00
parent c10d11f61b
commit 0869b11f53
2 changed files with 4 additions and 9 deletions

View file

@ -1,4 +1,5 @@
- var i = 0
- var counter = view.constructor.deltaCounter;
mixin deltaPanel(delta, conflict)
- delta.index = i++
@ -41,8 +42,8 @@ mixin deltaPanel(delta, conflict)
+deltaPanel(delta.conflict, true)
.panel-group(id='delta-accordion-'+(counter))
for delta in deltas
for delta in view.expandedDeltas
+deltaPanel(delta)
if !deltas.length
if !view.expandedDeltas.length
alert.alert-warning(data-i18n="delta.no_changes") No changes

View file

@ -71,14 +71,8 @@ module.exports = class DeltaView extends CocoView
if skip then skippedDeltas.push delta else newDeltas.push delta
[newDeltas, skippedDeltas]
getRenderData: ->
c = super()
c.deltas = @expandedDeltas
c.counter = DeltaView.deltaCounter
DeltaView.deltaCounter += @expandedDeltas.length
c
afterRender: ->
DeltaView.deltaCounter += @expandedDeltas.length
deltas = @$el.find('.details')
for delta, i in deltas
deltaEl = $(delta)