diff --git a/ionic/components/app/test/weather/current-weather.html b/ionic/components/app/test/weather/current-weather.html index 66441e5425..0360b4072a 100644 --- a/ionic/components/app/test/weather/current-weather.html +++ b/ionic/components/app/test/weather/current-weather.html @@ -1,8 +1,8 @@ -
+
{{current.currently.summary}}
- ° - ° + {{highTemp}}° + {{lowTemp}}°
-

°

+

{{currentTemp}}°

diff --git a/ionic/components/app/test/weather/index.js b/ionic/components/app/test/weather/index.js index 272823c47e..b3e80d0c68 100644 --- a/ionic/components/app/test/weather/index.js +++ b/ionic/components/app/test/weather/index.js @@ -1,9 +1,9 @@ import {Component, Directive} from 'angular2/src/core/annotations_impl/annotations'; import {View} from 'angular2/src/core/annotations_impl/view'; -import {NgIf} from 'angular2/angular2'; +import {NgIf, NgFor, ElementRef} from 'angular2/angular2'; import {FormBuilder, Control, ControlGroup, Validators, formDirectives} from 'angular2/forms'; -import {IonicView, Animation, Modal, NavController, NavParams, IonicComponent} from 'ionic/ionic'; +import {IonicView, Animation, Content, Scroll, Modal, NavController, NavParams, IonicComponent} from 'ionic/ionic'; import {Geo} from './geo'; import {Weather} from './weather'; @@ -15,18 +15,15 @@ console.log('Imported', Geo, Weather, Flickr); selector: 'ion-app', appInjector: [Modal] }) -@IonicView({ +@View({ templateUrl: 'main.html', - directives: [CurrentWeather] + directives: [NgIf, NgFor, Content, Scroll, CurrentWeather] }) class WeatherApp { constructor(Modal: Modal) { this.Modal = Modal; this.currentLocationString = 'Madison, WI'; - this.current = { - local_tz_short: 'CDT' - }; this.activeBgImageIndex = 0; @@ -66,6 +63,18 @@ class WeatherApp { getCurrent(lat, lng, locString) { Weather.getAtLocation(lat, lng).then((resp) => { this.current = resp; + + // TODO: This should be in a custom pipe + for(let i = 0; i < this.current.hourly.data.length; i++) { + let t = this.current.hourly.data[i].temperature; + this.current.hourly.data[i].temperature = Math.floor(t); + } + for(let i = 0; i < this.current.daily.data.length; i++) { + let max = this.current.daily.data[i].temperatureMax; + let min = this.current.daily.data[i].temperatureMin; + this.current.daily.data[i].temperatureMax = Math.floor(max); + this.current.daily.data[i].temperatureMin = Math.floor(min); + } console.log('GOT CURRENT', this.current); }, (error) => { alert('Unable to get current conditions'); @@ -196,7 +205,9 @@ export class CurrentTime { directives: [NgIf] }) export class CurrentWeather { - constructor() { + constructor(elementRef: ElementRef) { + this.elementRef = elementRef; + /* $rootScope.$on('settings.changed', function(settings) { var units = Settings.get('tempUnits'); @@ -220,20 +231,20 @@ export class CurrentWeather { */ // Delay so we are in the DOM and can calculate sizes - /* - $timeout(function() { - var windowHeight = window.innerHeight; - var thisHeight = $element[0].offsetHeight; - var headerHeight = document.querySelector('#header').offsetHeight; - $element[0].style.paddingTop = (windowHeight - (thisHeight)) + 'px'; - angular.element(document.querySelector('.content')).css('-webkit-overflow-scrolling', 'auto'); - $timeout(function() { - angular.element(document.querySelector('.content')).css('-webkit-overflow-scrolling', 'touch'); - }, 50); - }); - */ } + onInit() { + var windowHeight = window.innerHeight; + var thisHeight = this.elementRef.nativeElement.offsetHeight; + var headerHeight = document.querySelector('#header').offsetHeight; + this.elementRef.nativeElement.style.paddingTop = (windowHeight - 250) + 'px'; + /* + document.querySelector('.content')).css('-webkit-overflow-scrolling', 'auto'); + $timeout(function() { + angular.element(document.querySelector('.content')).css('-webkit-overflow-scrolling', 'touch'); + }, 50); + */ + } onAllChangesDone() { var units = 'f';//Settings.get('tempUnits'); @@ -257,18 +268,7 @@ export class CurrentWeather { } } } - /* -.directive('forecast', function($timeout) { - return { - restrict: 'E', - replace: true, - templateUrl: 'templates/forecast.html', - link: function($scope, $element, $attr) { - } - } -}) - .directive('weatherBox', function($timeout) { return { restrict: 'E', diff --git a/ionic/components/app/test/weather/main.html b/ionic/components/app/test/weather/main.html index aa57b70139..99dd1c86a0 100644 --- a/ionic/components/app/test/weather/main.html +++ b/ionic/components/app/test/weather/main.html @@ -12,7 +12,62 @@
- + +
+

Forecast

+ +
+
+
+ +
{{hour.temperature}}°
+
+
+
+
+
+
+
+
+ {{day.temperatureMax}}° + {{day.temperatureMin}}° +
+
+
+
+
+ Powered by forecast.io +
+
+
+
+ + diff --git a/ionic/components/app/test/weather/style.css b/ionic/components/app/test/weather/style.css index 40bf576d32..d7b1a4b6af 100644 --- a/ionic/components/app/test/weather/style.css +++ b/ionic/components/app/test/weather/style.css @@ -100,14 +100,15 @@ h1,h2,h3,h4,h5 { * Current weather */ -#current-weather { +current-weather { + display: block; height: 180px; box-sizing: content-box; } -#current-weather > * { +current-weather > * { color: #fff; } -#current-weather .current-temp { +current-weather .current-temp { font-size: 100px; font-weight: 100; margin: 0; @@ -190,6 +191,7 @@ h1,h2,h3,h4,h5 { #forecast-scroll { margin: 10px 0px; + height: 150px; } #hourly-forecast { width: 2250px; diff --git a/ionic/components/scroll/scroll.scss b/ionic/components/scroll/scroll.scss index 527d97d5c7..88eec07982 100644 --- a/ionic/components/scroll/scroll.scss +++ b/ionic/components/scroll/scroll.scss @@ -1,7 +1,6 @@ ion-scroll { position: relative; display: block; - background-color: $content-background-color; &.scroll-x .scroll-content { overflow-x: auto; } diff --git a/ionic/components/toolbar/extensions/ios.scss b/ionic/components/toolbar/extensions/ios.scss index 16658789d8..724aa1795e 100644 --- a/ionic/components/toolbar/extensions/ios.scss +++ b/ionic/components/toolbar/extensions/ios.scss @@ -19,7 +19,7 @@ $toolbar-ios-button-background-color: transparent !default; $toolbar-ios-padding: 0px 15px; -.platform-ios ion-toolbar { +.mode-ios ion-toolbar { padding: $toolbar-ios-padding; diff --git a/ionic/net/http.js b/ionic/net/http.js index d91cce6f86..0acbfd5d8d 100644 --- a/ionic/net/http.js +++ b/ionic/net/http.js @@ -108,12 +108,10 @@ export class Http { var callbackId = '_' + (callbacks.counter++).toString(36); callbacks[callbackId] = function(data) { - console.log('CALLBACK DATA', data); callbacks[callbackId].data = data; callbacks[callbackId].called = true; }; - console.log('Set up callbacks', callbacks); /* var jsonpDone = jsonpReq(url.replace('JSON_CALLBACK', 'angular.callbacks.' + callbackId),