Skip to content

Commit

Permalink
views: Dependencies no longer actually checked in builder. Closes #171.
Browse files Browse the repository at this point in the history
  • Loading branch information
timwienk committed Nov 12, 2014
1 parent 4fae528 commit a256e97
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
3 changes: 2 additions & 1 deletion views/css/global.styl
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,8 @@ input[type="checkbox"]
position: relative;
width: 1em;
#builderOptions table input[type="checkbox"]
&:checked
&:checked,
&.dependency
background #f4f1ed
&.activeChoice:checked
background #7d8aa5
Expand Down
8 changes: 4 additions & 4 deletions views/js/main.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,29 +106,29 @@ function customBuilderTable(){
var required = [];
checkboxes.each(function(checkbox){
if (checkbox.hasClass('activeChoice')) required.append(getData(checkbox).requires);
else checkbox.checked = false;
else checkbox.removeClass('dependency').set('checked', null);
});
required.each(addDependency);
}

// trigger update of checked modules/dependencies
function updateModules(){
var isWanted = this.checked || this.hasClass('activeChoice');
var isWanted = this.checked || this.hasClass('activeChoice') || this.hasClass('dependency');
var action = isWanted ? addDependency : removeDependency;
var modules = getData(this)[isWanted ? 'requires' : 'provides'];
for (var i = 0; i < modules.length; i++) if (modules[i]) action(modules[i]);
}

function addDependency(code){
if (!providerInput[code]) return;
providerInput[code].checked = true;
providerInput[code].addClass('dependency');
updateModules.call(providerInput[code]);
}

function removeDependency(code){
if (!requireInput[code]) return;
requireInput[code].forEach(function(input){
input.checked = false;
input.removeClass('dependency');
updateModules.call(input);
});
}
Expand Down

0 comments on commit a256e97

Please sign in to comment.