]> git.uio.no Git - u/erikhf/frm.git/commitdiff
Added some comments to search
authorYrjan A. F. Fraschetti <yrjanaff@MacBook-Pro.local>
Tue, 8 Dec 2015 13:45:20 +0000 (14:45 +0100)
committerYrjan A. F. Fraschetti <yrjanaff@MacBook-Pro.local>
Tue, 8 Dec 2015 13:45:20 +0000 (14:45 +0100)
src/components/search/search.html
src/components/search/search.ts

index d8f2730f648aa0f0ab95e99ddbb226312ab6682d..d8505db7b51cc0398498877159c78a4f85b6804a 100644 (file)
@@ -25,6 +25,7 @@
         </div>
     </form>
 
+    <!-- Searchresult div -->
     <div class="row">
         <span [hidden]="hideDiv()">
             <div class="divresult col-md-10" id="divresult" [hidden]="checkOrgunits()">
@@ -41,6 +42,7 @@
             </div>
         </span>
 
+        <!-- Filter selectors to be filled inn by getUnitGroupSets() -->
         <div id="dropdowndiv" class="btn-group collapse col-md-2">
             <ul id="dropdown-menu" role="menu" class="dropdown-menu meny">
                 <li>Facility</li>
index 38c3482cee2fc1e0944cf1f22e0d5b5a3456646b..5b02829571f5b731950a3db0c0d66dbe32b3f8f6 100644 (file)
@@ -26,8 +26,6 @@ export class Search {
     searchBar: any;
     filterset: boolean = false;
 
-
-
     constructor(public http:Http) {
         this.newsearch = new EventEmitter();
         this.visible = true;
@@ -66,13 +64,14 @@ export class Search {
 
     }
 
-
     emptyByClick(){
         this.orgunits = [];
         return document.getElementById("myForm").reset();
     }
 
+    //Gets all unit group sets (category groups) and the unit groups
     getUnitGroupSets() {
+        //gets unit group sets and display in selector
         this.http.get(dhisAPI + "/api/organisationUnitGroupSets")
             .map(res => res.json())
             .map(res => res.organisationUnitGroupSets)
@@ -83,6 +82,7 @@ export class Search {
                     this.setOptionHeader(this.locationSelector, res[2].name);
 
                     for (var i = 0; i < res.length; i++) {
+                        //gets unit groups for each group set and display in selector
                         this.http.get(res[i].href)
                             .map(result => result.json())
                             .subscribe(
@@ -109,13 +109,15 @@ export class Search {
             )
     }
 
+    //Add group set "header" to selector
     setOptionHeader(selector, value) {
         this.option = document.createElement("option");
-        this.option.text = "All";
+        this.option.text = "Select " + value;
         this.option.value = "";
         selector.appendChild(this.option);
     }
 
+    //Add group to selector
     setOption(selector, value) {
         this.option = document.createElement("option");
         this.option.text = value;
@@ -123,6 +125,7 @@ export class Search {
         selector.appendChild(this.option);
     }
 
+    //Checks the status of orgunits-array and if filter is set
     checkOrgunits() {
         if (this.ownershipSelector.value == "" && this.typeSelector.value == "" && this.locationSelector.value == "") {
             this.filteredOrgunits = [];
@@ -147,7 +150,7 @@ export class Search {
         }
     }
 
-
+    //Filtering the orgunits-array by checking what filter is active
     setFilter() {
         this.filteredOrgunits = [];
         this.filterset = true;