Skip to content

Commit

Permalink
Revert "Merge pull request #344 from chinhseah/Empty-Framework-Bug"
Browse files Browse the repository at this point in the history
This reverts commit 0ced981.
  • Loading branch information
miledivovic authored and Lomilar committed Jul 25, 2018
1 parent b641add commit dc7c07e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 55 deletions.
29 changes: 5 additions & 24 deletions js/cass/cass-editor.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

41 changes: 10 additions & 31 deletions js/viewFramework.js
Original file line number Diff line number Diff line change
Expand Up @@ -156,10 +156,8 @@ populateFramework = function (subsearch) {
framework.level = [];
var fun = function (success) {
if (framework.competency.length == 0) {
if ($("#tree").html() == "") {
if ($("#tree").html() == "")
$("#tree").html("<br><br><center><h3>This framework is empty.</h3></center>");
$("#tree").show();
}
showPage("#editFrameworkSection", framework);
} else {
me.fetches += framework.competency.length;
Expand Down Expand Up @@ -277,35 +275,16 @@ function refreshCompetency(col, level, subsearch) {
if (relation.relationType == "narrows") {
var source = EcCompetency.getBlocking(relation.source);
var target = EcCompetency.getBlocking(relation.target);
if (source != null && target != null) {
if (source != null && target != null)
if ($(".competency[relationid=\"" + relation.shortId() + "\"]").length == 0) {
// if source & target competency exists...
if ($(".competency[id=\"" + target.shortId() + "\"]").length &&
$(".competency[id=\"" + source.shortId() + "\"]").length) {
$(".competency[id=\"" + target.shortId() + "\"]").children().last().append($(".competency[id=\"" + source.shortId() + "\"]").outerHTML()).children().last().attr("relationid", relation.shortId());
// if source & target both are at top of tree, remove source
if ($("#tree > .competency[id=\"" + target.shortId() + "\"]").length &&
$("#tree > .competency[id=\"" + source.shortId() + "\"]").length) {
$("#tree > .competency[id=\"" + source.shortId() + "\"]").remove();
}
if (!$(".competency[id=\"" + target.shortId() + "\"]").hasClass("expandable"))
$(".competency[id=\"" + target.shortId() + "\"]").addClass("expandable").children(".collapse").css("visibility", "visible");
} else {
if (!$(".competency[id=\"" + target.shortId() + "\"]").length)
console.error("Cannot set up relation "+ relation.shortId() + " target "+target.shortId()+ " not found!");
if (!$(".competency[id=\"" + source.shortId() + "\"]").length)
console.error("Cannot set up relation "+ relation.shortId() + " source "+source.shortId()+ " not found!");
}
} else {
console.warn("Relation "+ relation.shortId() + " already exists in another competency.");
}// end if relation not set up
} else {
if (!source)
console.error("Relation source is unavailable!");
if (!target)
console.error("Relation target is unavailable!");
}//end if source & target
} // relation type is narrows
$(".competency[id=\"" + target.shortId() + "\"]").children().last().append($(".competency[id=\"" + source.shortId() + "\"]").outerHTML()).children().last().attr("relationid", relation.shortId());
if ($(".competency[id=\"" + target.shortId() + "\"]").length > 0)
$("#tree>.competency[id=\"" + source.shortId() + "\"]").remove();

if ($(".competency[id=\"" + source.shortId() + "\"]").length && !$(".competency[id=\"" + target.shortId() + "\"]").hasClass("expandable"))
$(".competency[id=\"" + target.shortId() + "\"]").addClass("expandable").children(".collapse").css("visibility", "visible");
}
}
}
if (me.fetches == 0) {
if ($("#tree").html() == "")
Expand Down

0 comments on commit dc7c07e

Please sign in to comment.