]> git.uio.no Git - u/erikhf/frm.git/commitdiff
[pair-programming] final touch
authorErik Haider Forsén <erikhf@ifi.uio.no>
Sun, 6 Dec 2015 18:35:35 +0000 (19:35 +0100)
committerErik Haider Forsén <erikhf@ifi.uio.no>
Sun, 6 Dec 2015 18:35:35 +0000 (19:35 +0100)
src/components/app.html
src/components/app.ts
src/components/map/map.html
src/components/map/map.ts
src/components/search/search.html
src/components/sidebar/sidebar.ts
src/css/map.css

index 874d3bedd9d13d308297941a21063810bc191bbf..f5ace350a28c398e1df75d4eec092bdcf5d228f9 100644 (file)
@@ -1,10 +1,10 @@
 <div>
 
+
     <div class="col-lg-9 col-md-8 col-xs-7"><mou-search (newsearch)="map.update($event)"></mou-search></div>
     <div class="col-lg-3 col-md-4 col-xs-5 no-padding"><mou-sidebar (tempmarker)="map.tempMarker($event)" #sidebar></mou-sidebar></div>
-    <mou-map (newactive)="sidebar.update($event)" (neworg)="sidebar.add($event)"#map></mou-map>
-
 
+    <mou-map (newactive)="sidebar.update($event)" (neworg)="sidebar.add($event)"#map (toplevel)="showtoplevel()"></mou-map>
 </div>
 
 
index 3ddd0fe3e488e69b7ee5f8652fdb95d0839f6e23..8a2bdf696c09f0338fb56f2ef21140082d9f41a3 100644 (file)
@@ -1,5 +1,5 @@
 import {HTTP_PROVIDERS} from 'angular2/http';
-import {Component, View, bootstrap, provide, ELEMENT_PROBE_PROVIDERS} from 'angular2/angular2';
+import {Component, NgZone, NgIf, View, bootstrap, provide, ELEMENT_PROBE_PROVIDERS} from 'angular2/angular2';
 import {Map} from './map/map';
 import {Search} from "./search/search";
 import {Sidebar} from "./sidebar/sidebar";
@@ -11,12 +11,28 @@ declare var System:any;
     {
         selector: 'mou-app',
         templateUrl: './components/app.html',
-        directives:[Map, Search, Sidebar]
+        directives:[Map, Search, Sidebar, NgIf]
     })
 
 
 class App {
+    zone: Zone;
 
+    constructor(zone: NgZone){
+        this.zone = zone;
+    }
+    toplevel: boolean = false;
+
+    showtoplevel(){
+        let instance = this;
+        zone.run(() => {
+            this.setToplevelTrue();
+        });
+    }
+
+    setToplevelTrue(){
+        this.toplevel = true;
+    }
 }
 
 bootstrap(App,[HTTP_PROVIDERS, ELEMENT_PROBE_PROVIDERS]);
index c4d95ad1ec34d5b1cbc8a18730b5ea2f8a374217..f609a2cf350ec4975c86b7dc09fd06e0a77e45cd 100644 (file)
@@ -1,37 +1,28 @@
 <div id="map"></div>
 
+<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
+    <div class="modal-dialog modal-sm" role="document">
+        <div class="modal-content">
 
-<div id="divModal" >
-    <!--- class="modal-dialog modal-sm">-->
-  <!--  <div class="modal-content">-->
+            <div class="modal-body">
+                <button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">&times;</span></button>
 
-  <!--      <div class="modal-header">-->
-            <button type="button" class="close" (click)="closeModal()">&times;</button>
-            <h4 class="modal-title">What do you want ? </h4>
-   <!--     </div>-->
-
-    <!--    <div class="modal-body">-->
-        <div id="topLevel">
-                <button type="button" class="btn btn-default" (click)="seeDetails()">See details</button>
-                <button type="button" class="btn btn-default" (click)="drillDown()">Drill down</button>
-        </div>
-        <div id="middleLevel">
-            <button type="button" class="btn btn-default" (click)="seeDetails()">See details</button>
-            <button type="button" class="btn btn-default" (click)="drillDown()">Drill down</button>
-            <button type="button" class="btn btn-default" (click)="drillUp()">drill up</button>
-        </div>
-        <div id="bottomLevel">
-                <button type="button" class="btn btn-default" (click)="addUnit()">Yes</button>
-                <button type="button" class="btn btn-default" (click)="seeDetails()">See details</button>
-                <button type="button" class="btn btn-default" (click)="drillUp()">Drill up</button>
-        </div>
-    <!--    </div>
-
-        <div class="modal-footer">
-         hei
+                <div id="topLevel">
+                    <button type="button" class="btn btn-default btn-sm" (click)="seeDetails()">See details</button>
+                    <button type="button" class="btn btn-default btn-sm" (click)="drillDown()">Drill down</button>
+                </div>
+                <div id="middleLevel">
+                    <button type="button" class="btn btn-default btn-sm" (click)="seeDetails()">See details</button>
+                    <button type="button" class="btn btn-default btn-sm" (click)="drillDown()">Drill down</button>
+                    <button type="button" class="btn btn-default btn-sm" (click)="drillUp()">drill up</button>
+                </div>
+                <div id="bottomLevel">
+                    <button type="button" class="btn btn-default btn-sm" (click)="addUnit()">Yes</button>
+                    <button type="button" class="btn btn-default btn-sm" (click)="seeDetails()">See details</button>
+                    <button type="button" class="btn btn-default btn-sm" (click)="drillUp()">Drill up</button>
+                </div>
+            </div>
         </div>
--->
-
-
-    <!--</div>-->
+    </div>
 </div>
+
index 57011c7e17a301ad4ae8979aaede2eddddd3b931..5ecab3c10404c053447b42f17c2cba41dbd772f6 100644 (file)
@@ -1,4 +1,4 @@
-import {Component, EventEmitter,CORE_DIRECTIVES,} from 'angular2/angular2';
+import {Component, EventEmitter,CORE_DIRECTIVES, NgIf} from 'angular2/angular2';
 import {Headers, Http} from 'angular2/http';
 
 @Component({
@@ -18,6 +18,7 @@ export class Map {
     allLevels:Object;
     runned:boolean;
     uprunned:boolean;
+    toplevel: boolean = false;
     parent:Object;
     activeId:string;
     currentPos:Object;
@@ -53,10 +54,11 @@ export class Map {
         this.currentMarker = null;
         this.isSearched = false;
         // this.COLORS = {'red','brown',',yellow','green',',pink','purple','gray','black'};
+/*
         this.hideModal = document.getElementById("topLevel").style.visibility = "hidden";
         this.hideModal = document.getElementById("middleLevel").style.visibility = "hidden";
         this.hideModal = document.getElementById("bottomLevel").style.visibility = "hidden";
-        this.hideModal = document.getElementById("divModal").style.display = "none";
+  */
     }
 
     setActiveId(id) {
@@ -210,7 +212,7 @@ export class Map {
                     strokeColor: 'black',
                     scale: 3
                 };
-                instance.map.panTo({lat:unit.geometry.coordinates[1],lng:unit.geometry.coordinates[0]});
+                instance.map.panTo({lat:unit.geometry.coordinates[0],lng:unit.geometry.coordinates[1]});
             }
 
             this.map.data.addGeoJson(unit);
@@ -232,30 +234,33 @@ export class Map {
                 instance.seeDetails();
             }
             this.map.data.addListener('click', function (event) {
+                $('#myModal').modal('show');
+                console.log("blaluaoleua");
                 instance.setActiveId(event.feature.O.id);
                 instance.setcurrentPos(event.latLng);
 
                 if (instance.uprunned == false && instance.LEVEL == 2) {
-                    this.hideModal = document.getElementById("topLevel").style.visibility = "visible";
-                    this.hideModal = document.getElementById("middleLevel").style.visibility = "hidden";
-                    this.hideModal = document.getElementById("bottomLevel").style.visibility = "hidden";
+                    this.hideModal = document.getElementById("topLevel").style.display = "block";
+                    this.hideModal = document.getElementById("middleLevel").style.display = "none";
+                    this.hideModal = document.getElementById("bottomLevel").style.display = "none";
                     instance.showModal();
 
                 }
                 else if (instance.runned == false && instance.LEVEL < instance.allLevels) {
-                    this.hideModal = document.getElementById("topLevel").style.visibility = "hidden";
-                    this.hideModal = document.getElementById("middleLevel").style.visibility = "visible";
-                    this.hideModal = document.getElementById("bottomLevel").style.visibility = "hidden";
+                    this.hideModal = document.getElementById("topLevel").style.display = "none";
+                    this.hideModal = document.getElementById("middleLevel").style.display = "block";
+                    this.hideModal = document.getElementById("bottomLevel").style.display = "none";
                     instance.showModal();
                 } else if (instance.runned == false && instance.LEVEL <= instance.allLevels) {
 
-                    this.hideModal = document.getElementById("topLevel").style.visibility = "hidden";
-                    this.hideModal = document.getElementById("middleLevel").style.visibility = "hidden";
-                    this.hideModal = document.getElementById("bottomLevel").style.visibility = "visible";
+                    this.hideModal = document.getElementById("topLevel").style.display = "none";
+                    this.hideModal = document.getElementById("middleLevel").style.display = "none";
+                    this.hideModal = document.getElementById("bottomLevel").style.display = "block";
 
                     instance.setcurrentPos(event.latLng);
                     instance.showModal();
                 }
+
             });
         }
     }
@@ -407,16 +412,22 @@ export class Map {
     }
 
     showModal() {
-        return this.hideModal = document.getElementById("divModal").style.display = "block";
+        //TODO fix me
+        console.log("trenger vi denne?");
     }
 
     closeModal() {
+        /*
         this.hideModal = document.getElementById("topLevel").style.visibility = "hidden";
         this.hideModal = document.getElementById("middleLevel").style.visibility = "hidden";
         this.hideModal = document.getElementById("bottomLevel").style.visibility = "hidden";
-        this.hideModal = document.getElementById("divModal").style.display = "none";
+        */
+        $("#myModal").modal("hide");
+
 
         this.setRunned(false);
+
+        console.log("trenger vi denne?");
     }
 
 }
index 11264400b931a1748b24b0226304c4d8f7e74c84..89907c4f2b1087ef551878ec2a0f07b852a3bac0 100644 (file)
         </ul>
     </div>
 </span>
-        <div class="row">
-           <span [hidden]="!hideDiv()">
-                <div class="divhelp col-md-8"></div>
-           </span>
-
 
 
 <div id="dropdowndiv" class="btn-group collapse col-md-2">
index f3bf2a09e2b8411b3acc11770e8cafbd3b4af2d9..d2d8dcdee320ff85b0e99aa29a9b6296ed8bc7d4 100644 (file)
@@ -78,7 +78,7 @@ export class Sidebar {
     exitButton: any;
     featureType: Control = new Control("");
     coordinates: Control = new Control("");
-    ctrlGroups: Control[]= [new Control('')];
+    ctrlGroups: Array<Control> = [new Control('')];
     groupsArray: ControlArray = new ControlArray(this.ctrlGroups);
 
 
@@ -281,7 +281,7 @@ export class Sidebar {
     }
 
     addOrgUnitSets(instance, res){
-        instance.ctrlArray.removeAt(0);
+        //delete instance.ctrlGroups[0];
         for( group in res){
             console.log(instance.form.controls);
             instance.groupsArray.push(new Control(''));
index 70fabfa74536d17be859b89f586d7063b4ad32d0..c2ef61e9f42fcc0571e192d1409a6af790ca492d 100644 (file)
@@ -120,7 +120,8 @@ html, body {
 
 .result{
     opacity: 0.8;
-    height: 25vh;
+    max-height: 70vh;
+    min-height: 8vh;
     overflow: scroll;
     position: relative;
     z-index: 1;
@@ -238,15 +239,6 @@ html, body {
     color: white;
 }
 
-/* modal */
-
-#divModal{
-    position: relative;
-    margin-top: 0;
-    width: 20%;
-    background: red;
-    overflow: hidden;
-}
 
 /* other */