diff --git a/app/styles/editor/components/main.sass b/app/styles/editor/components/main.sass index bb8e437d6..5803020a7 100644 --- a/app/styles/editor/components/main.sass +++ b/app/styles/editor/components/main.sass @@ -14,6 +14,9 @@ h3 margin: 5px 0 + .treema-dependent > .treema-row + background-color: #FFC671 + #extant-components-column left: 0 width: 20% diff --git a/app/views/editor/components/main.coffee b/app/views/editor/components/main.coffee index 06337a6c8..aa2b71306 100644 --- a/app/views/editor/components/main.coffee +++ b/app/views/editor/components/main.coffee @@ -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