Cleanup of code in search
authorYrjan A. F. Fraschetti <yrjanaff@MacBook-Pro.local>
Tue, 8 Dec 2015 13:29:05 +0000 (14:29 +0100)
committerYrjan A. F. Fraschetti <yrjanaff@MacBook-Pro.local>
Tue, 8 Dec 2015 13:29:05 +0000 (14:29 +0100)
src/components/search/search.html
src/components/search/search.ts

index dcec25f..d8f2730 100644 (file)
                     onfocus="this.placeholder = ''"
                     value=""/>
 
-
-
-
-
             <button type="button" class="knapp col-md-2" (click)="toggle()"
                     data-toggle="collapse" data-target="#dropdown-menu">
                 {{ visible ? '&xdtri;' : '&cross;' }}
     </form>
 
     <div class="row">
-<span [hidden]="hideDiv()">
-    <div class="divresult col-md-10" id="divresult" [hidden]="checkOrgunits()">
-        <ul class="dropdown-menu result">
-            <li><button type="button" class="btn btn-default emptyresult" (click)="emptyByClick()">
-                <span class="glyphicon glyphicon-remove"></span></button></li>
-            <li *ng-for="#orgunit of filteredOrgunits" id="orglist" (click)="getMoreInfo(orgunit)">
-                <a id="left-menu" href="#">{{orgunit.name}}</a>
-            </li>
-            <li *ng-if="filteredOrgunits.length == 0">
-              <p class="nomatch">  No matching results </p>
-            </li>
-        </ul>
-    </div>
-</span>
-
-
-<div id="dropdowndiv" class="btn-group collapse col-md-2">
-
-    <ul id="dropdown-menu" role="menu" class="dropdown-menu meny">
-        <li>Facility</li>
-        <li class="dropdown-header">Ownership</li>
-        <li>
-            <select class="form-control filtervalg" id="ownershipSelector" (click)="setFilter()"></select>
-        </li>
-        <li class="dropdown-header">Type</li>
-        <li>
-            <select class="form-control filtervalg" id="typeSelector" (click)="setFilter()"></select>
-        </li>
-        <li class="divider"></li>
-        <li>Location</li>
-        <li class="dropdown-header">Rural/Urban</li>
-
-        <li>
-            <select class="form-control filtervalg" id="locationSelector" (click)="setFilter()"></select>
-        </li>
-    </ul>
-
-</div>
-
+        <span [hidden]="hideDiv()">
+            <div class="divresult col-md-10" id="divresult" [hidden]="checkOrgunits()">
+                <ul class="dropdown-menu result">
+                    <li><button type="button" class="btn btn-default emptyresult" (click)="emptyByClick()">
+                        <span class="glyphicon glyphicon-remove"></span></button></li>
+                    <li *ng-for="#orgunit of filteredOrgunits" id="orglist" (click)="getMoreInfo(orgunit)">
+                        <a id="left-menu" href="#">{{orgunit.name}}</a>
+                    </li>
+                    <li *ng-if="filteredOrgunits.length == 0">
+                        <p class="nomatch">  No matching results </p>
+                    </li>
+                </ul>
+            </div>
+        </span>
+
+        <div id="dropdowndiv" class="btn-group collapse col-md-2">
+            <ul id="dropdown-menu" role="menu" class="dropdown-menu meny">
+                <li>Facility</li>
+                <li class="dropdown-header">Ownership</li>
+                <li>
+                    <select class="form-control filtervalg" id="ownershipSelector" (click)="setFilter()"></select>
+                </li>
+                <li class="dropdown-header">Type</li>
+                <li>
+                    <select class="form-control filtervalg" id="typeSelector" (click)="setFilter()"></select>
+                </li>
+                <li class="divider"></li>
+                <li>Location</li>
+                <li class="dropdown-header">Rural/Urban</li>
+                <li>
+                    <select class="form-control filtervalg" id="locationSelector" (click)="setFilter()"></select>
+                </li>
+            </ul>
         </div>
-
-</div>
-
-
-
+    </div>
 </div>
 
index 0439957..38c3482 100644 (file)
@@ -25,20 +25,17 @@ export class Search {
     option: any;
     searchBar: any;
     filterset: boolean = false;
-    emptySearch: any;
+
 
 
     constructor(public http:Http) {
         this.newsearch = new EventEmitter();
         this.visible = true;
-        this.emptySearch = document.getElementById("divresult");
         this.getUnitGroupSets();
         this.ownershipSelector = document.getElementById("ownershipSelector");
         this.typeSelector = document.getElementById("typeSelector");
         this.locationSelector = document.getElementById("locationSelector");
         this.searchBar = document.getElementById("livesearch");
-        this.orglist = document.getElementById("orglist");
-        this.a = document.getElementById("testunit");
     }
 
     getMoreInfo(orgunit) {
@@ -49,7 +46,6 @@ export class Search {
     }
 
     //pil opp og ned
-
     toggle() {
         this.visible = !this.visible;
         if (this.visible) {
@@ -146,7 +142,6 @@ export class Search {
         if(this.filteredOrgunits.length == 0){
             return false;
         }
-
         else{
             return !this.orgunits.length;
         }
@@ -155,7 +150,6 @@ export class Search {
 
     setFilter() {
         this.filteredOrgunits = [];
-        console.log("orgunits.length: " + this.orgunits.length);
         this.filterset = true;
         for (var i = 0; i < this.orgunits.length; i++) {
             this.http.get(this.orgunits[i].href)
@@ -199,7 +193,6 @@ export class Search {
                                     os = false;
                                     ts = false;
                                     ls = false;
-
                                 }
                             }
                         }