From 04895680772e00b5d15724a5a0ea39995142190d Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Fri, 5 Aug 2016 13:14:20 -0700 Subject: [PATCH 1/5] Strips down code to starter project --- app/pages/gallery/gallery.html | 8 +------- app/pages/gallery/gallery.ts | 29 ++--------------------------- app/pages/home/home.ts | 20 +------------------- 3 files changed, 4 insertions(+), 53 deletions(-) diff --git a/app/pages/gallery/gallery.html b/app/pages/gallery/gallery.html index 598a935..20a33ce 100644 --- a/app/pages/gallery/gallery.html +++ b/app/pages/gallery/gallery.html @@ -14,11 +14,5 @@ - - - - - - - + diff --git a/app/pages/gallery/gallery.ts b/app/pages/gallery/gallery.ts index 12bf429..f8f055b 100644 --- a/app/pages/gallery/gallery.ts +++ b/app/pages/gallery/gallery.ts @@ -1,36 +1,11 @@ import { Component } from '@angular/core'; -import { NavController, NavParams } from 'ionic-angular'; +import { NavController } from 'ionic-angular'; @Component({ templateUrl: 'build/pages/gallery/gallery.html', }) export class GalleryPage { - private images: Array; - private rows: Array>; - - constructor(private _navCtrl: NavController, private _navParams: NavParams) { - this.images = this._navParams.get('images'); - this.rows = Array(Math.ceil(this.images.length/2)); - } - - ionViewLoaded() { - - var rowNum = 0; - - for (var i = 0; i < this.images.length; i+=2) { - this.rows[rowNum] = Array(2); - if (this.images[i]) { - this.rows[rowNum][0] = this.images[i] - } - if (this.images[i+1]) { - this.rows[rowNum][1] = this.images[i+1] - } - - - rowNum++; - } - - } + constructor(private _navCtrl: NavController) {} } \ No newline at end of file diff --git a/app/pages/home/home.ts b/app/pages/home/home.ts index fb138f9..f43e520 100644 --- a/app/pages/home/home.ts +++ b/app/pages/home/home.ts @@ -1,7 +1,5 @@ import {Component} from '@angular/core'; import {NavController} from 'ionic-angular'; -import { ImagePicker } from 'ionic-native'; -import {GalleryPage} from '../gallery/gallery'; @Component({ templateUrl: 'build/pages/home/home.html' @@ -9,23 +7,7 @@ import {GalleryPage} from '../gallery/gallery'; export class HomePage { - constructor(private _navCtrl: NavController) { - - } - - private openGallery (): void { - let options = { - maximumImagesCount: 5, - width: 500, - height: 500, - quality: 75 - } - - ImagePicker.getPictures(options).then( - file_uris => this._navCtrl.push(GalleryPage, {images: file_uris}), - err => console.log('uh oh') - ); - } + constructor(private _navCtrl: NavController) {} } From 3b1a57d6ae63efcd1eb12caefbb02b1a256ddab3 Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Fri, 5 Aug 2016 13:19:35 -0700 Subject: [PATCH 2/5] centers ion-title --- app/pages/home/home.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/pages/home/home.html b/app/pages/home/home.html index ae57040..cd174f5 100644 --- a/app/pages/home/home.html +++ b/app/pages/home/home.html @@ -1,6 +1,6 @@ - + Ionic Gallery From b757994c4ea3e8e5f74c5484b471fa6e76560636 Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Fri, 5 Aug 2016 13:53:33 -0700 Subject: [PATCH 3/5] Removes tap event from starter --- app/pages/home/home.html | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/pages/home/home.html b/app/pages/home/home.html index cd174f5..cbd63cf 100644 --- a/app/pages/home/home.html +++ b/app/pages/home/home.html @@ -8,7 +8,7 @@ From ebdc14150b720ee9445ed62782360744e9bdeec3 Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Tue, 9 Aug 2016 17:31:13 -0700 Subject: [PATCH 4/5] Adds grid template to starter and updates array name to grid for better semantics --- app/pages/gallery/gallery.html | 9 +++++++-- app/pages/gallery/gallery.ts | 10 +++++----- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/app/pages/gallery/gallery.html b/app/pages/gallery/gallery.html index 560ab29..c373ec7 100644 --- a/app/pages/gallery/gallery.html +++ b/app/pages/gallery/gallery.html @@ -6,7 +6,12 @@ - - + + + + + + + diff --git a/app/pages/gallery/gallery.ts b/app/pages/gallery/gallery.ts index 2ec39f2..06fb0e5 100644 --- a/app/pages/gallery/gallery.ts +++ b/app/pages/gallery/gallery.ts @@ -7,11 +7,11 @@ import { NavController, NavParams } from 'ionic-angular'; export class GalleryPage { private images: Array; - private rows: Array>; + private grid: Array>; constructor(private _navCtrl: NavController, private _navParams: NavParams) { this.images = this._navParams.get('images'); - this.rows = Array(Math.ceil(this.images.length/2)); + this.grid = Array(Math.ceil(this.images.length/2)); } ionViewLoaded() { @@ -20,14 +20,14 @@ export class GalleryPage { for (var i = 0; i < this.images.length; i+=2) { - this.rows[rowNum] = Array(2); + this.grid[rowNum] = Array(2); if (this.images[i]) { - this.rows[rowNum][0] = this.images[i] + this.grid[rowNum][0] = this.images[i] } if (this.images[i+1]) { - this.rows[rowNum][1] = this.images[i+1] + this.grid[rowNum][1] = this.images[i+1] } rowNum++; From 85ca625cd2267f9bfc786872219f50b45adf79c0 Mon Sep 17 00:00:00 2001 From: Alex Muramoto Date: Tue, 9 Aug 2016 17:38:00 -0700 Subject: [PATCH 5/5] Changes var to let --- app/pages/gallery/gallery.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/pages/gallery/gallery.ts b/app/pages/gallery/gallery.ts index 06fb0e5..abd63a4 100644 --- a/app/pages/gallery/gallery.ts +++ b/app/pages/gallery/gallery.ts @@ -16,9 +16,9 @@ export class GalleryPage { ionViewLoaded() { - var rowNum = 0; + let rowNum = 0; - for (var i = 0; i < this.images.length; i+=2) { + for (let i = 0; i < this.images.length; i+=2) { this.grid[rowNum] = Array(2);