소스 검색

Merge branch 'register' of https://git.zipcode.rocks/jaejoson/JhipsterGroupProject-Client into home

Elliott Stansbury 5 년 전
부모
커밋
a432bdf920

+ 10
- 7
src/main/webapp/app/FaeBoo/Profile-head/profile-head.component.html 파일 보기

3
     <div class = "friend-cont">
3
     <div class = "friend-cont">
4
 
4
 
5
         <div class="friend-pic friend4" id = "friend7">
5
         <div class="friend-pic friend4" id = "friend7">
6
-            <img class ="friend-photo friend4" src = "../../../content/images/defaultphoto.png">
6
+            <img class ="friend-photo friend4" src = "../../../content/images/faceofbooks3.jpg">
7
         </div>
7
         </div>
8
 
8
 
9
         <div class="friend-pic friend3" id = "friend5">
9
         <div class="friend-pic friend3" id = "friend5">
10
-            <img class ="friend-photo friend3" src = "../../../content/images/defaultphoto.png">
10
+            <img class ="friend-photo friend3" src = "../../../content/images/faceofbooks4.jpg">
11
         </div>
11
         </div>
12
 
12
 
13
         <div class="friend-pic friend2" id = "friend3">
13
         <div class="friend-pic friend2" id = "friend3">
14
-            <img class ="friend-photo" src = "../../../content/images/defaultphoto.png">
14
+            <img class ="friend-photo" src = "../../../content/images/faceofbooks2.jpg">
15
         </div>
15
         </div>
16
 
16
 
17
         <div class="friend-pic friend1" id = "friend1">
17
         <div class="friend-pic friend1" id = "friend1">
18
-            <img class ="friend-photo" src = "../../../content/images/defaultphoto.png">
18
+            <img class ="friend-photo" src = "../../../content/images/faceofbooks1.png">
19
         </div>
19
         </div>
20
 
20
 
21
         <div class = "profile-pic">
21
         <div class = "profile-pic">
67
                 <div class = "button-holder"><button class = "postBtn">Schedule</button></div>
67
                 <div class = "button-holder"><button class = "postBtn">Schedule</button></div>
68
                 <div class = "button-holder"><button class = "postBtn">Memo</button></div>
68
                 <div class = "button-holder"><button class = "postBtn">Memo</button></div>
69
                 <div class = "button-holder"><button class = "postBtn">Photo</button></div>
69
                 <div class = "button-holder"><button class = "postBtn">Photo</button></div>
70
-                <div class = "button-holder"><button class = "postBtn" (click)="submitPost();">Submit</button></div>
70
+                <div class = "button-holder"><button class = "postBtn" (click)="submitPost();loadAll();">Submit</button></div>
71
             </div>
71
             </div>
72
 
72
 
73
             <p id = "msg">Create a post...</p>
73
             <p id = "msg">Create a post...</p>
74
         </div>
74
         </div>
75
-
76
-
77
     </div>
75
     </div>
78
 
76
 
77
+    <div id = "post-container">
78
+            <div *ngFor="let post of posts;trackBy: trackId" class = "single-post">
79
+                {{post.content}}
80
+            </div>
81
+    </div>
79
 </div>
82
 </div>

+ 54
- 9
src/main/webapp/app/FaeBoo/Profile-head/profile-head.component.ts 파일 보기

1
-import { Component } from '@angular/core';
1
+import { Component, OnInit } from '@angular/core';
2
 import { PostService } from 'app/entities/post';
2
 import { PostService } from 'app/entities/post';
3
 import { IPost } from 'app/shared/model/post.model';
3
 import { IPost } from 'app/shared/model/post.model';
4
-import { IUser } from 'app/core';
4
+import { IUser, Principal } from 'app/core';
5
 import { Observable } from 'rxjs';
5
 import { Observable } from 'rxjs';
6
 import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
6
 import { HttpErrorResponse, HttpResponse } from '@angular/common/http';
7
+import { JhiAlertService } from 'ng-jhipster';
7
 
8
 
8
 @Component({
9
 @Component({
9
     selector: 'jhi-profile-head',
10
     selector: 'jhi-profile-head',
10
     templateUrl: './profile-head.component.html',
11
     templateUrl: './profile-head.component.html',
11
     styleUrls: ['profile-head.css']
12
     styleUrls: ['profile-head.css']
12
 })
13
 })
13
-export class ProfileHeadComponent {
14
+export class ProfileHeadComponent implements OnInit {
14
     str: string;
15
     str: string;
15
     post: IPost;
16
     post: IPost;
16
     user: IUser;
17
     user: IUser;
17
     isSaving: boolean;
18
     isSaving: boolean;
18
     testPost: IPost;
19
     testPost: IPost;
20
+    posts: IPost[];
19
 
21
 
20
-    constructor(private postService: PostService) {}
22
+    constructor(private postService: PostService, private jhiAlertService: JhiAlertService) {}
23
+
24
+    ngOnInit() {
25
+        this.loadAll();
26
+    }
27
+
28
+    trackId(index: number, item: IPost) {
29
+        return item.id;
30
+    }
31
+
32
+    loadAll() {
33
+        this.postService.query().subscribe(
34
+            (res: HttpResponse<IPost[]>) => {
35
+                this.posts = res.body;
36
+            },
37
+            (res: HttpErrorResponse) => this.onError(res.message)
38
+        );
39
+    }
40
+
41
+    private onError(errorMessage: string) {
42
+        this.jhiAlertService.error(errorMessage, null, null);
43
+    }
44
+
45
+    getPost(): void {
46
+        console.log('2');
47
+        this.testPost = new class implements IPost {
48
+            content: string;
49
+            dislikes: number;
50
+            id: number;
51
+            likes: number;
52
+            numberOfComments: number;
53
+            owner: IUser;
54
+        }();
55
+        this.testPost.content = 'This is a test';
56
+        this.testPost.numberOfComments = 0;
57
+        this.testPost.likes = 0;
58
+        this.testPost.dislikes = 0;
59
+        this.testPost.id = 0;
60
+        // this.testPosts.push(this.testPost);
61
+    }
21
 
62
 
22
     submitPost(): void {
63
     submitPost(): void {
23
         this.post = new class implements IPost {
64
         this.post = new class implements IPost {
32
         this.post.dislikes = 0;
73
         this.post.dislikes = 0;
33
         this.post.likes = 0;
74
         this.post.likes = 0;
34
         this.post.numberOfComments = 0;
75
         this.post.numberOfComments = 0;
35
-        if (this.post.content.length > 1) {
36
-            this.save(this.post);
37
-        }
76
+        this.save(this.post);
77
+        this.str = '';
38
     }
78
     }
39
 
79
 
40
     save(post: IPost) {
80
     save(post: IPost) {
41
         this.isSaving = true;
81
         this.isSaving = true;
42
-        this.subscribeToSaveResponse(this.postService.create(post));
43
-        console.log('post created');
82
+        const self = this;
83
+        this.postService
84
+            .create(post)
85
+            .toPromise()
86
+            .then(function(response) {
87
+                self.loadAll();
88
+            });
44
     }
89
     }
45
 
90
 
46
     private subscribeToSaveResponse(result: Observable<HttpResponse<IPost>>) {
91
     private subscribeToSaveResponse(result: Observable<HttpResponse<IPost>>) {

+ 20
- 0
src/main/webapp/app/FaeBoo/Profile-head/profile-head.css 파일 보기

158
     grid-column-start: 1;
158
     grid-column-start: 1;
159
     grid-row-start: 2;
159
     grid-row-start: 2;
160
 }
160
 }
161
+
162
+#post-container {
163
+    width: 65%;
164
+    min-height: 250px;
165
+    margin: auto;
166
+    padding: 10px;
167
+    box-sizing: border-box;
168
+}
169
+
170
+.single-post {
171
+    width: 100%;
172
+    min-height: 100px;
173
+    padding: 15px;
174
+    box-sizing: border-box;
175
+    color: #969a9f;
176
+    border-radius: 5px;
177
+    background-color: #e2e6eb;
178
+    margin-top: 10px;
179
+    margin-bottom: 10px;
180
+}

+ 1
- 0
src/main/webapp/app/entities/post/post.component.ts 파일 보기

45
     }
45
     }
46
 
46
 
47
     trackId(index: number, item: IPost) {
47
     trackId(index: number, item: IPost) {
48
+        console.log(item);
48
         return item.id;
49
         return item.id;
49
     }
50
     }
50
 
51
 

+ 1
- 1
src/main/webapp/app/layouts/navbar/navbar.component.html 파일 보기

45
                         </a>
45
                         </a>
46
                     </li>
46
                     </li>
47
                     <li>
47
                     <li>
48
-                        <a class="dropdown-item" routerLink="profile" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" (click)="collapseNavbar()">
48
+                        <a class="dropdown-item" routerLink="profile" routerLinkActive="active" [routerLinkActiveOptions]="{ exact: true }" (click)="collapseNavbar();">
49
                             <fa-icon icon="asterisk" fixedWidth="true"></fa-icon>
49
                             <fa-icon icon="asterisk" fixedWidth="true"></fa-icon>
50
                             <span jhiTranslate="global.menu.entities.profile">Profile</span>
50
                             <span jhiTranslate="global.menu.entities.profile">Profile</span>
51
                         </a>
51
                         </a>

+ 2
- 0
src/main/webapp/app/layouts/navbar/navbar.component.ts 파일 보기

6
 import { VERSION } from 'app/app.constants';
6
 import { VERSION } from 'app/app.constants';
7
 import { JhiLanguageHelper, Principal, LoginModalService, LoginService } from 'app/core';
7
 import { JhiLanguageHelper, Principal, LoginModalService, LoginService } from 'app/core';
8
 import { ProfileService } from '../profiles/profile.service';
8
 import { ProfileService } from '../profiles/profile.service';
9
+import { ProfileHeadComponent } from 'app/FaeBoo/Profile-head/profile-head.component';
9
 
10
 
10
 @Component({
11
 @Component({
11
     selector: 'jhi-navbar',
12
     selector: 'jhi-navbar',
19
     swaggerEnabled: boolean;
20
     swaggerEnabled: boolean;
20
     modalRef: NgbModalRef;
21
     modalRef: NgbModalRef;
21
     version: string;
22
     version: string;
23
+    public profileHead: ProfileHeadComponent;
22
 
24
 
23
     constructor(
25
     constructor(
24
         private loginService: LoginService,
26
         private loginService: LoginService,