Browse Source

added popover

Rachelle 6 years ago
parent
commit
ecd8fa64dc

+ 3
- 5
.idea/workspace.xml View File

@@ -1,9 +1,7 @@
1 1
 <?xml version="1.0" encoding="UTF-8"?>
2 2
 <project version="4">
3 3
   <component name="ChangeListManager">
4
-    <list default="true" id="e7490434-64fb-4385-9a0e-a04ccfae4c30" name="Default" comment="">
5
-      <change beforePath="$PROJECT_DIR$/MyPassionProjectClient/src/pages/friends/friends.html" beforeDir="false" afterPath="$PROJECT_DIR$/MyPassionProjectClient/src/pages/friends/friends.html" afterDir="false" />
6
-    </list>
4
+    <list default="true" id="e7490434-64fb-4385-9a0e-a04ccfae4c30" name="Default" comment="" />
7 5
     <ignored path="$PROJECT_DIR$/target/" />
8 6
     <option name="EXCLUDED_CONVERTED_TO_IGNORED" value="true" />
9 7
     <option name="TRACKING_ENABLED" value="true" />
@@ -330,12 +328,12 @@
330 328
       <workItem from="1532732570325" duration="2999000" />
331 329
       <workItem from="1533223998681" duration="8083000" />
332 330
       <workItem from="1533245929577" duration="1617000" />
333
-      <workItem from="1533318241838" duration="4083000" />
331
+      <workItem from="1533318241838" duration="4125000" />
334 332
     </task>
335 333
     <servers />
336 334
   </component>
337 335
   <component name="TimeTrackingManager">
338
-    <option name="totallyTimeSpent" value="16782000" />
336
+    <option name="totallyTimeSpent" value="16824000" />
339 337
   </component>
340 338
   <component name="ToolWindowManager">
341 339
     <frame x="0" y="0" width="1280" height="800" extended-state="0" />

+ 6
- 3
MyPassionProjectClient/src/app/app.module.ts View File

@@ -1,6 +1,6 @@
1 1
 import { BrowserModule } from '@angular/platform-browser';
2 2
 import { ErrorHandler, NgModule } from '@angular/core';
3
-import { IonicApp, IonicErrorHandler, IonicModule, IonicPage, Menu } from 'ionic-angular';
3
+import { IonicApp, IonicErrorHandler, IonicModule, IonicPage, Menu, Popover } from 'ionic-angular';
4 4
 import { SplashScreen } from '@ionic-native/splash-screen';
5 5
 import { StatusBar } from '@ionic-native/status-bar';
6 6
 import { MyApp } from './app.component';
@@ -14,6 +14,7 @@ import { Camera } from '../../node_modules/@ionic-native/camera';
14 14
 import { FilePath } from '../../node_modules/@ionic-native/file-path';
15 15
 import {File} from '../../node_modules/@ionic-native/file';
16 16
 import { MenuPage } from '../pages/menu/menu';
17
+import { PopoverComponent } from '../components/popover/popover';
17 18
 
18 19
 
19 20
 @NgModule({
@@ -21,7 +22,8 @@ import { MenuPage } from '../pages/menu/menu';
21 22
     MyApp,
22 23
     ProfileModalPage,
23 24
     PictureModalPage,
24
-    MenuPage
25
+    MenuPage,
26
+    PopoverComponent,
25 27
   ],
26 28
   imports: [
27 29
     BrowserModule,
@@ -33,7 +35,8 @@ import { MenuPage } from '../pages/menu/menu';
33 35
     MyApp,
34 36
     ProfileModalPage,
35 37
     PictureModalPage,
36
-    MenuPage
38
+    MenuPage,
39
+    PopoverComponent,
37 40
    ],
38 41
   providers: [
39 42
     StatusBar,

+ 12
- 0
MyPassionProjectClient/src/components/popover/popover.html View File

@@ -0,0 +1,12 @@
1
+<h2>
2
+  <strong>{{game.name}}</strong>
3
+</h2>
4
+<img src={{game.thumbnail}}/>
5
+<h6>
6
+  <strong>Rating: </strong>{{game.averageRating}}<br/>
7
+  <strong>Players: </strong>{{game.minPlayers}}-{{game.maxPlayers}}<br/>
8
+  <strong>Mechanics: </strong> {{game.mechanics}}<br/>
9
+</h6>
10
+<p>
11
+{{game.description}}
12
+</p>

+ 3
- 0
MyPassionProjectClient/src/components/popover/popover.scss View File

@@ -0,0 +1,3 @@
1
+popover {
2
+
3
+}

+ 22
- 0
MyPassionProjectClient/src/components/popover/popover.ts View File

@@ -0,0 +1,22 @@
1
+import { Component } from '@angular/core';
2
+import {NavParams} from 'ionic-angular';
3
+
4
+/**
5
+ * Generated class for the PopoverComponent component.
6
+ *
7
+ * See https://angular.io/api/core/Component for more info on Angular
8
+ * Components.
9
+ */
10
+@Component({
11
+  selector: 'popover',
12
+  templateUrl: 'popover.html'
13
+})
14
+export class PopoverComponent {
15
+  game:any;
16
+
17
+  constructor(public navParams: NavParams) {
18
+    console.log(this.navParams.data);
19
+    this.game = navParams.data;
20
+  }
21
+
22
+}

+ 1
- 1
MyPassionProjectClient/src/pages/game-search/game-search.html View File

@@ -21,7 +21,7 @@
21 21
       </ion-thumbnail>
22 22
       <h2>{{game.name}}</h2>
23 23
       <p>{{game.mechanics}}</p>
24
-      <button ion-button clear item-end>View</button>
24
+      <button ion-button clear item-end (click)="presentPopover(game)">View</button>
25 25
         </ion-item>
26 26
 
27 27
 

+ 12
- 2
MyPassionProjectClient/src/pages/game-search/game-search.ts View File

@@ -1,9 +1,10 @@
1 1
 import { Component } from '@angular/core';
2
-import {IonicPage, NavController, NavParams, ToastController} from 'ionic-angular';
2
+import {IonicPage, NavController, NavParams, ToastController, PopoverController} from 'ionic-angular';
3 3
 import { BggGameSearch } from '../../providers/bggGames-service';
4 4
 import { UsersService } from '../../providers/users-service';
5 5
 import { GamesService } from '../../providers/games-service';
6 6
 import { SettingsPageModule } from '../settings/settings.module';
7
+import { PopoverComponent } from '../../components/popover/popover';
7 8
  
8 9
 @IonicPage()
9 10
 @Component({
@@ -23,7 +24,10 @@ export class GameSearchPage {
23 24
     searchResult: any;
24 25
     searchTerm: '';
25 26
 
26
-  constructor(public navCtrl: NavController, public navParams: NavParams, public toastCtrl: ToastController, public bggGames: BggGameSearch, public usersService: UsersService, public gamesService: GamesService) {
27
+  constructor(public navCtrl: NavController, public navParams: NavParams, 
28
+      public toastCtrl: ToastController, public bggGames: BggGameSearch, 
29
+      public usersService: UsersService, public gamesService: GamesService, 
30
+      public popoverCtrl: PopoverController) {
27 31
   }
28 32
   
29 33
   ionViewDidLoad() {
@@ -81,4 +85,10 @@ export class GameSearchPage {
81 85
       toast.present();
82 86
 
83 87
     }
88
+
89
+    presentPopover(game) {
90
+      const popover = this.popoverCtrl.create(PopoverComponent,game);
91
+      console.log(game);
92
+      popover.present();
93
+    }
84 94
 }

+ 1
- 1
MyPassionProjectClient/src/pages/my-games/my-games.html View File

@@ -21,7 +21,7 @@
21 21
         </ion-thumbnail>
22 22
         <h2>{{game.name}}</h2>
23 23
         <p>{{game.mechanics}}</p>
24
-        <button ion-button clear item-end>View</button>
24
+        <button ion-button clear item-end (click)="presentPopover(game)">View</button>
25 25
           </ion-item>
26 26
   
27 27
         <ion-item-options side="right">

+ 9
- 2
MyPassionProjectClient/src/pages/my-games/my-games.ts View File

@@ -1,6 +1,7 @@
1 1
 import { Component } from '@angular/core';
2
-import {IonicPage, NavController, NavParams, ToastController} from 'ionic-angular';
2
+import {IonicPage, NavController, NavParams, ToastController, PopoverController} from 'ionic-angular';
3 3
 import { UsersService } from '../../providers/users-service';
4
+import { PopoverComponent } from '../../components/popover/popover';
4 5
  
5 6
 @IonicPage()
6 7
 @Component({
@@ -12,7 +13,7 @@ export class MyGamesPage {
12 13
     filteredGames: any;
13 14
     userId: any;
14 15
 
15
-  constructor(public navCtrl: NavController, public navParams: NavParams, public toastCtrl: ToastController, public usersService: UsersService) {
16
+  constructor(public navCtrl: NavController, public navParams: NavParams, public toastCtrl: ToastController, public usersService: UsersService, public popoverCtrl:PopoverController) {
16 17
     console.log(navParams.get('id'));
17 18
     this.userId = navParams.get('id');
18 19
   }
@@ -50,4 +51,10 @@ export class MyGamesPage {
50 51
     });
51 52
     toast.present();
52 53
   }
54
+
55
+  presentPopover(game) {
56
+    const popover = this.popoverCtrl.create(PopoverComponent,game);
57
+    console.log(game);
58
+    popover.present();
59
+  }
53 60
 }