Przeglądaj źródła

Added search filters to "Learning Objectives and Criteria" and "Learning Outcomes and Criteria"

onielm 4 lat temu
rodzic
commit
7a1294c83f

+ 26
- 1
app/views/global/view-learning-outcomes-criteria.blade.php Wyświetl plik

@@ -13,10 +13,35 @@
13 13
 @stop
14 14
 
15 15
 @section('main')
16
+  {{-- TODO: look where to place this script.
17
+          if placed inside .ready() or before it,
18
+            an error that the function is not defined occurs. --}}
19
+  {{-- TODO: no reconoce acentos --}}
20
+  <script type="text/javascript">
21
+  function filterOutcomes() {
22
+    // Declare variables
23
+    var input, filter, div, li, i, outcomeText;
24
+    input = document.getElementById('userInput');
25
+    filter = input.value.toUpperCase();
26
+    div = document.getElementById("list");
27
+    li = div.getElementsByTagName('li');
28
+
29
+    // Loop through all list items, and hide those who don't match the search query
30
+    for (i = 0; i < li.length; i++) {
31
+      outcomeText = li[i].textContent;
32
+      if (outcomeText.toUpperCase().indexOf(filter) > -1) {
33
+        li[i].style.display = "";
34
+      } else {
35
+        li[i].style.display = "none";
36
+      }
37
+    }
38
+  }
39
+  </script>
16 40
 
17 41
   <div class="row">
18 42
     <div class="col-md-3">
19
-      <div class="list-group">
43
+      <input class="form-control" type="text" id="userInput" onkeyup="filterOutcomes()" placeholder="Search for Learning Outcomes..">
44
+      <div class="list-group" id='list'>
20 45
         @foreach ($outcomes as $outcome)
21 46
           @foreach ($semesters as $semester)
22 47
             @if(!$outcome->deleted_at && $outcome->activation_date >= $semester->start && $outcome->activation_date <= $semester->end)

+ 26
- 1
app/views/global/view-objectives-criteria.blade.php Wyświetl plik

@@ -13,10 +13,35 @@
13 13
 @stop
14 14
 
15 15
 @section('main')
16
+  {{-- TODO: look where to place this script.
17
+          if placed inside .ready() or before it,
18
+            an error that the function is not defined occurs. --}}
19
+  {{-- TODO: no reconoce acentos --}}
20
+  <script type="text/javascript">
21
+  function filterObjectives() {
22
+    // Declare variables
23
+    var input, filter, div, li, i, objectiveText;
24
+    input = document.getElementById('userInput');
25
+    filter = input.value.toUpperCase();
26
+    div = document.getElementById("list");
27
+    li = div.getElementsByTagName('li');
28
+
29
+    // Loop through all list items, and hide those who don't match the search query
30
+    for (i = 0; i < li.length; i++) {
31
+      objectiveText = li[i].textContent;
32
+      if (objectiveText.toUpperCase().indexOf(filter) > -1) {
33
+        li[i].style.display = "";
34
+      } else {
35
+        li[i].style.display = "none";
36
+      }
37
+    }
38
+  }
39
+  </script>
16 40
 
17 41
   <div class="row">
18 42
     <div class="col-md-3">
19
-      <div class="list-group">
43
+      <input class="form-control" type="text" id="userInput" onkeyup="filterObjectives()" placeholder="Search for Learning Outcomes..">
44
+      <div class="list-group" id='list'>
20 45
         @foreach ($objectives as $objective)
21 46
           <li data-objective-id="{{ $objective->id }}"class="list-group-item">{{ $objective->text }}</li>
22 47
         @endforeach