Monorepo for Tangled

pages: support MultiAccountUser in templates and params

+180 -77
+10
appview/pages/funcmap.go
··· 28 emoji "github.com/yuin/goldmark-emoji" 29 "tangled.org/core/appview/filetree" 30 "tangled.org/core/appview/models" 31 "tangled.org/core/appview/pages/markup" 32 "tangled.org/core/crypto" 33 ) ··· 384 return "error" 385 } 386 return fp 387 }, 388 } 389 }
··· 28 emoji "github.com/yuin/goldmark-emoji" 29 "tangled.org/core/appview/filetree" 30 "tangled.org/core/appview/models" 31 + "tangled.org/core/appview/oauth" 32 "tangled.org/core/appview/pages/markup" 33 "tangled.org/core/crypto" 34 ) ··· 385 return "error" 386 } 387 return fp 388 + }, 389 + "otherAccounts": func(activeDid string, accounts []oauth.AccountInfo) []oauth.AccountInfo { 390 + result := make([]oauth.AccountInfo, 0, len(accounts)) 391 + for _, acc := range accounts { 392 + if acc.Did != activeDid { 393 + result = append(result, acc) 394 + } 395 + } 396 + return result 397 }, 398 } 399 }
+68 -66
appview/pages/pages.go
··· 226 } 227 228 type LoginParams struct { 229 - ReturnUrl string 230 - ErrorCode string 231 } 232 233 func (p *Pages) Login(w io.Writer, params LoginParams) error { ··· 247 } 248 249 type TermsOfServiceParams struct { 250 - LoggedInUser *oauth.User 251 Content template.HTML 252 } 253 ··· 275 } 276 277 type PrivacyPolicyParams struct { 278 - LoggedInUser *oauth.User 279 Content template.HTML 280 } 281 ··· 303 } 304 305 type BrandParams struct { 306 - LoggedInUser *oauth.User 307 } 308 309 func (p *Pages) Brand(w io.Writer, params BrandParams) error { ··· 311 } 312 313 type TimelineParams struct { 314 - LoggedInUser *oauth.User 315 Timeline []models.TimelineEvent 316 Repos []models.Repo 317 GfiLabel *models.LabelDefinition ··· 322 } 323 324 type GoodFirstIssuesParams struct { 325 - LoggedInUser *oauth.User 326 Issues []models.Issue 327 RepoGroups []*models.RepoGroup 328 LabelDefs map[string]*models.LabelDefinition ··· 335 } 336 337 type UserProfileSettingsParams struct { 338 - LoggedInUser *oauth.User 339 Tabs []map[string]any 340 Tab string 341 } ··· 345 } 346 347 type NotificationsParams struct { 348 - LoggedInUser *oauth.User 349 Notifications []*models.NotificationWithEntity 350 UnreadCount int 351 Page pagination.Page ··· 373 } 374 375 type UserKeysSettingsParams struct { 376 - LoggedInUser *oauth.User 377 PubKeys []models.PublicKey 378 Tabs []map[string]any 379 Tab string ··· 384 } 385 386 type UserEmailsSettingsParams struct { 387 - LoggedInUser *oauth.User 388 Emails []models.Email 389 Tabs []map[string]any 390 Tab string ··· 395 } 396 397 type UserNotificationSettingsParams struct { 398 - LoggedInUser *oauth.User 399 Preferences *models.NotificationPreferences 400 Tabs []map[string]any 401 Tab string ··· 415 } 416 417 type KnotsParams struct { 418 - LoggedInUser *oauth.User 419 Registrations []models.Registration 420 Tabs []map[string]any 421 Tab string ··· 426 } 427 428 type KnotParams struct { 429 - LoggedInUser *oauth.User 430 Registration *models.Registration 431 Members []string 432 Repos map[string][]models.Repo ··· 448 } 449 450 type SpindlesParams struct { 451 - LoggedInUser *oauth.User 452 Spindles []models.Spindle 453 Tabs []map[string]any 454 Tab string ··· 469 } 470 471 type SpindleDashboardParams struct { 472 - LoggedInUser *oauth.User 473 Spindle models.Spindle 474 Members []string 475 Repos map[string][]models.Repo ··· 482 } 483 484 type NewRepoParams struct { 485 - LoggedInUser *oauth.User 486 Knots []string 487 } 488 ··· 491 } 492 493 type ForkRepoParams struct { 494 - LoggedInUser *oauth.User 495 Knots []string 496 RepoInfo repoinfo.RepoInfo 497 } ··· 529 } 530 531 type ProfileOverviewParams struct { 532 - LoggedInUser *oauth.User 533 Repos []models.Repo 534 CollaboratingRepos []models.Repo 535 ProfileTimeline *models.ProfileTimeline ··· 543 } 544 545 type ProfileReposParams struct { 546 - LoggedInUser *oauth.User 547 Repos []models.Repo 548 Card *ProfileCard 549 Active string ··· 555 } 556 557 type ProfileStarredParams struct { 558 - LoggedInUser *oauth.User 559 Repos []models.Repo 560 Card *ProfileCard 561 Active string ··· 567 } 568 569 type ProfileStringsParams struct { 570 - LoggedInUser *oauth.User 571 Strings []models.String 572 Card *ProfileCard 573 Active string ··· 580 581 type FollowCard struct { 582 UserDid string 583 - LoggedInUser *oauth.User 584 FollowStatus models.FollowStatus 585 FollowersCount int64 586 FollowingCount int64 ··· 588 } 589 590 type ProfileFollowersParams struct { 591 - LoggedInUser *oauth.User 592 Followers []FollowCard 593 Card *ProfileCard 594 Active string ··· 600 } 601 602 type ProfileFollowingParams struct { 603 - LoggedInUser *oauth.User 604 Following []FollowCard 605 Card *ProfileCard 606 Active string ··· 622 } 623 624 type EditBioParams struct { 625 - LoggedInUser *oauth.User 626 Profile *models.Profile 627 } 628 ··· 631 } 632 633 type EditPinsParams struct { 634 - LoggedInUser *oauth.User 635 Profile *models.Profile 636 AllRepos []PinnedRepo 637 } ··· 658 } 659 660 type RepoIndexParams struct { 661 - LoggedInUser *oauth.User 662 RepoInfo repoinfo.RepoInfo 663 Active string 664 TagMap map[string][]string ··· 707 } 708 709 type RepoLogParams struct { 710 - LoggedInUser *oauth.User 711 RepoInfo repoinfo.RepoInfo 712 TagMap map[string][]string 713 Active string ··· 724 } 725 726 type RepoCommitParams struct { 727 - LoggedInUser *oauth.User 728 RepoInfo repoinfo.RepoInfo 729 Active string 730 EmailToDid map[string]string ··· 743 } 744 745 type RepoTreeParams struct { 746 - LoggedInUser *oauth.User 747 RepoInfo repoinfo.RepoInfo 748 Active string 749 BreadCrumbs [][]string ··· 798 } 799 800 type RepoBranchesParams struct { 801 - LoggedInUser *oauth.User 802 RepoInfo repoinfo.RepoInfo 803 Active string 804 types.RepoBranchesResponse ··· 810 } 811 812 type RepoTagsParams struct { 813 - LoggedInUser *oauth.User 814 RepoInfo repoinfo.RepoInfo 815 Active string 816 types.RepoTagsResponse ··· 824 } 825 826 type RepoArtifactParams struct { 827 - LoggedInUser *oauth.User 828 RepoInfo repoinfo.RepoInfo 829 Artifact models.Artifact 830 } ··· 834 } 835 836 type RepoBlobParams struct { 837 - LoggedInUser *oauth.User 838 RepoInfo repoinfo.RepoInfo 839 Active string 840 BreadCrumbs [][]string ··· 858 } 859 860 type RepoSettingsParams struct { 861 - LoggedInUser *oauth.User 862 RepoInfo repoinfo.RepoInfo 863 Collaborators []Collaborator 864 Active string ··· 877 } 878 879 type RepoGeneralSettingsParams struct { 880 - LoggedInUser *oauth.User 881 RepoInfo repoinfo.RepoInfo 882 Labels []models.LabelDefinition 883 DefaultLabels []models.LabelDefinition ··· 895 } 896 897 type RepoAccessSettingsParams struct { 898 - LoggedInUser *oauth.User 899 RepoInfo repoinfo.RepoInfo 900 Active string 901 Tabs []map[string]any ··· 909 } 910 911 type RepoPipelineSettingsParams struct { 912 - LoggedInUser *oauth.User 913 RepoInfo repoinfo.RepoInfo 914 Active string 915 Tabs []map[string]any ··· 925 } 926 927 type RepoIssuesParams struct { 928 - LoggedInUser *oauth.User 929 RepoInfo repoinfo.RepoInfo 930 Active string 931 Issues []models.Issue ··· 942 } 943 944 type RepoSingleIssueParams struct { 945 - LoggedInUser *oauth.User 946 RepoInfo repoinfo.RepoInfo 947 Active string 948 Issue *models.Issue ··· 961 } 962 963 type EditIssueParams struct { 964 - LoggedInUser *oauth.User 965 RepoInfo repoinfo.RepoInfo 966 Issue *models.Issue 967 Action string ··· 985 } 986 987 type RepoNewIssueParams struct { 988 - LoggedInUser *oauth.User 989 RepoInfo repoinfo.RepoInfo 990 Issue *models.Issue // existing issue if any -- passed when editing 991 Active string ··· 999 } 1000 1001 type EditIssueCommentParams struct { 1002 - LoggedInUser *oauth.User 1003 RepoInfo repoinfo.RepoInfo 1004 Issue *models.Issue 1005 Comment *models.IssueComment ··· 1010 } 1011 1012 type ReplyIssueCommentPlaceholderParams struct { 1013 - LoggedInUser *oauth.User 1014 RepoInfo repoinfo.RepoInfo 1015 Issue *models.Issue 1016 Comment *models.IssueComment ··· 1021 } 1022 1023 type ReplyIssueCommentParams struct { 1024 - LoggedInUser *oauth.User 1025 RepoInfo repoinfo.RepoInfo 1026 Issue *models.Issue 1027 Comment *models.IssueComment ··· 1032 } 1033 1034 type IssueCommentBodyParams struct { 1035 - LoggedInUser *oauth.User 1036 RepoInfo repoinfo.RepoInfo 1037 Issue *models.Issue 1038 Comment *models.IssueComment ··· 1043 } 1044 1045 type RepoNewPullParams struct { 1046 - LoggedInUser *oauth.User 1047 RepoInfo repoinfo.RepoInfo 1048 Branches []types.Branch 1049 Strategy string ··· 1060 } 1061 1062 type RepoPullsParams struct { 1063 - LoggedInUser *oauth.User 1064 RepoInfo repoinfo.RepoInfo 1065 Pulls []*models.Pull 1066 Active string ··· 1097 } 1098 1099 type RepoSinglePullParams struct { 1100 - LoggedInUser *oauth.User 1101 RepoInfo repoinfo.RepoInfo 1102 Active string 1103 Pull *models.Pull ··· 1122 } 1123 1124 type RepoPullPatchParams struct { 1125 - LoggedInUser *oauth.User 1126 RepoInfo repoinfo.RepoInfo 1127 Pull *models.Pull 1128 Stack models.Stack ··· 1139 } 1140 1141 type RepoPullInterdiffParams struct { 1142 - LoggedInUser *oauth.User 1143 RepoInfo repoinfo.RepoInfo 1144 Pull *models.Pull 1145 Round int ··· 1192 } 1193 1194 type PullResubmitParams struct { 1195 - LoggedInUser *oauth.User 1196 RepoInfo repoinfo.RepoInfo 1197 Pull *models.Pull 1198 SubmissionId int ··· 1203 } 1204 1205 type PullActionsParams struct { 1206 - LoggedInUser *oauth.User 1207 RepoInfo repoinfo.RepoInfo 1208 Pull *models.Pull 1209 RoundNumber int ··· 1218 } 1219 1220 type PullNewCommentParams struct { 1221 - LoggedInUser *oauth.User 1222 RepoInfo repoinfo.RepoInfo 1223 Pull *models.Pull 1224 RoundNumber int ··· 1229 } 1230 1231 type RepoCompareParams struct { 1232 - LoggedInUser *oauth.User 1233 RepoInfo repoinfo.RepoInfo 1234 Forks []models.Repo 1235 Branches []types.Branch ··· 1248 } 1249 1250 type RepoCompareNewParams struct { 1251 - LoggedInUser *oauth.User 1252 RepoInfo repoinfo.RepoInfo 1253 Forks []models.Repo 1254 Branches []types.Branch ··· 1265 } 1266 1267 type RepoCompareAllowPullParams struct { 1268 - LoggedInUser *oauth.User 1269 RepoInfo repoinfo.RepoInfo 1270 Base string 1271 Head string ··· 1285 } 1286 1287 type LabelPanelParams struct { 1288 - LoggedInUser *oauth.User 1289 RepoInfo repoinfo.RepoInfo 1290 Defs map[string]*models.LabelDefinition 1291 Subject string ··· 1297 } 1298 1299 type EditLabelPanelParams struct { 1300 - LoggedInUser *oauth.User 1301 RepoInfo repoinfo.RepoInfo 1302 Defs map[string]*models.LabelDefinition 1303 Subject string ··· 1309 } 1310 1311 type PipelinesParams struct { 1312 - LoggedInUser *oauth.User 1313 RepoInfo repoinfo.RepoInfo 1314 Pipelines []models.Pipeline 1315 Active string ··· 1352 } 1353 1354 type WorkflowParams struct { 1355 - LoggedInUser *oauth.User 1356 RepoInfo repoinfo.RepoInfo 1357 Pipeline models.Pipeline 1358 Workflow string ··· 1366 } 1367 1368 type PutStringParams struct { 1369 - LoggedInUser *oauth.User 1370 Action string 1371 1372 // this is supplied in the case of editing an existing string ··· 1378 } 1379 1380 type StringsDashboardParams struct { 1381 - LoggedInUser *oauth.User 1382 Card ProfileCard 1383 Strings []models.String 1384 } ··· 1388 } 1389 1390 type StringTimelineParams struct { 1391 - LoggedInUser *oauth.User 1392 Strings []models.String 1393 } 1394 ··· 1397 } 1398 1399 type SingleStringParams struct { 1400 - LoggedInUser *oauth.User 1401 ShowRendered bool 1402 RenderToggle bool 1403 RenderedContents template.HTML
··· 226 } 227 228 type LoginParams struct { 229 + ReturnUrl string 230 + ErrorCode string 231 + AddAccount bool 232 + LoggedInUser *oauth.MultiAccountUser 233 } 234 235 func (p *Pages) Login(w io.Writer, params LoginParams) error { ··· 249 } 250 251 type TermsOfServiceParams struct { 252 + LoggedInUser *oauth.MultiAccountUser 253 Content template.HTML 254 } 255 ··· 277 } 278 279 type PrivacyPolicyParams struct { 280 + LoggedInUser *oauth.MultiAccountUser 281 Content template.HTML 282 } 283 ··· 305 } 306 307 type BrandParams struct { 308 + LoggedInUser *oauth.MultiAccountUser 309 } 310 311 func (p *Pages) Brand(w io.Writer, params BrandParams) error { ··· 313 } 314 315 type TimelineParams struct { 316 + LoggedInUser *oauth.MultiAccountUser 317 Timeline []models.TimelineEvent 318 Repos []models.Repo 319 GfiLabel *models.LabelDefinition ··· 324 } 325 326 type GoodFirstIssuesParams struct { 327 + LoggedInUser *oauth.MultiAccountUser 328 Issues []models.Issue 329 RepoGroups []*models.RepoGroup 330 LabelDefs map[string]*models.LabelDefinition ··· 337 } 338 339 type UserProfileSettingsParams struct { 340 + LoggedInUser *oauth.MultiAccountUser 341 Tabs []map[string]any 342 Tab string 343 } ··· 347 } 348 349 type NotificationsParams struct { 350 + LoggedInUser *oauth.MultiAccountUser 351 Notifications []*models.NotificationWithEntity 352 UnreadCount int 353 Page pagination.Page ··· 375 } 376 377 type UserKeysSettingsParams struct { 378 + LoggedInUser *oauth.MultiAccountUser 379 PubKeys []models.PublicKey 380 Tabs []map[string]any 381 Tab string ··· 386 } 387 388 type UserEmailsSettingsParams struct { 389 + LoggedInUser *oauth.MultiAccountUser 390 Emails []models.Email 391 Tabs []map[string]any 392 Tab string ··· 397 } 398 399 type UserNotificationSettingsParams struct { 400 + LoggedInUser *oauth.MultiAccountUser 401 Preferences *models.NotificationPreferences 402 Tabs []map[string]any 403 Tab string ··· 417 } 418 419 type KnotsParams struct { 420 + LoggedInUser *oauth.MultiAccountUser 421 Registrations []models.Registration 422 Tabs []map[string]any 423 Tab string ··· 428 } 429 430 type KnotParams struct { 431 + LoggedInUser *oauth.MultiAccountUser 432 Registration *models.Registration 433 Members []string 434 Repos map[string][]models.Repo ··· 450 } 451 452 type SpindlesParams struct { 453 + LoggedInUser *oauth.MultiAccountUser 454 Spindles []models.Spindle 455 Tabs []map[string]any 456 Tab string ··· 471 } 472 473 type SpindleDashboardParams struct { 474 + LoggedInUser *oauth.MultiAccountUser 475 Spindle models.Spindle 476 Members []string 477 Repos map[string][]models.Repo ··· 484 } 485 486 type NewRepoParams struct { 487 + LoggedInUser *oauth.MultiAccountUser 488 Knots []string 489 } 490 ··· 493 } 494 495 type ForkRepoParams struct { 496 + LoggedInUser *oauth.MultiAccountUser 497 Knots []string 498 RepoInfo repoinfo.RepoInfo 499 } ··· 531 } 532 533 type ProfileOverviewParams struct { 534 + LoggedInUser *oauth.MultiAccountUser 535 Repos []models.Repo 536 CollaboratingRepos []models.Repo 537 ProfileTimeline *models.ProfileTimeline ··· 545 } 546 547 type ProfileReposParams struct { 548 + LoggedInUser *oauth.MultiAccountUser 549 Repos []models.Repo 550 Card *ProfileCard 551 Active string ··· 557 } 558 559 type ProfileStarredParams struct { 560 + LoggedInUser *oauth.MultiAccountUser 561 Repos []models.Repo 562 Card *ProfileCard 563 Active string ··· 569 } 570 571 type ProfileStringsParams struct { 572 + LoggedInUser *oauth.MultiAccountUser 573 Strings []models.String 574 Card *ProfileCard 575 Active string ··· 582 583 type FollowCard struct { 584 UserDid string 585 + LoggedInUser *oauth.MultiAccountUser 586 FollowStatus models.FollowStatus 587 FollowersCount int64 588 FollowingCount int64 ··· 590 } 591 592 type ProfileFollowersParams struct { 593 + LoggedInUser *oauth.MultiAccountUser 594 Followers []FollowCard 595 Card *ProfileCard 596 Active string ··· 602 } 603 604 type ProfileFollowingParams struct { 605 + LoggedInUser *oauth.MultiAccountUser 606 Following []FollowCard 607 Card *ProfileCard 608 Active string ··· 624 } 625 626 type EditBioParams struct { 627 + LoggedInUser *oauth.MultiAccountUser 628 Profile *models.Profile 629 } 630 ··· 633 } 634 635 type EditPinsParams struct { 636 + LoggedInUser *oauth.MultiAccountUser 637 Profile *models.Profile 638 AllRepos []PinnedRepo 639 } ··· 660 } 661 662 type RepoIndexParams struct { 663 + LoggedInUser *oauth.MultiAccountUser 664 RepoInfo repoinfo.RepoInfo 665 Active string 666 TagMap map[string][]string ··· 709 } 710 711 type RepoLogParams struct { 712 + LoggedInUser *oauth.MultiAccountUser 713 RepoInfo repoinfo.RepoInfo 714 TagMap map[string][]string 715 Active string ··· 726 } 727 728 type RepoCommitParams struct { 729 + LoggedInUser *oauth.MultiAccountUser 730 RepoInfo repoinfo.RepoInfo 731 Active string 732 EmailToDid map[string]string ··· 745 } 746 747 type RepoTreeParams struct { 748 + LoggedInUser *oauth.MultiAccountUser 749 RepoInfo repoinfo.RepoInfo 750 Active string 751 BreadCrumbs [][]string ··· 800 } 801 802 type RepoBranchesParams struct { 803 + LoggedInUser *oauth.MultiAccountUser 804 RepoInfo repoinfo.RepoInfo 805 Active string 806 types.RepoBranchesResponse ··· 812 } 813 814 type RepoTagsParams struct { 815 + LoggedInUser *oauth.MultiAccountUser 816 RepoInfo repoinfo.RepoInfo 817 Active string 818 types.RepoTagsResponse ··· 826 } 827 828 type RepoArtifactParams struct { 829 + LoggedInUser *oauth.MultiAccountUser 830 RepoInfo repoinfo.RepoInfo 831 Artifact models.Artifact 832 } ··· 836 } 837 838 type RepoBlobParams struct { 839 + LoggedInUser *oauth.MultiAccountUser 840 RepoInfo repoinfo.RepoInfo 841 Active string 842 BreadCrumbs [][]string ··· 860 } 861 862 type RepoSettingsParams struct { 863 + LoggedInUser *oauth.MultiAccountUser 864 RepoInfo repoinfo.RepoInfo 865 Collaborators []Collaborator 866 Active string ··· 879 } 880 881 type RepoGeneralSettingsParams struct { 882 + LoggedInUser *oauth.MultiAccountUser 883 RepoInfo repoinfo.RepoInfo 884 Labels []models.LabelDefinition 885 DefaultLabels []models.LabelDefinition ··· 897 } 898 899 type RepoAccessSettingsParams struct { 900 + LoggedInUser *oauth.MultiAccountUser 901 RepoInfo repoinfo.RepoInfo 902 Active string 903 Tabs []map[string]any ··· 911 } 912 913 type RepoPipelineSettingsParams struct { 914 + LoggedInUser *oauth.MultiAccountUser 915 RepoInfo repoinfo.RepoInfo 916 Active string 917 Tabs []map[string]any ··· 927 } 928 929 type RepoIssuesParams struct { 930 + LoggedInUser *oauth.MultiAccountUser 931 RepoInfo repoinfo.RepoInfo 932 Active string 933 Issues []models.Issue ··· 944 } 945 946 type RepoSingleIssueParams struct { 947 + LoggedInUser *oauth.MultiAccountUser 948 RepoInfo repoinfo.RepoInfo 949 Active string 950 Issue *models.Issue ··· 963 } 964 965 type EditIssueParams struct { 966 + LoggedInUser *oauth.MultiAccountUser 967 RepoInfo repoinfo.RepoInfo 968 Issue *models.Issue 969 Action string ··· 987 } 988 989 type RepoNewIssueParams struct { 990 + LoggedInUser *oauth.MultiAccountUser 991 RepoInfo repoinfo.RepoInfo 992 Issue *models.Issue // existing issue if any -- passed when editing 993 Active string ··· 1001 } 1002 1003 type EditIssueCommentParams struct { 1004 + LoggedInUser *oauth.MultiAccountUser 1005 RepoInfo repoinfo.RepoInfo 1006 Issue *models.Issue 1007 Comment *models.IssueComment ··· 1012 } 1013 1014 type ReplyIssueCommentPlaceholderParams struct { 1015 + LoggedInUser *oauth.MultiAccountUser 1016 RepoInfo repoinfo.RepoInfo 1017 Issue *models.Issue 1018 Comment *models.IssueComment ··· 1023 } 1024 1025 type ReplyIssueCommentParams struct { 1026 + LoggedInUser *oauth.MultiAccountUser 1027 RepoInfo repoinfo.RepoInfo 1028 Issue *models.Issue 1029 Comment *models.IssueComment ··· 1034 } 1035 1036 type IssueCommentBodyParams struct { 1037 + LoggedInUser *oauth.MultiAccountUser 1038 RepoInfo repoinfo.RepoInfo 1039 Issue *models.Issue 1040 Comment *models.IssueComment ··· 1045 } 1046 1047 type RepoNewPullParams struct { 1048 + LoggedInUser *oauth.MultiAccountUser 1049 RepoInfo repoinfo.RepoInfo 1050 Branches []types.Branch 1051 Strategy string ··· 1062 } 1063 1064 type RepoPullsParams struct { 1065 + LoggedInUser *oauth.MultiAccountUser 1066 RepoInfo repoinfo.RepoInfo 1067 Pulls []*models.Pull 1068 Active string ··· 1099 } 1100 1101 type RepoSinglePullParams struct { 1102 + LoggedInUser *oauth.MultiAccountUser 1103 RepoInfo repoinfo.RepoInfo 1104 Active string 1105 Pull *models.Pull ··· 1124 } 1125 1126 type RepoPullPatchParams struct { 1127 + LoggedInUser *oauth.MultiAccountUser 1128 RepoInfo repoinfo.RepoInfo 1129 Pull *models.Pull 1130 Stack models.Stack ··· 1141 } 1142 1143 type RepoPullInterdiffParams struct { 1144 + LoggedInUser *oauth.MultiAccountUser 1145 RepoInfo repoinfo.RepoInfo 1146 Pull *models.Pull 1147 Round int ··· 1194 } 1195 1196 type PullResubmitParams struct { 1197 + LoggedInUser *oauth.MultiAccountUser 1198 RepoInfo repoinfo.RepoInfo 1199 Pull *models.Pull 1200 SubmissionId int ··· 1205 } 1206 1207 type PullActionsParams struct { 1208 + LoggedInUser *oauth.MultiAccountUser 1209 RepoInfo repoinfo.RepoInfo 1210 Pull *models.Pull 1211 RoundNumber int ··· 1220 } 1221 1222 type PullNewCommentParams struct { 1223 + LoggedInUser *oauth.MultiAccountUser 1224 RepoInfo repoinfo.RepoInfo 1225 Pull *models.Pull 1226 RoundNumber int ··· 1231 } 1232 1233 type RepoCompareParams struct { 1234 + LoggedInUser *oauth.MultiAccountUser 1235 RepoInfo repoinfo.RepoInfo 1236 Forks []models.Repo 1237 Branches []types.Branch ··· 1250 } 1251 1252 type RepoCompareNewParams struct { 1253 + LoggedInUser *oauth.MultiAccountUser 1254 RepoInfo repoinfo.RepoInfo 1255 Forks []models.Repo 1256 Branches []types.Branch ··· 1267 } 1268 1269 type RepoCompareAllowPullParams struct { 1270 + LoggedInUser *oauth.MultiAccountUser 1271 RepoInfo repoinfo.RepoInfo 1272 Base string 1273 Head string ··· 1287 } 1288 1289 type LabelPanelParams struct { 1290 + LoggedInUser *oauth.MultiAccountUser 1291 RepoInfo repoinfo.RepoInfo 1292 Defs map[string]*models.LabelDefinition 1293 Subject string ··· 1299 } 1300 1301 type EditLabelPanelParams struct { 1302 + LoggedInUser *oauth.MultiAccountUser 1303 RepoInfo repoinfo.RepoInfo 1304 Defs map[string]*models.LabelDefinition 1305 Subject string ··· 1311 } 1312 1313 type PipelinesParams struct { 1314 + LoggedInUser *oauth.MultiAccountUser 1315 RepoInfo repoinfo.RepoInfo 1316 Pipelines []models.Pipeline 1317 Active string ··· 1354 } 1355 1356 type WorkflowParams struct { 1357 + LoggedInUser *oauth.MultiAccountUser 1358 RepoInfo repoinfo.RepoInfo 1359 Pipeline models.Pipeline 1360 Workflow string ··· 1368 } 1369 1370 type PutStringParams struct { 1371 + LoggedInUser *oauth.MultiAccountUser 1372 Action string 1373 1374 // this is supplied in the case of editing an existing string ··· 1380 } 1381 1382 type StringsDashboardParams struct { 1383 + LoggedInUser *oauth.MultiAccountUser 1384 Card ProfileCard 1385 Strings []models.String 1386 } ··· 1390 } 1391 1392 type StringTimelineParams struct { 1393 + LoggedInUser *oauth.MultiAccountUser 1394 Strings []models.String 1395 } 1396 ··· 1399 } 1400 1401 type SingleStringParams struct { 1402 + LoggedInUser *oauth.MultiAccountUser 1403 ShowRendered bool 1404 RenderToggle bool 1405 RenderedContents template.HTML
+49 -11
appview/pages/templates/layouts/fragments/topbar.html
··· 45 {{ define "profileDropdown" }} 46 <details class="relative inline-block text-left nav-dropdown"> 47 <summary class="cursor-pointer list-none flex items-center gap-1"> 48 - {{ $user := .Did }} 49 <img 50 src="{{ tinyAvatar $user }}" 51 alt="" ··· 53 /> 54 <span class="hidden md:inline">{{ $user | resolve | truncateAt30 }}</span> 55 </summary> 56 - <div class="absolute flex flex-col right-0 mt-4 p-4 rounded w-48 bg-white dark:bg-gray-800 dark:text-white border border-gray-200 dark:border-gray-700"> 57 - <a href="/{{ $user }}">profile</a> 58 - <a href="/{{ $user }}?tab=repos">repositories</a> 59 - <a href="/{{ $user }}?tab=strings">strings</a> 60 - <a href="/settings">settings</a> 61 - <a href="#" 62 - hx-post="/logout" 63 - hx-swap="none" 64 - class="text-red-400 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300"> 65 - logout 66 </a> 67 </div> 68 </details> 69
··· 45 {{ define "profileDropdown" }} 46 <details class="relative inline-block text-left nav-dropdown"> 47 <summary class="cursor-pointer list-none flex items-center gap-1"> 48 + {{ $user := .Active.Did }} 49 <img 50 src="{{ tinyAvatar $user }}" 51 alt="" ··· 53 /> 54 <span class="hidden md:inline">{{ $user | resolve | truncateAt30 }}</span> 55 </summary> 56 + <div class="absolute right-0 mt-4 p-4 rounded bg-white dark:bg-gray-800 dark:text-white border border-gray-200 dark:border-gray-700 shadow-lg z-50" style="width: 14rem;"> 57 + {{ $active := .Active.Did }} 58 + 59 + <div class="pb-2 mb-2 border-b border-gray-200 dark:border-gray-700"> 60 + <div class="flex items-center gap-2"> 61 + <img src="{{ tinyAvatar $active }}" alt="" class="rounded-full h-8 w-8 flex-shrink-0 border border-gray-300 dark:border-gray-700" /> 62 + <div class="flex-1 overflow-hidden"> 63 + <p class="font-medium text-sm truncate">{{ $active | resolve }}</p> 64 + <p class="text-xs text-green-600 dark:text-green-400">active</p> 65 + </div> 66 + </div> 67 + </div> 68 + 69 + {{ $others := .Accounts | otherAccounts $active }} 70 + {{ if $others }} 71 + <div class="pb-2 mb-2 border-b border-gray-200 dark:border-gray-700"> 72 + <p class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide mb-1">Switch Account</p> 73 + {{ range $others }} 74 + <button 75 + type="button" 76 + hx-post="/account/switch" 77 + hx-vals='{"did": "{{ .Did }}"}' 78 + hx-swap="none" 79 + class="flex items-center gap-2 w-full py-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-left" 80 + > 81 + <img src="{{ tinyAvatar .Did }}" alt="" class="rounded-full h-6 w-6 flex-shrink-0 border border-gray-300 dark:border-gray-700" /> 82 + <span class="text-sm truncate flex-1">{{ .Did | resolve }}</span> 83 + </button> 84 + {{ end }} 85 + </div> 86 + {{ end }} 87 + 88 + <a href="/login?mode=add_account" class="flex items-center gap-2 py-1 text-sm"> 89 + {{ i "plus" "w-4 h-4 flex-shrink-0" }} 90 + <span>Add another account</span> 91 </a> 92 + 93 + <div class="pt-2 mt-2 border-t border-gray-200 dark:border-gray-700 space-y-1"> 94 + <a href="/{{ $active }}" class="block py-1 text-sm">profile</a> 95 + <a href="/{{ $active }}?tab=repos" class="block py-1 text-sm">repositories</a> 96 + <a href="/{{ $active }}?tab=strings" class="block py-1 text-sm">strings</a> 97 + <a href="/settings" class="block py-1 text-sm">settings</a> 98 + <a href="#" 99 + hx-post="/logout" 100 + hx-swap="none" 101 + class="block py-1 text-sm text-red-400 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300"> 102 + logout 103 + </a> 104 + </div> 105 </div> 106 </details> 107
+53
appview/pages/templates/user/login.html
··· 20 <h2 class="text-center text-xl italic dark:text-white"> 21 tightly-knit social coding. 22 </h2> 23 <form 24 class="mt-4" 25 hx-post="/login" ··· 46 </span> 47 </div> 48 <input type="hidden" name="return_url" value="{{ .ReturnUrl }}"> 49 50 <button 51 class="btn w-full my-2 mt-6 text-base " ··· 66 You have not authorized the app. 67 {{ else if eq .ErrorCode "session" }} 68 Server failed to create user session. 69 {{ else }} 70 Internal Server error. 71 {{ end }}
··· 20 <h2 class="text-center text-xl italic dark:text-white"> 21 tightly-knit social coding. 22 </h2> 23 + 24 + {{ if .AddAccount }} 25 + <div class="flex gap-2 my-4 bg-blue-50 dark:bg-blue-900/30 border border-blue-300 dark:border-sky-800 rounded px-3 py-2 text-blue-600 dark:text-blue-300"> 26 + <span class="py-1">{{ i "user-plus" "w-4 h-4" }}</span> 27 + <div> 28 + <h5 class="font-medium">Add another account</h5> 29 + <p class="text-sm">Sign in with a different account to add it to your account list.</p> 30 + </div> 31 + </div> 32 + {{ end }} 33 + 34 + {{ if and .LoggedInUser .LoggedInUser.Accounts }} 35 + {{ $accounts := .LoggedInUser.Accounts }} 36 + {{ if $accounts }} 37 + <div class="my-4 border border-gray-200 dark:border-gray-700 rounded overflow-hidden"> 38 + <div class="px-3 py-2 bg-gray-50 dark:bg-gray-800 border-b border-gray-200 dark:border-gray-700"> 39 + <span class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide font-medium">Saved accounts</span> 40 + </div> 41 + <div class="divide-y divide-gray-200 dark:divide-gray-700"> 42 + {{ range $accounts }} 43 + <div class="flex items-center justify-between px-3 py-2 hover:bg-gray-100 dark:hover:bg-gray-700"> 44 + <button 45 + type="button" 46 + hx-post="/account/switch" 47 + hx-vals='{"did": "{{ .Did }}"}' 48 + hx-swap="none" 49 + class="flex items-center gap-2 flex-1 text-left min-w-0" 50 + > 51 + <img src="{{ tinyAvatar .Did }}" alt="" class="rounded-full h-8 w-8 flex-shrink-0 border border-gray-300 dark:border-gray-700" /> 52 + <div class="flex flex-col min-w-0"> 53 + <span class="text-sm font-medium dark:text-white truncate">{{ .Did | resolve | truncateAt30 }}</span> 54 + <span class="text-xs text-gray-500 dark:text-gray-400">Click to switch</span> 55 + </div> 56 + </button> 57 + <button 58 + type="button" 59 + hx-delete="/account/{{ .Did }}" 60 + hx-swap="none" 61 + class="p-1 text-gray-400 hover:text-red-500 dark:hover:text-red-400 flex-shrink-0" 62 + title="Remove account" 63 + > 64 + {{ i "x" "w-4 h-4" }} 65 + </button> 66 + </div> 67 + {{ end }} 68 + </div> 69 + </div> 70 + {{ end }} 71 + {{ end }} 72 + 73 <form 74 class="mt-4" 75 hx-post="/login" ··· 96 </span> 97 </div> 98 <input type="hidden" name="return_url" value="{{ .ReturnUrl }}"> 99 + <input type="hidden" name="add_account" value="{{ if .AddAccount }}true{{ end }}"> 100 101 <button 102 class="btn w-full my-2 mt-6 text-base " ··· 117 You have not authorized the app. 118 {{ else if eq .ErrorCode "session" }} 119 Server failed to create user session. 120 + {{ else if eq .ErrorCode "max_accounts" }} 121 + You have reached the maximum of 20 linked accounts. Please remove an account before adding a new one. 122 {{ else }} 123 Internal Server error. 124 {{ end }}