Merge pull request #642 from gintau/feature_-_select_dependents_(extant_component_treema)

Select dependents when a extant component is selected.
This commit is contained in:
Scott Erickson 2014-03-24 09:31:27 -07:00
commit bf039ed485
2 changed files with 31 additions and 0 deletions

View file

@ -14,6 +14,9 @@
h3
margin: 5px 0
.treema-dependent > .treema-row
background-color: #FFC671
#extant-components-column
left: 0
width: 20%

View file

@ -96,6 +96,34 @@ module.exports = class ThangComponentEditView extends CocoView
@closeExistingView()
@alreadySaving = false
return unless selected.length
# select dependencies.
node = selected[0]
original = node.data.original
toRemoveTreema = []
dependent_class = 'treema-dependent'
try
for index, child of @extantComponentsTreema.childrenTreemas
$(child.$el).removeClass(dependent_class)
for index, child of @extantComponentsTreema.childrenTreemas
if child.data.original == original # Here we assume that the treemas are sorted by their dependency.
break
dep_originals = (d.original for d in child.component.attributes.dependencies)
for dep_original in dep_originals
if original == dep_original
toRemoveTreema.push child
for dep_treema in toRemoveTreema
dep_treema.toggleSelect()
$(dep_treema.$el).addClass(dependent_class)
catch error
console.error error
return unless selected.length
row = selected[0]
@selectedRow = row