Monorepo for Tangled tangled.org

appview: move template-specific constants to global funcmap #945

merged opened by boltless.me targeting master from sl/rusppvknyzsy

Constants those are mainly used to define a template shouldn't be managed from http handlers. Define constant values in const funcmap so we can easily access them without depending on template params.

This change will make more sense with following change rusppvkn

Signed-off-by: Seongmin Lee git@boltless.me

Labels

None yet.

assignee

None yet.

Participants 1
AT URI
at://did:plc:xasnlahkri4ewmbuzly2rlc5/sh.tangled.repo.pull/3mc5ynswap222
+25 -25
Interdiff #1 #2
appview/issues/issues.go

This file has not been changed.

appview/knots/knots.go

This file has not been changed.

+20 -20
appview/pages/funcmap.go
··· 387 } 388 return fp 389 }, 390 - // constant values used to define a template 391 - "const": func() map[string]any { 392 - return map[string]any{ 393 - "OrderedReactionKinds": models.OrderedReactionKinds, 394 - // would be great to have ordered maps right about now 395 - "UserSettingsTabs": []tab{ 396 - {"Name": "profile", "Icon": "user"}, 397 - {"Name": "keys", "Icon": "key"}, 398 - {"Name": "emails", "Icon": "mail"}, 399 - {"Name": "notifications", "Icon": "bell"}, 400 - {"Name": "knots", "Icon": "volleyball"}, 401 - {"Name": "spindles", "Icon": "spool"}, 402 - }, 403 - "RepoSettingsTabs": []tab{ 404 - {"Name": "general", "Icon": "sliders-horizontal"}, 405 - {"Name": "access", "Icon": "users"}, 406 - {"Name": "pipelines", "Icon": "layers-2"}, 407 - }, 408 - } 409 - }, 410 } 411 } 412 ··· 428 } 429 return result 430 }, 431 } 432 } 433
··· 387 } 388 return fp 389 }, 390 } 391 } 392 ··· 408 } 409 return result 410 }, 411 + // constant values used to define a template 412 + "const": func() map[string]any { 413 + return map[string]any{ 414 + "OrderedReactionKinds": models.OrderedReactionKinds, 415 + // would be great to have ordered maps right about now 416 + "UserSettingsTabs": []tab{ 417 + {"Name": "profile", "Icon": "user"}, 418 + {"Name": "keys", "Icon": "key"}, 419 + {"Name": "emails", "Icon": "mail"}, 420 + {"Name": "notifications", "Icon": "bell"}, 421 + {"Name": "knots", "Icon": "volleyball"}, 422 + {"Name": "spindles", "Icon": "spool"}, 423 + }, 424 + "RepoSettingsTabs": []tab{ 425 + {"Name": "general", "Icon": "sliders-horizontal"}, 426 + {"Name": "access", "Icon": "users"}, 427 + {"Name": "pipelines", "Icon": "layers-2"}, 428 + }, 429 + } 430 + }, 431 } 432 } 433
appview/pages/pages.go

This patch was likely rebased, as context lines do not match.

appview/pages/templates/repo/issues/issue.html

This file has not been changed.

appview/pages/templates/repo/pulls/fragments/pullHeader.html

This patch was likely rebased, as context lines do not match.

appview/pages/templates/repo/settings/fragments/sidebar.html

This file has not been changed.

appview/pages/templates/user/settings/fragments/sidebar.html

This file has not been changed.

+5 -5
appview/pulls/pulls.go
··· 244 ResubmitCheck: resubmitResult, 245 Pipelines: m, 246 247 - Reactions: reactionMap, 248 - UserReacted: userReactions, 249 250 LabelDefs: defs, 251 }) ··· 289 ActiveRound: roundIdInt, 290 IsInterdiff: interdiff, 291 292 - OrderedReactionKinds: models.OrderedReactionKinds, 293 - Reactions: reactionMap, 294 - UserReacted: userReactions, 295 296 LabelDefs: defs, 297 })
··· 244 ResubmitCheck: resubmitResult, 245 Pipelines: m, 246 247 + OrderedReactionKinds: models.OrderedReactionKinds, 248 + Reactions: reactionMap, 249 + UserReacted: userReactions, 250 251 LabelDefs: defs, 252 }) ··· 290 ActiveRound: roundIdInt, 291 IsInterdiff: interdiff, 292 293 + Reactions: reactionMap, 294 + UserReacted: userReactions, 295 296 LabelDefs: defs, 297 })
appview/repo/settings.go

This file has not been changed.

appview/settings/settings.go

This file has not been changed.

appview/spindles/spindles.go

This file has not been changed.

History

4 rounds 0 comments
sign up or login to add to the discussion
1 commit
expand
appview: move template-specific constants to global funcmap
3/3 success
expand
expand 0 comments
pull request successfully merged
1 commit
expand
appview: move template-specific constants to global funcmap
3/3 success
expand
expand 0 comments
1 commit
expand
appview: move template-specific constants to global funcmap
3/3 success
expand
expand 0 comments
1 commit
expand
appview: move template-specific constants to global funcmap
3/3 failed
expand
expand 0 comments