|
@@ -844,7 +844,7 @@ $(document).ready(function() {
|
|
|
return false;
|
|
|
}
|
|
|
*/
|
|
|
-
|
|
|
+
|
|
|
/* ================================================
|
|
|
Serialize Form to JSON
|
|
|
================================================= */
|
|
@@ -935,13 +935,13 @@ $(document).ready(function() {
|
|
|
|
|
|
itemListHTML +=
|
|
|
// '<li class="added_item"><span class="handle glyphicon glyphicon-move"></span><textarea maxlength="100" class="expandable" rows="3" data-limit-rows="true" data-autoresize name="' + key + '">' + itm + '</textarea><span class="remove glyphicon glyphicon-remove-circle"></span></li>';
|
|
|
- '<li class="added_item"><span class="handle glyphicon glyphicon-move"></span> <div class="expandable" name="' + key + '" contenteditable="true">' + itm + '</div> <span class="remove glyphicon glyphicon-remove-circle"></span></li>';
|
|
|
+ '<li class="added_item"><div class="expandable" name="' + key + '" contenteditable="true">' + itm + '</div><span class="handle glyphicon glyphicon-list"></span><span class="move-up glyphicon glyphicon-chevron-up"></span><span class="move-down glyphicon glyphicon-chevron-down"></span><span class="remove glyphicon glyphicon-remove-circle"></span></li>';
|
|
|
});
|
|
|
}
|
|
|
else { // a single value string
|
|
|
itemListHTML +=
|
|
|
// '<li class="added_item"><span class="handle glyphicon glyphicon-move"></span><textarea maxlength="100" class="expandable" rows="3" data-limit-rows="true" data-autoresize name="' + key + '">' + value + '</textarea><span class="remove glyphicon glyphicon-remove-circle"></span></li>';
|
|
|
- '<li class="added_item"><span class="handle glyphicon glyphicon-move"></span> <div class="expandable" name="' + key + '" contenteditable="true">' + value + '</div> <span class="remove glyphicon glyphicon-remove-circle"></span></li>';
|
|
|
+ '<li class="added_item"><div class="expandable" name="' + key + '" contenteditable="true">' + value + '</div><span class="handle glyphicon glyphicon-list"></span><span class="move-up glyphicon glyphicon-chevron-up"></span><span class="move-down glyphicon glyphicon-chevron-down"></span><span class="remove glyphicon glyphicon-remove-circle"></span></li>';
|
|
|
}
|
|
|
/* Append the created list items/textatreas to the right field based on the "key"*/
|
|
|
/* the str.substr(start,length)
|
|
@@ -1084,7 +1084,7 @@ $(document).ready(function() {
|
|
|
// The height of the newly added item = the height of the add new idea textarea
|
|
|
$(this).closest('.card').find('ul.item_list').append(
|
|
|
// '<li class="added_item"><span class="handle glyphicon glyphicon-move"></span><textarea maxlength="100" class="expandable" rows="3" data-limit-rows="true" data-autoresize name="' + field_attr + '">' + new_item + '</textarea><span class="remove glyphicon glyphicon-remove-circle"></span></li>'
|
|
|
- '<li class="added_item"><span class="handle glyphicon glyphicon-move"></span> <div class="expandable" name="' + field_attr + '" contenteditable="true">' + new_item + '</div> <span class="remove glyphicon glyphicon-remove-circle"></span></li>'
|
|
|
+ '<li class="added_item"><div class="expandable" name="' + field_attr + '" contenteditable="true">' + new_item + '</div><span class="handle glyphicon glyphicon-list"></span><span class="move-up glyphicon glyphicon-chevron-up"></span><span class="move-down glyphicon glyphicon-chevron-down"></span><span class="remove glyphicon glyphicon-remove-circle"></span></li>'
|
|
|
);
|
|
|
|
|
|
// Fix the heights only after a new item is added
|
|
@@ -1145,7 +1145,7 @@ $(document).ready(function() {
|
|
|
// The height of the newly added item = the height of the add new idea textarea
|
|
|
$(this).closest('.card').find('ul.item_list').append(
|
|
|
// '<li class="added_item"><span class="handle glyphicon glyphicon-move"></span><textarea maxlength="100" class="expandable" rows="3" data-limit-rows="true" data-autoresize name="' + field_attr + '">' + new_item + '</textarea><span class="remove glyphicon glyphicon-remove-circle"></span></li>');
|
|
|
- '<li class="added_item"><span class="handle glyphicon glyphicon-move"></span> <div class="expandable" name="' + field_attr + '" contenteditable="true">' + new_item + '</div> <span class="remove glyphicon glyphicon-remove-circle"></span></li>'
|
|
|
+ '<li class="added_item"><div class="expandable" name="' + field_attr + '" contenteditable="true">' + new_item + '</div><span class="handle glyphicon glyphicon-list"></span><span class="move-up glyphicon glyphicon-chevron-up"></span><span class="move-down glyphicon glyphicon-chevron-down"></span><span class="remove glyphicon glyphicon-remove-circle"></span></li>'
|
|
|
);
|
|
|
// Fix the heights only after a new item is added
|
|
|
// fixHeights();
|
|
@@ -1177,14 +1177,14 @@ $(document).ready(function() {
|
|
|
});
|
|
|
|
|
|
/* ================================================
|
|
|
- Moving items
|
|
|
+ Moving ideas to a different category
|
|
|
================================================= */
|
|
|
|
|
|
// Declarations
|
|
|
// var categoryUl = $("div#move-window ul");
|
|
|
var categoryDestination;
|
|
|
- var categoryOrigin;
|
|
|
var categoryLis = $("div#move-window ul").html();
|
|
|
+ var categoryOrigin;
|
|
|
var ideaLi;
|
|
|
var linkLi;
|
|
|
var linkText;
|
|
@@ -1293,7 +1293,41 @@ $(document).ready(function() {
|
|
|
moveIdeaOnClick();
|
|
|
|
|
|
/* ================================================
|
|
|
- Deleting items
|
|
|
+ Moving ideas up
|
|
|
+ ================================================= */
|
|
|
+
|
|
|
+ // When the user clicks on the "Up" button
|
|
|
+ $('.card').on('click', 'span.move-up', function() {
|
|
|
+ // Declarations
|
|
|
+ var ideaLiCurrent = $(this).parent();
|
|
|
+ var ideaLiPrevious = $(this).parent().prev();
|
|
|
+
|
|
|
+ // Move the idea
|
|
|
+ if(ideaLiPrevious.is("li")) {
|
|
|
+ ideaLiCurrent.detach();
|
|
|
+ ideaLiPrevious.before(ideaLiCurrent);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ /* ================================================
|
|
|
+ Moving ideas down
|
|
|
+ ================================================= */
|
|
|
+
|
|
|
+ // When the user clicks on the "Down" button
|
|
|
+ $('.card').on('click', 'span.move-down', function() {
|
|
|
+ // Declarations
|
|
|
+ var ideaLiCurrent = $(this).parent();
|
|
|
+ var ideaLiNext = $(this).parent().next();
|
|
|
+
|
|
|
+ // Move the idea
|
|
|
+ if(ideaLiNext.is("li")) {
|
|
|
+ ideaLiCurrent.detach();
|
|
|
+ ideaLiNext.after(ideaLiCurrent);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ /* ================================================
|
|
|
+ Deleting ideas
|
|
|
================================================= */
|
|
|
|
|
|
// when the cross beside the textarea is clicked (span.remove)
|
|
@@ -1309,7 +1343,7 @@ $(document).ready(function() {
|
|
|
});
|
|
|
|
|
|
/* ================================================
|
|
|
- Sortable field items
|
|
|
+ Sortable field ideas
|
|
|
================================================= */
|
|
|
|
|
|
// make items sortable in their fields and between fields
|