pages: support MultiAccountUser in templates and params #942

open
opened by lewis.moe targeting master from lewis.moe/tangled-core: master
Changed files
+180 -77
appview
pages
templates
layouts
fragments
user
+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 ) ··· 385 } 386 return fp 387 }, 388 } 389 } 390
··· 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 ) ··· 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 } 400
+68 -66
appview/pages/pages.go
··· 215 } 216 217 type LoginParams struct { 218 - ReturnUrl string 219 - ErrorCode string 220 } 221 222 func (p *Pages) Login(w io.Writer, params LoginParams) error { ··· 236 } 237 238 type TermsOfServiceParams struct { 239 - LoggedInUser *oauth.User 240 Content template.HTML 241 } 242 ··· 264 } 265 266 type PrivacyPolicyParams struct { 267 - LoggedInUser *oauth.User 268 Content template.HTML 269 } 270 ··· 292 } 293 294 type BrandParams struct { 295 - LoggedInUser *oauth.User 296 } 297 298 func (p *Pages) Brand(w io.Writer, params BrandParams) error { ··· 300 } 301 302 type TimelineParams struct { 303 - LoggedInUser *oauth.User 304 Timeline []models.TimelineEvent 305 Repos []models.Repo 306 GfiLabel *models.LabelDefinition ··· 311 } 312 313 type GoodFirstIssuesParams struct { 314 - LoggedInUser *oauth.User 315 Issues []models.Issue 316 RepoGroups []*models.RepoGroup 317 LabelDefs map[string]*models.LabelDefinition ··· 324 } 325 326 type UserProfileSettingsParams struct { 327 - LoggedInUser *oauth.User 328 Tabs []map[string]any 329 Tab string 330 } ··· 334 } 335 336 type NotificationsParams struct { 337 - LoggedInUser *oauth.User 338 Notifications []*models.NotificationWithEntity 339 UnreadCount int 340 Page pagination.Page ··· 362 } 363 364 type UserKeysSettingsParams struct { 365 - LoggedInUser *oauth.User 366 PubKeys []models.PublicKey 367 Tabs []map[string]any 368 Tab string ··· 373 } 374 375 type UserEmailsSettingsParams struct { 376 - LoggedInUser *oauth.User 377 Emails []models.Email 378 Tabs []map[string]any 379 Tab string ··· 384 } 385 386 type UserNotificationSettingsParams struct { 387 - LoggedInUser *oauth.User 388 Preferences *models.NotificationPreferences 389 Tabs []map[string]any 390 Tab string ··· 404 } 405 406 type KnotsParams struct { 407 - LoggedInUser *oauth.User 408 Registrations []models.Registration 409 Tabs []map[string]any 410 Tab string ··· 415 } 416 417 type KnotParams struct { 418 - LoggedInUser *oauth.User 419 Registration *models.Registration 420 Members []string 421 Repos map[string][]models.Repo ··· 437 } 438 439 type SpindlesParams struct { 440 - LoggedInUser *oauth.User 441 Spindles []models.Spindle 442 Tabs []map[string]any 443 Tab string ··· 458 } 459 460 type SpindleDashboardParams struct { 461 - LoggedInUser *oauth.User 462 Spindle models.Spindle 463 Members []string 464 Repos map[string][]models.Repo ··· 471 } 472 473 type NewRepoParams struct { 474 - LoggedInUser *oauth.User 475 Knots []string 476 } 477 ··· 480 } 481 482 type ForkRepoParams struct { 483 - LoggedInUser *oauth.User 484 Knots []string 485 RepoInfo repoinfo.RepoInfo 486 } ··· 518 } 519 520 type ProfileOverviewParams struct { 521 - LoggedInUser *oauth.User 522 Repos []models.Repo 523 CollaboratingRepos []models.Repo 524 ProfileTimeline *models.ProfileTimeline ··· 532 } 533 534 type ProfileReposParams struct { 535 - LoggedInUser *oauth.User 536 Repos []models.Repo 537 Card *ProfileCard 538 Active string ··· 544 } 545 546 type ProfileStarredParams struct { 547 - LoggedInUser *oauth.User 548 Repos []models.Repo 549 Card *ProfileCard 550 Active string ··· 556 } 557 558 type ProfileStringsParams struct { 559 - LoggedInUser *oauth.User 560 Strings []models.String 561 Card *ProfileCard 562 Active string ··· 569 570 type FollowCard struct { 571 UserDid string 572 - LoggedInUser *oauth.User 573 FollowStatus models.FollowStatus 574 FollowersCount int64 575 FollowingCount int64 ··· 577 } 578 579 type ProfileFollowersParams struct { 580 - LoggedInUser *oauth.User 581 Followers []FollowCard 582 Card *ProfileCard 583 Active string ··· 589 } 590 591 type ProfileFollowingParams struct { 592 - LoggedInUser *oauth.User 593 Following []FollowCard 594 Card *ProfileCard 595 Active string ··· 610 } 611 612 type EditBioParams struct { 613 - LoggedInUser *oauth.User 614 Profile *models.Profile 615 } 616 ··· 619 } 620 621 type EditPinsParams struct { 622 - LoggedInUser *oauth.User 623 Profile *models.Profile 624 AllRepos []PinnedRepo 625 } ··· 644 } 645 646 type RepoIndexParams struct { 647 - LoggedInUser *oauth.User 648 RepoInfo repoinfo.RepoInfo 649 Active string 650 TagMap map[string][]string ··· 693 } 694 695 type RepoLogParams struct { 696 - LoggedInUser *oauth.User 697 RepoInfo repoinfo.RepoInfo 698 TagMap map[string][]string 699 Active string ··· 710 } 711 712 type RepoCommitParams struct { 713 - LoggedInUser *oauth.User 714 RepoInfo repoinfo.RepoInfo 715 Active string 716 EmailToDid map[string]string ··· 729 } 730 731 type RepoTreeParams struct { 732 - LoggedInUser *oauth.User 733 RepoInfo repoinfo.RepoInfo 734 Active string 735 BreadCrumbs [][]string ··· 784 } 785 786 type RepoBranchesParams struct { 787 - LoggedInUser *oauth.User 788 RepoInfo repoinfo.RepoInfo 789 Active string 790 types.RepoBranchesResponse ··· 796 } 797 798 type RepoTagsParams struct { 799 - LoggedInUser *oauth.User 800 RepoInfo repoinfo.RepoInfo 801 Active string 802 types.RepoTagsResponse ··· 810 } 811 812 type RepoArtifactParams struct { 813 - LoggedInUser *oauth.User 814 RepoInfo repoinfo.RepoInfo 815 Artifact models.Artifact 816 } ··· 820 } 821 822 type RepoBlobParams struct { 823 - LoggedInUser *oauth.User 824 RepoInfo repoinfo.RepoInfo 825 Active string 826 BreadCrumbs [][]string ··· 844 } 845 846 type RepoSettingsParams struct { 847 - LoggedInUser *oauth.User 848 RepoInfo repoinfo.RepoInfo 849 Collaborators []Collaborator 850 Active string ··· 863 } 864 865 type RepoGeneralSettingsParams struct { 866 - LoggedInUser *oauth.User 867 RepoInfo repoinfo.RepoInfo 868 Labels []models.LabelDefinition 869 DefaultLabels []models.LabelDefinition ··· 881 } 882 883 type RepoAccessSettingsParams struct { 884 - LoggedInUser *oauth.User 885 RepoInfo repoinfo.RepoInfo 886 Active string 887 Tabs []map[string]any ··· 895 } 896 897 type RepoPipelineSettingsParams struct { 898 - LoggedInUser *oauth.User 899 RepoInfo repoinfo.RepoInfo 900 Active string 901 Tabs []map[string]any ··· 911 } 912 913 type RepoIssuesParams struct { 914 - LoggedInUser *oauth.User 915 RepoInfo repoinfo.RepoInfo 916 Active string 917 Issues []models.Issue ··· 928 } 929 930 type RepoSingleIssueParams struct { 931 - LoggedInUser *oauth.User 932 RepoInfo repoinfo.RepoInfo 933 Active string 934 Issue *models.Issue ··· 947 } 948 949 type EditIssueParams struct { 950 - LoggedInUser *oauth.User 951 RepoInfo repoinfo.RepoInfo 952 Issue *models.Issue 953 Action string ··· 971 } 972 973 type RepoNewIssueParams struct { 974 - LoggedInUser *oauth.User 975 RepoInfo repoinfo.RepoInfo 976 Issue *models.Issue // existing issue if any -- passed when editing 977 Active string ··· 985 } 986 987 type EditIssueCommentParams struct { 988 - LoggedInUser *oauth.User 989 RepoInfo repoinfo.RepoInfo 990 Issue *models.Issue 991 Comment *models.IssueComment ··· 996 } 997 998 type ReplyIssueCommentPlaceholderParams struct { 999 - LoggedInUser *oauth.User 1000 RepoInfo repoinfo.RepoInfo 1001 Issue *models.Issue 1002 Comment *models.IssueComment ··· 1007 } 1008 1009 type ReplyIssueCommentParams struct { 1010 - LoggedInUser *oauth.User 1011 RepoInfo repoinfo.RepoInfo 1012 Issue *models.Issue 1013 Comment *models.IssueComment ··· 1018 } 1019 1020 type IssueCommentBodyParams struct { 1021 - LoggedInUser *oauth.User 1022 RepoInfo repoinfo.RepoInfo 1023 Issue *models.Issue 1024 Comment *models.IssueComment ··· 1029 } 1030 1031 type RepoNewPullParams struct { 1032 - LoggedInUser *oauth.User 1033 RepoInfo repoinfo.RepoInfo 1034 Branches []types.Branch 1035 Strategy string ··· 1046 } 1047 1048 type RepoPullsParams struct { 1049 - LoggedInUser *oauth.User 1050 RepoInfo repoinfo.RepoInfo 1051 Pulls []*models.Pull 1052 Active string ··· 1081 } 1082 1083 type RepoSinglePullParams struct { 1084 - LoggedInUser *oauth.User 1085 RepoInfo repoinfo.RepoInfo 1086 Active string 1087 Pull *models.Pull ··· 1106 } 1107 1108 type RepoPullPatchParams struct { 1109 - LoggedInUser *oauth.User 1110 RepoInfo repoinfo.RepoInfo 1111 Pull *models.Pull 1112 Stack models.Stack ··· 1123 } 1124 1125 type RepoPullInterdiffParams struct { 1126 - LoggedInUser *oauth.User 1127 RepoInfo repoinfo.RepoInfo 1128 Pull *models.Pull 1129 Round int ··· 1176 } 1177 1178 type PullResubmitParams struct { 1179 - LoggedInUser *oauth.User 1180 RepoInfo repoinfo.RepoInfo 1181 Pull *models.Pull 1182 SubmissionId int ··· 1187 } 1188 1189 type PullActionsParams struct { 1190 - LoggedInUser *oauth.User 1191 RepoInfo repoinfo.RepoInfo 1192 Pull *models.Pull 1193 RoundNumber int ··· 1202 } 1203 1204 type PullNewCommentParams struct { 1205 - LoggedInUser *oauth.User 1206 RepoInfo repoinfo.RepoInfo 1207 Pull *models.Pull 1208 RoundNumber int ··· 1213 } 1214 1215 type RepoCompareParams struct { 1216 - LoggedInUser *oauth.User 1217 RepoInfo repoinfo.RepoInfo 1218 Forks []models.Repo 1219 Branches []types.Branch ··· 1232 } 1233 1234 type RepoCompareNewParams struct { 1235 - LoggedInUser *oauth.User 1236 RepoInfo repoinfo.RepoInfo 1237 Forks []models.Repo 1238 Branches []types.Branch ··· 1249 } 1250 1251 type RepoCompareAllowPullParams struct { 1252 - LoggedInUser *oauth.User 1253 RepoInfo repoinfo.RepoInfo 1254 Base string 1255 Head string ··· 1269 } 1270 1271 type LabelPanelParams struct { 1272 - LoggedInUser *oauth.User 1273 RepoInfo repoinfo.RepoInfo 1274 Defs map[string]*models.LabelDefinition 1275 Subject string ··· 1281 } 1282 1283 type EditLabelPanelParams struct { 1284 - LoggedInUser *oauth.User 1285 RepoInfo repoinfo.RepoInfo 1286 Defs map[string]*models.LabelDefinition 1287 Subject string ··· 1293 } 1294 1295 type PipelinesParams struct { 1296 - LoggedInUser *oauth.User 1297 RepoInfo repoinfo.RepoInfo 1298 Pipelines []models.Pipeline 1299 Active string ··· 1336 } 1337 1338 type WorkflowParams struct { 1339 - LoggedInUser *oauth.User 1340 RepoInfo repoinfo.RepoInfo 1341 Pipeline models.Pipeline 1342 Workflow string ··· 1350 } 1351 1352 type PutStringParams struct { 1353 - LoggedInUser *oauth.User 1354 Action string 1355 1356 // this is supplied in the case of editing an existing string ··· 1362 } 1363 1364 type StringsDashboardParams struct { 1365 - LoggedInUser *oauth.User 1366 Card ProfileCard 1367 Strings []models.String 1368 } ··· 1372 } 1373 1374 type StringTimelineParams struct { 1375 - LoggedInUser *oauth.User 1376 Strings []models.String 1377 } 1378 ··· 1381 } 1382 1383 type SingleStringParams struct { 1384 - LoggedInUser *oauth.User 1385 ShowRendered bool 1386 RenderToggle bool 1387 RenderedContents template.HTML
··· 215 } 216 217 type LoginParams struct { 218 + ReturnUrl string 219 + ErrorCode string 220 + AddAccount bool 221 + LoggedInUser *oauth.MultiAccountUser 222 } 223 224 func (p *Pages) Login(w io.Writer, params LoginParams) error { ··· 238 } 239 240 type TermsOfServiceParams struct { 241 + LoggedInUser *oauth.MultiAccountUser 242 Content template.HTML 243 } 244 ··· 266 } 267 268 type PrivacyPolicyParams struct { 269 + LoggedInUser *oauth.MultiAccountUser 270 Content template.HTML 271 } 272 ··· 294 } 295 296 type BrandParams struct { 297 + LoggedInUser *oauth.MultiAccountUser 298 } 299 300 func (p *Pages) Brand(w io.Writer, params BrandParams) error { ··· 302 } 303 304 type TimelineParams struct { 305 + LoggedInUser *oauth.MultiAccountUser 306 Timeline []models.TimelineEvent 307 Repos []models.Repo 308 GfiLabel *models.LabelDefinition ··· 313 } 314 315 type GoodFirstIssuesParams struct { 316 + LoggedInUser *oauth.MultiAccountUser 317 Issues []models.Issue 318 RepoGroups []*models.RepoGroup 319 LabelDefs map[string]*models.LabelDefinition ··· 326 } 327 328 type UserProfileSettingsParams struct { 329 + LoggedInUser *oauth.MultiAccountUser 330 Tabs []map[string]any 331 Tab string 332 } ··· 336 } 337 338 type NotificationsParams struct { 339 + LoggedInUser *oauth.MultiAccountUser 340 Notifications []*models.NotificationWithEntity 341 UnreadCount int 342 Page pagination.Page ··· 364 } 365 366 type UserKeysSettingsParams struct { 367 + LoggedInUser *oauth.MultiAccountUser 368 PubKeys []models.PublicKey 369 Tabs []map[string]any 370 Tab string ··· 375 } 376 377 type UserEmailsSettingsParams struct { 378 + LoggedInUser *oauth.MultiAccountUser 379 Emails []models.Email 380 Tabs []map[string]any 381 Tab string ··· 386 } 387 388 type UserNotificationSettingsParams struct { 389 + LoggedInUser *oauth.MultiAccountUser 390 Preferences *models.NotificationPreferences 391 Tabs []map[string]any 392 Tab string ··· 406 } 407 408 type KnotsParams struct { 409 + LoggedInUser *oauth.MultiAccountUser 410 Registrations []models.Registration 411 Tabs []map[string]any 412 Tab string ··· 417 } 418 419 type KnotParams struct { 420 + LoggedInUser *oauth.MultiAccountUser 421 Registration *models.Registration 422 Members []string 423 Repos map[string][]models.Repo ··· 439 } 440 441 type SpindlesParams struct { 442 + LoggedInUser *oauth.MultiAccountUser 443 Spindles []models.Spindle 444 Tabs []map[string]any 445 Tab string ··· 460 } 461 462 type SpindleDashboardParams struct { 463 + LoggedInUser *oauth.MultiAccountUser 464 Spindle models.Spindle 465 Members []string 466 Repos map[string][]models.Repo ··· 473 } 474 475 type NewRepoParams struct { 476 + LoggedInUser *oauth.MultiAccountUser 477 Knots []string 478 } 479 ··· 482 } 483 484 type ForkRepoParams struct { 485 + LoggedInUser *oauth.MultiAccountUser 486 Knots []string 487 RepoInfo repoinfo.RepoInfo 488 } ··· 520 } 521 522 type ProfileOverviewParams struct { 523 + LoggedInUser *oauth.MultiAccountUser 524 Repos []models.Repo 525 CollaboratingRepos []models.Repo 526 ProfileTimeline *models.ProfileTimeline ··· 534 } 535 536 type ProfileReposParams struct { 537 + LoggedInUser *oauth.MultiAccountUser 538 Repos []models.Repo 539 Card *ProfileCard 540 Active string ··· 546 } 547 548 type ProfileStarredParams struct { 549 + LoggedInUser *oauth.MultiAccountUser 550 Repos []models.Repo 551 Card *ProfileCard 552 Active string ··· 558 } 559 560 type ProfileStringsParams struct { 561 + LoggedInUser *oauth.MultiAccountUser 562 Strings []models.String 563 Card *ProfileCard 564 Active string ··· 571 572 type FollowCard struct { 573 UserDid string 574 + LoggedInUser *oauth.MultiAccountUser 575 FollowStatus models.FollowStatus 576 FollowersCount int64 577 FollowingCount int64 ··· 579 } 580 581 type ProfileFollowersParams struct { 582 + LoggedInUser *oauth.MultiAccountUser 583 Followers []FollowCard 584 Card *ProfileCard 585 Active string ··· 591 } 592 593 type ProfileFollowingParams struct { 594 + LoggedInUser *oauth.MultiAccountUser 595 Following []FollowCard 596 Card *ProfileCard 597 Active string ··· 612 } 613 614 type EditBioParams struct { 615 + LoggedInUser *oauth.MultiAccountUser 616 Profile *models.Profile 617 } 618 ··· 621 } 622 623 type EditPinsParams struct { 624 + LoggedInUser *oauth.MultiAccountUser 625 Profile *models.Profile 626 AllRepos []PinnedRepo 627 } ··· 646 } 647 648 type RepoIndexParams struct { 649 + LoggedInUser *oauth.MultiAccountUser 650 RepoInfo repoinfo.RepoInfo 651 Active string 652 TagMap map[string][]string ··· 695 } 696 697 type RepoLogParams struct { 698 + LoggedInUser *oauth.MultiAccountUser 699 RepoInfo repoinfo.RepoInfo 700 TagMap map[string][]string 701 Active string ··· 712 } 713 714 type RepoCommitParams struct { 715 + LoggedInUser *oauth.MultiAccountUser 716 RepoInfo repoinfo.RepoInfo 717 Active string 718 EmailToDid map[string]string ··· 731 } 732 733 type RepoTreeParams struct { 734 + LoggedInUser *oauth.MultiAccountUser 735 RepoInfo repoinfo.RepoInfo 736 Active string 737 BreadCrumbs [][]string ··· 786 } 787 788 type RepoBranchesParams struct { 789 + LoggedInUser *oauth.MultiAccountUser 790 RepoInfo repoinfo.RepoInfo 791 Active string 792 types.RepoBranchesResponse ··· 798 } 799 800 type RepoTagsParams struct { 801 + LoggedInUser *oauth.MultiAccountUser 802 RepoInfo repoinfo.RepoInfo 803 Active string 804 types.RepoTagsResponse ··· 812 } 813 814 type RepoArtifactParams struct { 815 + LoggedInUser *oauth.MultiAccountUser 816 RepoInfo repoinfo.RepoInfo 817 Artifact models.Artifact 818 } ··· 822 } 823 824 type RepoBlobParams struct { 825 + LoggedInUser *oauth.MultiAccountUser 826 RepoInfo repoinfo.RepoInfo 827 Active string 828 BreadCrumbs [][]string ··· 846 } 847 848 type RepoSettingsParams struct { 849 + LoggedInUser *oauth.MultiAccountUser 850 RepoInfo repoinfo.RepoInfo 851 Collaborators []Collaborator 852 Active string ··· 865 } 866 867 type RepoGeneralSettingsParams struct { 868 + LoggedInUser *oauth.MultiAccountUser 869 RepoInfo repoinfo.RepoInfo 870 Labels []models.LabelDefinition 871 DefaultLabels []models.LabelDefinition ··· 883 } 884 885 type RepoAccessSettingsParams struct { 886 + LoggedInUser *oauth.MultiAccountUser 887 RepoInfo repoinfo.RepoInfo 888 Active string 889 Tabs []map[string]any ··· 897 } 898 899 type RepoPipelineSettingsParams struct { 900 + LoggedInUser *oauth.MultiAccountUser 901 RepoInfo repoinfo.RepoInfo 902 Active string 903 Tabs []map[string]any ··· 913 } 914 915 type RepoIssuesParams struct { 916 + LoggedInUser *oauth.MultiAccountUser 917 RepoInfo repoinfo.RepoInfo 918 Active string 919 Issues []models.Issue ··· 930 } 931 932 type RepoSingleIssueParams struct { 933 + LoggedInUser *oauth.MultiAccountUser 934 RepoInfo repoinfo.RepoInfo 935 Active string 936 Issue *models.Issue ··· 949 } 950 951 type EditIssueParams struct { 952 + LoggedInUser *oauth.MultiAccountUser 953 RepoInfo repoinfo.RepoInfo 954 Issue *models.Issue 955 Action string ··· 973 } 974 975 type RepoNewIssueParams struct { 976 + LoggedInUser *oauth.MultiAccountUser 977 RepoInfo repoinfo.RepoInfo 978 Issue *models.Issue // existing issue if any -- passed when editing 979 Active string ··· 987 } 988 989 type EditIssueCommentParams struct { 990 + LoggedInUser *oauth.MultiAccountUser 991 RepoInfo repoinfo.RepoInfo 992 Issue *models.Issue 993 Comment *models.IssueComment ··· 998 } 999 1000 type ReplyIssueCommentPlaceholderParams struct { 1001 + LoggedInUser *oauth.MultiAccountUser 1002 RepoInfo repoinfo.RepoInfo 1003 Issue *models.Issue 1004 Comment *models.IssueComment ··· 1009 } 1010 1011 type ReplyIssueCommentParams struct { 1012 + LoggedInUser *oauth.MultiAccountUser 1013 RepoInfo repoinfo.RepoInfo 1014 Issue *models.Issue 1015 Comment *models.IssueComment ··· 1020 } 1021 1022 type IssueCommentBodyParams struct { 1023 + LoggedInUser *oauth.MultiAccountUser 1024 RepoInfo repoinfo.RepoInfo 1025 Issue *models.Issue 1026 Comment *models.IssueComment ··· 1031 } 1032 1033 type RepoNewPullParams struct { 1034 + LoggedInUser *oauth.MultiAccountUser 1035 RepoInfo repoinfo.RepoInfo 1036 Branches []types.Branch 1037 Strategy string ··· 1048 } 1049 1050 type RepoPullsParams struct { 1051 + LoggedInUser *oauth.MultiAccountUser 1052 RepoInfo repoinfo.RepoInfo 1053 Pulls []*models.Pull 1054 Active string ··· 1083 } 1084 1085 type RepoSinglePullParams struct { 1086 + LoggedInUser *oauth.MultiAccountUser 1087 RepoInfo repoinfo.RepoInfo 1088 Active string 1089 Pull *models.Pull ··· 1108 } 1109 1110 type RepoPullPatchParams struct { 1111 + LoggedInUser *oauth.MultiAccountUser 1112 RepoInfo repoinfo.RepoInfo 1113 Pull *models.Pull 1114 Stack models.Stack ··· 1125 } 1126 1127 type RepoPullInterdiffParams struct { 1128 + LoggedInUser *oauth.MultiAccountUser 1129 RepoInfo repoinfo.RepoInfo 1130 Pull *models.Pull 1131 Round int ··· 1178 } 1179 1180 type PullResubmitParams struct { 1181 + LoggedInUser *oauth.MultiAccountUser 1182 RepoInfo repoinfo.RepoInfo 1183 Pull *models.Pull 1184 SubmissionId int ··· 1189 } 1190 1191 type PullActionsParams struct { 1192 + LoggedInUser *oauth.MultiAccountUser 1193 RepoInfo repoinfo.RepoInfo 1194 Pull *models.Pull 1195 RoundNumber int ··· 1204 } 1205 1206 type PullNewCommentParams struct { 1207 + LoggedInUser *oauth.MultiAccountUser 1208 RepoInfo repoinfo.RepoInfo 1209 Pull *models.Pull 1210 RoundNumber int ··· 1215 } 1216 1217 type RepoCompareParams struct { 1218 + LoggedInUser *oauth.MultiAccountUser 1219 RepoInfo repoinfo.RepoInfo 1220 Forks []models.Repo 1221 Branches []types.Branch ··· 1234 } 1235 1236 type RepoCompareNewParams struct { 1237 + LoggedInUser *oauth.MultiAccountUser 1238 RepoInfo repoinfo.RepoInfo 1239 Forks []models.Repo 1240 Branches []types.Branch ··· 1251 } 1252 1253 type RepoCompareAllowPullParams struct { 1254 + LoggedInUser *oauth.MultiAccountUser 1255 RepoInfo repoinfo.RepoInfo 1256 Base string 1257 Head string ··· 1271 } 1272 1273 type LabelPanelParams struct { 1274 + LoggedInUser *oauth.MultiAccountUser 1275 RepoInfo repoinfo.RepoInfo 1276 Defs map[string]*models.LabelDefinition 1277 Subject string ··· 1283 } 1284 1285 type EditLabelPanelParams struct { 1286 + LoggedInUser *oauth.MultiAccountUser 1287 RepoInfo repoinfo.RepoInfo 1288 Defs map[string]*models.LabelDefinition 1289 Subject string ··· 1295 } 1296 1297 type PipelinesParams struct { 1298 + LoggedInUser *oauth.MultiAccountUser 1299 RepoInfo repoinfo.RepoInfo 1300 Pipelines []models.Pipeline 1301 Active string ··· 1338 } 1339 1340 type WorkflowParams struct { 1341 + LoggedInUser *oauth.MultiAccountUser 1342 RepoInfo repoinfo.RepoInfo 1343 Pipeline models.Pipeline 1344 Workflow string ··· 1352 } 1353 1354 type PutStringParams struct { 1355 + LoggedInUser *oauth.MultiAccountUser 1356 Action string 1357 1358 // this is supplied in the case of editing an existing string ··· 1364 } 1365 1366 type StringsDashboardParams struct { 1367 + LoggedInUser *oauth.MultiAccountUser 1368 Card ProfileCard 1369 Strings []models.String 1370 } ··· 1374 } 1375 1376 type StringTimelineParams struct { 1377 + LoggedInUser *oauth.MultiAccountUser 1378 Strings []models.String 1379 } 1380 ··· 1383 } 1384 1385 type SingleStringParams struct { 1386 + LoggedInUser *oauth.MultiAccountUser 1387 ShowRendered bool 1388 RenderToggle bool 1389 RenderedContents template.HTML
+49 -11
appview/pages/templates/layouts/fragments/topbar.html
··· 49 {{ define "profileDropdown" }} 50 <details class="relative inline-block text-left nav-dropdown"> 51 <summary class="cursor-pointer list-none flex items-center gap-1"> 52 - {{ $user := .Did }} 53 <img 54 src="{{ tinyAvatar $user }}" 55 alt="" ··· 57 /> 58 <span class="hidden md:inline">{{ $user | resolve | truncateAt30 }}</span> 59 </summary> 60 - <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"> 61 - <a href="/{{ $user }}">profile</a> 62 - <a href="/{{ $user }}?tab=repos">repositories</a> 63 - <a href="/{{ $user }}?tab=strings">strings</a> 64 - <a href="/settings">settings</a> 65 - <a href="#" 66 - hx-post="/logout" 67 - hx-swap="none" 68 - class="text-red-400 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300"> 69 - logout 70 </a> 71 </div> 72 </details> 73
··· 49 {{ define "profileDropdown" }} 50 <details class="relative inline-block text-left nav-dropdown"> 51 <summary class="cursor-pointer list-none flex items-center gap-1"> 52 + {{ $user := .Active.Did }} 53 <img 54 src="{{ tinyAvatar $user }}" 55 alt="" ··· 57 /> 58 <span class="hidden md:inline">{{ $user | resolve | truncateAt30 }}</span> 59 </summary> 60 + <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;"> 61 + {{ $active := .Active.Did }} 62 + 63 + <div class="pb-2 mb-2 border-b border-gray-200 dark:border-gray-700"> 64 + <div class="flex items-center gap-2"> 65 + <img src="{{ tinyAvatar $active }}" alt="" class="rounded-full h-8 w-8 flex-shrink-0 border border-gray-300 dark:border-gray-700" /> 66 + <div class="flex-1 overflow-hidden"> 67 + <p class="font-medium text-sm truncate">{{ $active | resolve }}</p> 68 + <p class="text-xs text-green-600 dark:text-green-400">active</p> 69 + </div> 70 + </div> 71 + </div> 72 + 73 + {{ $others := .Accounts | otherAccounts $active }} 74 + {{ if $others }} 75 + <div class="pb-2 mb-2 border-b border-gray-200 dark:border-gray-700"> 76 + <p class="text-xs text-gray-500 dark:text-gray-400 uppercase tracking-wide mb-1">Switch Account</p> 77 + {{ range $others }} 78 + <button 79 + type="button" 80 + hx-post="/account/switch" 81 + hx-vals='{"did": "{{ .Did }}"}' 82 + hx-swap="none" 83 + class="flex items-center gap-2 w-full py-1.5 rounded hover:bg-gray-100 dark:hover:bg-gray-700 text-left" 84 + > 85 + <img src="{{ tinyAvatar .Did }}" alt="" class="rounded-full h-6 w-6 flex-shrink-0 border border-gray-300 dark:border-gray-700" /> 86 + <span class="text-sm truncate flex-1">{{ .Did | resolve }}</span> 87 + </button> 88 + {{ end }} 89 + </div> 90 + {{ end }} 91 + 92 + <a href="/login?mode=add_account" class="flex items-center gap-2 py-1 text-sm"> 93 + {{ i "plus" "w-4 h-4 flex-shrink-0" }} 94 + <span>Add another account</span> 95 </a> 96 + 97 + <div class="pt-2 mt-2 border-t border-gray-200 dark:border-gray-700 space-y-1"> 98 + <a href="/{{ $active }}" class="block py-1 text-sm">profile</a> 99 + <a href="/{{ $active }}?tab=repos" class="block py-1 text-sm">repositories</a> 100 + <a href="/{{ $active }}?tab=strings" class="block py-1 text-sm">strings</a> 101 + <a href="/settings" class="block py-1 text-sm">settings</a> 102 + <a href="#" 103 + hx-post="/logout" 104 + hx-swap="none" 105 + class="block py-1 text-sm text-red-400 hover:text-red-700 dark:text-red-400 dark:hover:text-red-300"> 106 + logout 107 + </a> 108 + </div> 109 </div> 110 </details> 111
+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 }}