fengxiang
2018-07-11 12b04f145bae740e1971036b1e2dfc1bc224d17b
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
<nz-row [nzGutter]="24" class="py-lg">
  <nz-col [nzSpan]="6">
    <nz-card nzTitle="Personal settings" class="ant-card__body-nopadding">
      <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" class="ant-card__body-nopadding">
      <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>
  </nz-col>
  <nz-col [nzSpan]="18">
    <nz-card nzTitle="Public profile" *ngIf="active===1">
      <nz-row [nzGutter]="64">
        <nz-col [nzSpan]="16">
          <form nz-form [formGroup]="profileForm" (ngSubmit)="profileSave($event, profileForm.value)" [nzLayout]="'vertical'">
            <nz-form-item>
              <nz-form-label nzFor="name" nzRequired>name</nz-form-label>
              <nz-form-control>
                <input nz-input formControlName="name" id="name">
                <div *ngIf="name.invalid && (name.dirty || name.touched)">
                  <nz-form-explain *ngIf="name.errors.required">required</nz-form-explain>
                  <nz-form-explain *ngIf="name.errors.pattern">must match pattern [-_a-zA-Z0-9]</nz-form-explain>
                </div>
              </nz-form-control>
            </nz-form-item>
            <nz-form-item>
              <nz-form-label nzFor="email">email</nz-form-label>
              <nz-form-control>
                <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>
                <nz-form-explain>You can manage verified email addresses in your
                  <a (click)="active=3">email settings</a>.</nz-form-explain>
              </nz-form-control>
            </nz-form-item>
            <nz-form-item>
              <nz-form-label nzFor="bio">Bio</nz-form-label>
              <nz-form-control>
                <textarea nz-input formControlName="bio" id="bio" placeholder="Tell us a little bit about yourself"></textarea>
                <nz-form-explain>You can
                  <strong>@mention</strong> other users and organizations to link to them.</nz-form-explain>
              </nz-form-control>
            </nz-form-item>
            <nz-form-item>
              <nz-form-label nzFor="url">URL</nz-form-label>
              <nz-form-control>
                <input nz-input formControlName="url" id="url">
              </nz-form-control>
            </nz-form-item>
            <nz-form-item>
              <nz-form-label nzFor="company">Company</nz-form-label>
              <nz-form-control>
                <input nz-input formControlName="company" id="company">
                <nz-form-explain>You can
                  <strong>@mention</strong> your company's GitHub organization to link it.</nz-form-explain>
              </nz-form-control>
            </nz-form-item>
            <nz-form-item class="border-top-1 mt-md pt-md">
              <nz-form-label nzFor="location">Location</nz-form-label>
              <nz-form-control>
                <input nz-input formControlName="location" id="location">
              </nz-form-control>
            </nz-form-item>
            <nz-form-item>
              <nz-form-control>
                <button nz-button [nzType]="'primary'" [disabled]="profileForm.invalid">Update profile</button>
              </nz-form-control>
            </nz-form-item>
          </form>
        </nz-col>
        <nz-col [nzSpan]="8">
          <h4>Profile picture</h4>
          <img src="./assets/tmp/img/avatar.jpg" style="width: 100%;">
          <nz-upload nzAction="https://jsonplaceholder.typicode.com/posts/" class="d-block mt-md text-center">
            <button nz-button>Upload new picture</button>
          </nz-upload>
        </nz-col>
      </nz-row>
    </nz-card>
    <nz-card nzTitle="Change password" *ngIf="active===2">
      <nz-row [nzGutter]="64">
        <nz-col [nzSpan]="16">
          <form nz-form [nzLayout]="'vertical'">
            <nz-form-item>
              <nz-form-label nzFor="old_password" nzRequired>Old password</nz-form-label>
              <nz-form-control>
                <input nz-input [(ngModel)]="pwd.old_password" name="old_password" id="old_password" type="password" required>
              </nz-form-control>
            </nz-form-item>
            <nz-form-item>
              <nz-form-label nzFor="new_password" nzRequired>New password</nz-form-label>
              <nz-form-control>
                <input nz-input [(ngModel)]="pwd.new_password" name="new_password" id="new_password" type="password" required>
              </nz-form-control>
            </nz-form-item>
            <nz-form-item>
              <nz-form-label nzRequired nzFor="confirm_new_password">Confirm new password</nz-form-label>
              <nz-form-control>
                <input nz-input [(ngModel)]="pwd.confirm_new_password" name="confirm_new_password" id="confirm_new_password" type="password"
                  required>
              </nz-form-control>
            </nz-form-item>
            <nz-form-item>
              <nz-form-control>
                <button nz-button (click)="pwdSave()" [nzType]="'primary'">Update profile</button>
                <a class="pl-sm" [routerLink]="['/forget']">I forgot my password</a>
              </nz-form-control>
            </nz-form-item>
          </form>
        </nz-col>
      </nz-row>
      <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')">
        <span>Change username</span>
      </button>
    </nz-card>
    <nz-card nzTitle="Email" *ngIf="active===3">
      <nz-row class="border-1 p-md rounded-sm" [nzType]="'flex'" [nzJustify]="'center'" [nzAlign]="'middle'">
        <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>
        </nz-col>
        <nz-col [nzSpan]="12" class="text-right">
          <i class="anticon anticon-delete text-lg"></i>
        </nz-col>
      </nz-row>
      <h4 class="pt-md mb-sm">Add email address</h4>
      <input nz-input style="width: 200px;" class="mr-sm">
      <button nz-button (click)="msg.info('add')">Add</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 [(ngModel)]="primary_email" class="mr-sm">
        <nz-option [nzLabel]="'cipchk@qq.com'" [nzValue]="'cipchk@qq.com'"></nz-option>
      </nz-select>
      <button nz-button (click)="msg.info('save')">Save</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>
      <nz-list nzBordered>
        <nz-list-item class="d-block">
          <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">Automatically watch</label>
        </nz-list-item>
        <nz-list-item class="d-block">
          <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">Email</label>
          <label nz-checkbox [ngModel]="true">Web</label>
        </nz-list-item>
        <nz-list-item class="d-block">
          <h4>Watching</h4>
          <p class="py-sm">Notifications for all repositories or conversations you’re watching.</p>
          <label nz-checkbox [ngModel]="true">Email</label>
          <label nz-checkbox [ngModel]="true">Web</label>
        </nz-list-item>
      </nz-list>
    </nz-card>
    <nz-card class="ant-card__body-nopadding" *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.info('Register a new application')" [nzType]="'primary'">
          Register a new application
        </button>
      </div>
    </nz-card>
    <nz-card nzTitle="Personal access tokens" [nzExtra]="extra" *ngIf="active===6">
      <ng-template #extra>
        <button nz-button (click)="msg.info('Generate new token')" [nzSize]="'small'">Generate new token</button>
        <button nz-button (click)="msg.info('Revoke all')" [nzSize]="'small'" [nzType]="'danger'" class="ml-sm">Revoke all</button>
      </ng-template>
      <p>Tokens you have generated that can be used to access the GitHub API.</p>
      <nz-list nzBordered class="mt-sm">
        <nz-list-item>
          <nz-col [nzSpan]="12">
            <strong>octotree</strong> — repo
          </nz-col>
          <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>
          </nz-col>
        </nz-list-item>
      </nz-list>
    </nz-card>
  </nz-col>
</nz-row>