沈斌
2017-12-15 f9b157566af34b8dc28ba10b34d025ac04f3168b
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
<div nz-row [nzGutter]="24" class="py-lg">
    <div nz-col [nzSpan]="6">
        <nz-card nzTitle="Personal settings" nzNoPadding>
            <a (click)="active=1" class="d-block py-sm px-md" [ngClass]="{'bg-primary-light text-white':active===1}">Profile</a>
            <a (click)="active=2" class="d-block py-sm px-md" [ngClass]="{'bg-primary-light text-white':active===2}">Account</a>
            <a (click)="active=3" class="d-block py-sm px-md" [ngClass]="{'bg-primary-light text-white':active===3}">Emails</a>
            <a (click)="active=4" class="d-block py-sm px-md" [ngClass]="{'bg-primary-light text-white':active===4}">Notifications</a>
        </nz-card>
        <nz-card nzTitle="Developer settings" nzNoPadding>
                <a (click)="active=5" class="d-block py-sm px-md" [ngClass]="{'bg-primary-light text-white':active===5}">OAuth applications</a>
                <a (click)="active=6" class="d-block py-sm px-md" [ngClass]="{'bg-primary-light text-white':active===6}">Personal access tokens</a>
        </nz-card>
    </div>
    <div nz-col [nzSpan]="18">
        <nz-card nzTitle="Public profile" *ngIf="active===1">
            <div nz-row [nzGutter]="64">
                <div nz-col [nzSpan]="16">
                    <form nz-form [formGroup]="profileForm" (ngSubmit)="profileSave($event, profileForm.value)" [nzLayout]="'vertical'">
                        <div nz-form-item nz-row>
                            <div nz-form-label nz-col>
                                <label for="name" nz-form-item-required>name</label>
                            </div>
                            <div nz-form-control nz-col [nzHasFeedback]="'true'" [nzValidateStatus]="name">
                                <nz-input formControlName="name" [nzId]="'name'"></nz-input>
                                <div *ngIf="name.invalid && (name.dirty || name.touched)">
                                    <div nz-form-explain *ngIf="name.errors.required">required</div>
                                    <div nz-form-explain *ngIf="name.errors.pattern">must match pattern [-_a-zA-Z0-9]</div>
                                </div>
                            </div>
                        </div>
                        <div nz-form-item nz-row>
                            <div nz-form-label nz-col>
                                <label for="email">email</label>
                            </div>
                            <div nz-form-control nz-col>
                                <nz-select formControlName="email">
                                    <nz-option [nzLabel]="'Select a verified email to display'" [nzValue]="''"></nz-option>
                                    <nz-option [nzLabel]="'cipchk@qq.com'" [nzValue]="'cipchk@qq.com'"></nz-option>
                                </nz-select>
                                <div nz-form-explain>You can manage verified email addresses in your <a (click)="active=3">email settings</a>.</div>
                            </div>
                        </div>
                        <div nz-form-item nz-row>
                            <div nz-form-label nz-col>
                                <label for="bio">Bio</label>
                            </div>
                            <div nz-form-control nz-col>
                                <nz-input formControlName="bio" [nzId]="'bio'" [nzType]="'textarea'" [nzRows]="'4'" [nzPlaceHolder]="'Tell us a little bit about yourself'"></nz-input>
                                <div nz-form-explain>You can <strong>@mention</strong> other users and organizations to link to them.</div>
                            </div>
                        </div>
                        <div nz-form-item nz-row>
                            <div nz-form-label nz-col>
                                <label for="url">URL</label>
                            </div>
                            <div nz-form-control nz-col>
                                <nz-input formControlName="url" [nzId]="'url'"></nz-input>
                            </div>
                        </div>
                        <div nz-form-item nz-row>
                            <div nz-form-label nz-col>
                                <label for="company">Company</label>
                            </div>
                            <div nz-form-control nz-col>
                                <nz-input formControlName="company" [nzId]="'company'"></nz-input>
                                <div nz-form-explain>You can <strong>@mention</strong> your company's GitHub organization to link it.</div>
                            </div>
                        </div>
                        <div nz-form-item nz-row class="border-top-1 mt-md pt-md">
                            <div nz-form-label nz-col>
                                <label for="location">Location</label>
                            </div>
                            <div nz-form-control nz-col>
                                <nz-input formControlName="location" [nzId]="'location'"></nz-input>
                            </div>
                        </div>
                        <div nz-row>
                            <button nz-button [nzType]="'primary'" [disabled]="profileForm.invalid">Update profile</button>
                        </div>
                    </form>
                </div>
                <div nz-col [nzSpan]="8">
                    <h4>Profile picture</h4>
                    <img src="./assets/img/avatar.jpg" style="width: 100%;">
                    <button nz-button class="ant-btn__block">
                        <span>Upload new picture</span>
                    </button>
                </div>
            </div>
        </nz-card>
        <nz-card nzTitle="Change password" *ngIf="active===2">
            <div nz-row [nzGutter]="64">
                <div nz-col [nzSpan]="16">
                    <form nz-form [nzLayout]="'vertical'">
                        <div nz-form-item nz-row>
                            <div nz-form-label nz-col>
                                <label for="old_password" nz-form-item-required>Old password</label>
                            </div>
                            <div nz-form-control nz-col>
                                <nz-input [(ngModel)]="pwd.old_password" name="old_password" [nzId]="'old_password'" [nzType]="'password'" required></nz-input>
                            </div>
                        </div>
                        <div nz-form-item nz-row>
                            <div nz-form-label nz-col>
                                <label for="new_password" nz-form-item-required>New password</label>
                            </div>
                            <div nz-form-control nz-col>
                                <nz-input [(ngModel)]="pwd.new_password" name="new_password" [nzId]="'new_password'" [nzType]="'password'" required></nz-input>
                            </div>
                        </div>
                        <div nz-form-item nz-row>
                            <div nz-form-label nz-col>
                                <label for="confirm_new_password" nz-form-item-required>Confirm new password</label>
                            </div>
                            <div nz-form-control nz-col>
                                <nz-input [(ngModel)]="pwd.confirm_new_password" name="confirm_new_password" [nzId]="'confirm_new_password'" [nzType]="'password'" required></nz-input>
                            </div>
                        </div>
                        <div nz-row>
                            <button nz-button (click)="pwdSave()" [nzType]="'primary'">Update profile</button>
                            <a class="pl-sm" [routerLink]="['/forget']">I forgot my password</a>
                        </div>
                    </form>
                </div>
            </div>
            <h2 class="py-md mt-lg border-bottom-1">Change username</h2>
            <p class="py-sm">Changing your username can have unintended side effects.</p>
            <button nz-button (click)="msg.info('to change username page')" [nzSize]="'large'">
                <span>Change username</span>
            </button>
        </nz-card>
        <nz-card nzTitle="Email" *ngIf="active===3">
            <div class="list-group">
                <div nz-row class="list-group-item py-md" [nzType]="'flex'" [nzJustify]="'center'" [nzAlign]="'middle'">
                    <div nz-col [nzSpan]="12">
                        cipchk@qq.com
                        <nz-tooltip [nzTitle]="'This email will be used for account-related notifications (e.g. account changes, password resets, billing receipts) as well as any web-based GitHub operations (e.g. edits and merges).'">
                            <span nz-tooltip><nz-tag [nzColor]="'#28a745'">Primary</nz-tag></span>
                        </nz-tooltip>
                        <nz-tooltip [nzTitle]="'This email will be used as the \'from\' address for web-based GitHub operations.'">
                            <span nz-tooltip><nz-tag [nzColor]="'#959da5'">Public</nz-tag></span>
                        </nz-tooltip>
                    </div>
                    <div nz-col [nzSpan]="12" class="text-right">
                        <i class="anticon anticon-delete text-lg"></i>
                    </div>
                </div>
            </div>
            <h4 class="pt-md mb-sm">Add email address</h4>
            <nz-input [nzSize]="'large'" style="width: 200px"></nz-input>
            <button nz-button (click)="msg.info('add')" [nzSize]="'large'">
                <span>Add</span>
            </button>
            <h4 class="border-top-1 py-md mt-md">Primary email address</h4>
            <p class="mb-md">cipchk@qq.com will be used for account-related notifications and for web-based GitHub operations (e.g. edits and merges).</p>
            <nz-select [nzSize]="'large'" [(ngModel)]="primary_email">
                <nz-option [nzLabel]="'cipchk@qq.com'" [nzValue]="'cipchk@qq.com'"></nz-option>
            </nz-select>
            <button nz-button (click)="msg.info('save')" [nzSize]="'large'">
                <span>Save</span>
            </button>
        </nz-card>
        <nz-card nzTitle="Notifications" *ngIf="active===4">
            <p class="pb-md">Choose how you receive notifications. These notification settings apply to the repositories you’re watching.</p>
            <div class="list-group">
                <div class="list-group-item">
                    <h4>Automatically watch repositories</h4>
                    <p class="py-sm">When you’re given push access to a repository, automatically receive notifications for it.</p>
                    <label nz-checkbox [ngModel]="true">
                        <span>Automatically watch</span>
                    </label>
                </div>
                <div class="list-group-item">
                    <h4>Participating</h4>
                    <p class="py-sm">Notifications for the conversations you are participating in, or if someone cites you with an @mention.</p>
                    <label nz-checkbox [ngModel]="true">
                        <span>Email</span>
                    </label>
                    <label nz-checkbox [ngModel]="true">
                        <span>Web</span>
                    </label>
                </div>
                <div class="list-group-item">
                    <h4>Watching</h4>
                    <p class="py-sm">Notifications for all repositories or conversations you’re watching.</p>
                    <label nz-checkbox [ngModel]="true">
                        <span>Email</span>
                    </label>
                    <label nz-checkbox [ngModel]="true">
                        <span>Web</span>
                    </label>
                </div>
            </div>
        </nz-card>
        <nz-card nzNoPadding *ngIf="active===5" [nzBordered]="false">
            <div class="border rounded-md text-center p-lg bg-grey-lighter">
                <h3>No OAuth applications</h3>
                <p class="py-md">OAuth applications are used to access the GitHub API. Read the docs to find out more.</p>
                <button nz-button (click)="msg.inof('Register a new application')" [nzType]="'primary'" [nzSize]="'large'">
                    <span>Register a new application</span>
                </button>
            </div>
        </nz-card>
        <nz-card nzTitle="Personal access tokens" *ngIf="active===6">
            <ng-template #extra>
                <button nz-button (click)="msg.info('Generate new token')" [nzSize]="'small'">
                    <span>Generate new token</span>
                </button>
                <button nz-button (click)="msg.info('Revoke all')" [nzSize]="'small'" [nzType]="'danger'">
                    <span>Revoke all</span>
                </button>
            </ng-template>
            <p>Tokens you have generated that can be used to access the GitHub API.</p>
            <div class="list-group mt-sm">
                <div nz-row class="list-group-item" [nzType]="'flex'" [nzJustify]="'center'" [nzAlign]="'middle'">
                    <div nz-col [nzSpan]="12">
                        <strong>octotree</strong> — repo
                    </div>
                    <div nz-col [nzSpan]="12" class="text-right">
                        Last used within the last day
                        <nz-button-group>
                            <button nz-button>Edit</button>
                            <button nz-button [nzType]="'danger'">Delete</button>
                        </nz-button-group>
                    </div>
                </div>
            </div>
        </nz-card>
    </div>
</div>