Browse Source

Minor fixes

Unknown 7 years ago
parent
commit
6e70d19353
3 changed files with 31 additions and 19 deletions
  1. 2 2
      canvas/index.php
  2. 28 16
      canvas/js/canvas.js
  3. 1 1
      canvas/json/FwkZHzFZJs.json

+ 2 - 2
canvas/index.php

@@ -59,11 +59,11 @@
                     </div>
                     <div class="col-md-3 ">
                         <label class="project_title">Project Title</label>
-                        <input class="proj_title" name="field_00[]" type="text"/>
+                        <input class="proj_title" name="field_00[]" type="text" />
                     </div>
                     <div class="col-md-3 ">
                         <label class="project_date">Date</label>
-                        <input class="proj_date" name="field_00[]" type="date"/>
+                        <input class="proj_date" name="field_00[]" type="date" />
                     </div>
                     <!-- Log in -->
                     <div class="col-md-3 ">

+ 28 - 16
canvas/js/canvas.js

@@ -542,6 +542,7 @@ $(document).ready(function() {
                     }
                 });
                 
+                // If no tags have been added, reset text explaining so
                 if(tags.length === 0) {
                     $("div.saved-tags p").html("You haven't added any tags yet.");
                 }
@@ -577,6 +578,7 @@ $(document).ready(function() {
         console.log(tags);
         console.log(tags.length);
         
+        // If no tags have been added, reset text explaining so
         if(tags.length === 0) {
             $("div.saved-tags p").html("You haven't added any tags yet.");
         }
@@ -1104,7 +1106,7 @@ $(document).ready(function() {
     ================================================= */
     
     function toggleTextElementOnFocus() {
-        // If the user clicks on the added idea
+        // If the user clicks on the added ideas
         $("li.added_item .expandable").on("click", function() {
             if(tagWindowIsOpen === false) {
                 var li = $(this).parent();
@@ -1164,11 +1166,19 @@ $(document).ready(function() {
                 
                 // Replace textarea with a div
                 $("li.added_item textarea.expandable").on("focusout", function() {
+                    
                     // Declarations
                     var li = $(this).parent();
                     var textElement;
                     var textElementWidth;
                     
+                    // If no tags have been added, reset text explaining so
+                    /*
+                    if(tags.length === 0) {
+                        $("div.saved-tags p").html("You haven't added any tags yet.");
+                    }
+                     */
+                    
                     // Replace textarea with a div
                     $(this).replaceWith(
                         "<div class='expandable' name='" + $(this).attr("name") + "'>" + $(this).val() + "</div>"
@@ -1393,16 +1403,6 @@ $(document).ready(function() {
     Serialize Form to JSON
     ================================================= */
     
-    // ååå
-    
-    /*
-    <li class="added_item">
-        <div class="expandable" name="' + key + '">' + itm + '</div>
-        <br />
-        <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>
-     */
-    
     $.fn.serializeObject = function() {
         // Declarations
         var o = {};
@@ -1473,7 +1473,7 @@ $(document).ready(function() {
     });
     
     /* ================================================
-    When the page loads, Import the chosen canvas if the user has picked one from the dashbord,
+    When the page loads, Import the chosen canvas if the user has picked one from the dashboard,
     otherwise load an empty canvas
     ================================================= */
     
@@ -1530,23 +1530,35 @@ $(document).ready(function() {
                     /*$('form').find('.card').filter('.field_1').find('ul.item_list').append(itemListHTML); */
                     /* !! Empty the item list after each count of "key" so that the previous item lists from the other fields (associated with the previous key) don't get added up to the item list of other fields */
                     itemListHTML = '';
-                    
                 }
             });
-            
         });
         
+        // Limit the text in the idea field if it reaches the max length
+        limitLengthOnInput()
+        
+        // Apply event listener to the added idea handling the application of tags should the user writes one of the terms in it
+        // applyTagOnTypeMatch();
+        
         // Toggle textarea.expandable/div.expandable on edit
-        toggleTextElementOnFocus();
+        window.setTimeout(toggleTextElementOnFocus, 100);
+        
+        // Remove all tags from all fields
+        // removeTags();
         
         // Get the user's tags from the database and apply them on the canvas
         getTags();
         
         // Show "Tag selected term" link
+        /*
         if($(this).parent().parent().parent().prev().prev().children().length > 0) {
             $(this).parent().parent().parent().prev().css("display", "block");
         }
-        
+        if($(this).parent().parent().prev().prev().children().length > 0) {
+            $(this).parent().parent().prev().css("display", "block");
+        }
+         */
+            
         // Fix the heights after importing
         // fixHeights();
     }

+ 1 - 1
canvas/json/2x5zfZgdWu.json → canvas/json/FwkZHzFZJs.json

@@ -1 +1 @@
-{"canvas_id":"2x5zfZgdWu","username":"a.burburan@gmail.com","field_00[]":["Test",""],"new_item":"","share-canvas-email":"","add-collaborator":"Please enter an email address...","field_01[]":["ia1","ia2","ia3"],"field_03[]":"b1","field_04[]":"r1","field_06[]":"gc1","field_10[]":["ui1","ui2"]}
+{"canvas_id":"FwkZHzFZJs","username":"a.burburan@gmail.com","field_00[]":["Test",""],"new_item":"","share-canvas-email":"","add-collaborator":"Please enter an email address...","field_01[]":["ia1","ia2","ia3"],"field_03[]":"b1","field_04[]":"r1","field_06[]":"gc1","field_10[]":["ui1","ui2"]}