|
@@ -468,7 +468,7 @@ $(document).ready(function() {
|
|
$("div#tag-window").css("display", "none");
|
|
$("div#tag-window").css("display", "none");
|
|
}
|
|
}
|
|
|
|
|
|
- // When the user clicks outside the textarea
|
|
|
|
|
|
+ // Show the tag window
|
|
function showTagWindow() {
|
|
function showTagWindow() {
|
|
// Show the tag window
|
|
// Show the tag window
|
|
$("div#shadow").css("display", "block");
|
|
$("div#shadow").css("display", "block");
|
|
@@ -544,8 +544,8 @@ $(document).ready(function() {
|
|
tagIsNew = false;
|
|
tagIsNew = false;
|
|
});
|
|
});
|
|
|
|
|
|
- // When the user clicks on the Close button
|
|
|
|
- $("div#tag-window button[aria-label='Close']").on("click", function() {
|
|
|
|
|
|
+ // When the user clicks on the "Close" button
|
|
|
|
+ $("div#tag-window button.close").on("click", function() {
|
|
// Close the tag window
|
|
// Close the tag window
|
|
closeTagWindow();
|
|
closeTagWindow();
|
|
});
|
|
});
|
|
@@ -965,7 +965,9 @@ $(document).ready(function() {
|
|
getTags();
|
|
getTags();
|
|
|
|
|
|
// Show "Tag selected term" link
|
|
// Show "Tag selected term" link
|
|
- $(this).parent().parent().parent().prev().css("display", "block");
|
|
|
|
|
|
+ if($(this).parent().parent().parent().prev().prev().children().length > 0) {
|
|
|
|
+ $(this).parent().parent().parent().prev().css("display", "block");
|
|
|
|
+ }
|
|
|
|
|
|
// Fix the heights after importing
|
|
// Fix the heights after importing
|
|
// fixHeights();
|
|
// fixHeights();
|
|
@@ -1108,7 +1110,9 @@ $(document).ready(function() {
|
|
getTags(); // Really necessary?
|
|
getTags(); // Really necessary?
|
|
|
|
|
|
// Show "Tag selected term" link
|
|
// Show "Tag selected term" link
|
|
- $(this).parent().parent().prev().css("display", "block");
|
|
|
|
|
|
+ if($(this).parent().parent().prev().prev().children().length > 0) {
|
|
|
|
+ $(this).parent().parent().prev().css("display", "block");
|
|
|
|
+ }
|
|
});
|
|
});
|
|
|
|
|
|
/* ----------------------------------------------
|
|
/* ----------------------------------------------
|
|
@@ -1166,10 +1170,128 @@ $(document).ready(function() {
|
|
getTags(); // Really necessary?
|
|
getTags(); // Really necessary?
|
|
|
|
|
|
// Show "Tag selected term" link
|
|
// Show "Tag selected term" link
|
|
- $(this).parent().parent().parent().prev().css("display", "block");
|
|
|
|
|
|
+ if($(this).parent().parent().parent().prev().prev().children().length > 0) {
|
|
|
|
+ $(this).parent().parent().parent().prev().css("display", "block");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ /* ================================================
|
|
|
|
+ Moving items
|
|
|
|
+ ================================================= */
|
|
|
|
+
|
|
|
|
+ // Declarations
|
|
|
|
+ // var categoryUl = $("div#move-window ul");
|
|
|
|
+ var categoryDestination;
|
|
|
|
+ var categoryOrigin;
|
|
|
|
+ var categoryLis = $("div#move-window ul").html();
|
|
|
|
+ var ideaLi;
|
|
|
|
+ var linkLi;
|
|
|
|
+ var linkText;
|
|
|
|
+
|
|
|
|
+ // Remove the link to the current category, as the idea cannot be moved to its own category where it already is
|
|
|
|
+ function removeLinkToOriginCategory(text) {
|
|
|
|
+ // If the number of the category is between 10-99
|
|
|
|
+ if(text.substring(6, 7) != "0") {
|
|
|
|
+ categoryOrigin = text.substring(6, 9) - 1;
|
|
}
|
|
}
|
|
|
|
+ // If the number of the category is between 0-9
|
|
|
|
+ else {
|
|
|
|
+ categoryOrigin = text.substring(7, 9) - 1;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Remove "a" tag
|
|
|
|
+ linkLi = $("div#move-window ul li").get(categoryOrigin);
|
|
|
|
+ linkText = $("div#move-window ul a").get(categoryOrigin).innerHTML;
|
|
|
|
+ linkLi.innerHTML = linkText;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // When the user clicks on the "Move" icon, show the move window
|
|
|
|
+ $('.card').on('click', 'span.handle', function() {
|
|
|
|
+ // Show the move window
|
|
|
|
+ $("div#shadow").css("display", "block");
|
|
|
|
+ $("div#move-window").css("display", "block");
|
|
|
|
+
|
|
|
|
+ // Assign the idea that is going to be moved
|
|
|
|
+ ideaLi = $(this).parent();
|
|
|
|
+
|
|
|
|
+ // Remove the link to the current category, as the idea cannot be moved to its own category where it already is
|
|
|
|
+ removeLinkToOriginCategory($(this).parent().parent().attr("id"));
|
|
|
|
+ });
|
|
|
|
+
|
|
|
|
+ // Close the move window
|
|
|
|
+ function closeMoveWindow() {
|
|
|
|
+ // Close the move window
|
|
|
|
+ $("div#shadow").css("display", "none");
|
|
|
|
+ $("div#move-window").css("display", "none");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // When the user clicks on the "Close" button
|
|
|
|
+ $("div#move-window button.close").on("click", function() {
|
|
|
|
+ // Close the move window
|
|
|
|
+ closeMoveWindow();
|
|
});
|
|
});
|
|
|
|
|
|
|
|
+ // When the user clicks on a category, move the idea
|
|
|
|
+ function moveIdeaOnClick() {
|
|
|
|
+ $("div#move-window ul a").on("click", function() {
|
|
|
|
+ // If the number of the category is between 10-99
|
|
|
|
+ if($(this).parent().text().trim().substring(1, 2) != ".") {
|
|
|
|
+ categoryDestination = $(this).parent().text().trim().substring(0, 2);
|
|
|
|
+ }
|
|
|
|
+ // If the number of the category is between 0-9
|
|
|
|
+ else {
|
|
|
|
+ categoryDestination = $(this).parent().text().trim().substring(0, 1);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Move the idea
|
|
|
|
+ // If the number of the category is between 10-99
|
|
|
|
+ if(categoryDestination > 9) {
|
|
|
|
+ $("ul#field_" + categoryDestination).append(ideaLi);
|
|
|
|
+ // $("ul#field_0" + (categoryOrigin + 1)).parent().find("p.tag-selected-term").css("display", "none");
|
|
|
|
+ }
|
|
|
|
+ // If the number of the category is between 0-9
|
|
|
|
+ else {
|
|
|
|
+ $("ul#field_0" + categoryDestination).append(ideaLi);
|
|
|
|
+ // $("ul#field_0" + (categoryOrigin + 1)).parent().find("p.tag-selected-term").css("display", "none");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Close the move window
|
|
|
|
+ closeMoveWindow();
|
|
|
|
+
|
|
|
|
+ // Restore links in the move window
|
|
|
|
+ if($("div#move-window li").length > $("div#move-window a").length) {
|
|
|
|
+ $("div#move-window ul").children().remove()
|
|
|
|
+ $("div#move-window ul").append(categoryLis);
|
|
|
|
+ moveIdeaOnClick();
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Hide "Tag selected term" link in the origin category if there are no ideas left
|
|
|
|
+ if($("ul#field_0" + (categoryOrigin + 1)).children().length === 0) {
|
|
|
|
+ // If the number of the category is between 10-99
|
|
|
|
+ if((categoryOrigin + 1) > 9) {
|
|
|
|
+ $("ul#field_" + (categoryOrigin + 1)).parent().find("p.tag-selected-term").css("display", "none");
|
|
|
|
+ }
|
|
|
|
+ // If the number of the category is between 0-9
|
|
|
|
+ else {
|
|
|
|
+ $("ul#field_0" + (categoryOrigin + 1)).parent().find("p.tag-selected-term").css("display", "none");
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // Show "Tag selected term" link in the destination category
|
|
|
|
+ // If the number of the category is between 10-99
|
|
|
|
+ if((categoryOrigin + 1) > 9) {
|
|
|
|
+ $("ul#field_" + categoryDestination).parent().find("p.tag-selected-term").css("display", "block");
|
|
|
|
+ }
|
|
|
|
+ // If the number of the category is between 0-9
|
|
|
|
+ else {
|
|
|
|
+ $("ul#field_0" + categoryDestination).parent().find("p.tag-selected-term").css("display", "block");
|
|
|
|
+ }
|
|
|
|
+ });
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ moveIdeaOnClick();
|
|
|
|
+
|
|
/* ================================================
|
|
/* ================================================
|
|
Deleting items
|
|
Deleting items
|
|
================================================= */
|
|
================================================= */
|
|
@@ -1177,8 +1299,12 @@ $(document).ready(function() {
|
|
// when the cross beside the textarea is clicked (span.remove)
|
|
// when the cross beside the textarea is clicked (span.remove)
|
|
// remove that list item
|
|
// remove that list item
|
|
$('.card').on('click', 'span.remove', function() {
|
|
$('.card').on('click', 'span.remove', function() {
|
|
- $(this).prev().parent().parent().next().css("display", "none");
|
|
|
|
|
|
+ // If there are no ideas left, hide "Tag selected term" link
|
|
|
|
+ if($(this).prev().parent().parent().children().length === 1) {
|
|
|
|
+ $(this).prev().parent().parent().next().css("display", "none");
|
|
|
|
+ }
|
|
|
|
|
|
|
|
+ // Remove the list item
|
|
$(this).closest('li').remove();
|
|
$(this).closest('li').remove();
|
|
});
|
|
});
|
|
|
|
|