refactor(pages): move comparison config to dedicated settings page
Some checks failed
Build and Release / Create Release (push) Successful in 1s
Build and Release / Unit Tests (push) Successful in 3m29s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 7m44s
Build and Release / Lint (push) Successful in 8m50s
Build and Release / Build Binaries (arm64, darwin, macos) (push) Failing after 1s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Successful in 4m57s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Successful in 5m16s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Successful in 9h5m13s
Build and Release / Build Binary (linux/arm64) (push) Has been cancelled
Some checks failed
Build and Release / Create Release (push) Successful in 1s
Build and Release / Unit Tests (push) Successful in 3m29s
Build and Release / Integration Tests (PostgreSQL) (push) Successful in 7m44s
Build and Release / Lint (push) Successful in 8m50s
Build and Release / Build Binaries (arm64, darwin, macos) (push) Failing after 1s
Build and Release / Build Binaries (amd64, linux, linux-latest) (push) Successful in 4m57s
Build and Release / Build Binaries (amd64, darwin, macos) (push) Successful in 5m16s
Build and Release / Build Binaries (amd64, windows, windows-latest) (push) Successful in 9h5m13s
Build and Release / Build Binary (linux/arm64) (push) Has been cancelled
Extract comparison table configuration from Content page to new Comparison settings page. Content page now only has enable/disable toggle with link to full config. New page includes dynamic UI for managing groups and features with add/remove buttons. Improves UX by separating complex comparison config from other content settings. Adds navigation tab and route for /settings/pages/comparison.
This commit is contained in:
@@ -26,15 +26,16 @@ import (
|
||||
)
|
||||
|
||||
const (
|
||||
tplRepoSettingsPages templates.TplName = "repo/settings/pages"
|
||||
tplRepoSettingsPagesBrand templates.TplName = "repo/settings/pages_brand"
|
||||
tplRepoSettingsPagesHero templates.TplName = "repo/settings/pages_hero"
|
||||
tplRepoSettingsPagesContent templates.TplName = "repo/settings/pages_content"
|
||||
tplRepoSettingsPagesSocial templates.TplName = "repo/settings/pages_social"
|
||||
tplRepoSettingsPagesPricing templates.TplName = "repo/settings/pages_pricing"
|
||||
tplRepoSettingsPagesFooter templates.TplName = "repo/settings/pages_footer"
|
||||
tplRepoSettingsPagesTheme templates.TplName = "repo/settings/pages_theme"
|
||||
tplRepoSettingsPagesLanguages templates.TplName = "repo/settings/pages_languages"
|
||||
tplRepoSettingsPages templates.TplName = "repo/settings/pages"
|
||||
tplRepoSettingsPagesBrand templates.TplName = "repo/settings/pages_brand"
|
||||
tplRepoSettingsPagesHero templates.TplName = "repo/settings/pages_hero"
|
||||
tplRepoSettingsPagesContent templates.TplName = "repo/settings/pages_content"
|
||||
tplRepoSettingsPagesComparison templates.TplName = "repo/settings/pages_comparison"
|
||||
tplRepoSettingsPagesSocial templates.TplName = "repo/settings/pages_social"
|
||||
tplRepoSettingsPagesPricing templates.TplName = "repo/settings/pages_pricing"
|
||||
tplRepoSettingsPagesFooter templates.TplName = "repo/settings/pages_footer"
|
||||
tplRepoSettingsPagesTheme templates.TplName = "repo/settings/pages_theme"
|
||||
tplRepoSettingsPagesLanguages templates.TplName = "repo/settings/pages_languages"
|
||||
)
|
||||
|
||||
// getPagesLandingConfig loads the landing page configuration
|
||||
@@ -499,8 +500,26 @@ func PagesContentPost(ctx *context.Context) {
|
||||
}
|
||||
config.Features = append(config.Features, pages_module.FeatureConfig{Title: title, Description: desc, Icon: icon, ImageURL: imageURL})
|
||||
}
|
||||
// Comparison section
|
||||
// Comparison enabled toggle (full config is on /settings/pages/comparison)
|
||||
config.Comparison.Enabled = ctx.FormBool("comparison_enabled")
|
||||
if err := savePagesLandingConfig(ctx, config); err != nil {
|
||||
ctx.ServerError("SavePagesConfig", err)
|
||||
return
|
||||
}
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.pages.saved"))
|
||||
ctx.Redirect(ctx.Repo.Repository.Link() + "/settings/pages/content")
|
||||
}
|
||||
|
||||
func PagesComparison(ctx *context.Context) {
|
||||
ctx.Data["Title"] = ctx.Tr("repo.settings.pages.comparison")
|
||||
ctx.Data["PageIsSettingsPages"] = true
|
||||
ctx.Data["PageIsSettingsPagesComparison"] = true
|
||||
setCommonPagesData(ctx)
|
||||
ctx.HTML(http.StatusOK, tplRepoSettingsPagesComparison)
|
||||
}
|
||||
|
||||
func PagesComparisonPost(ctx *context.Context) {
|
||||
config := getPagesLandingConfig(ctx)
|
||||
config.Comparison.Headline = ctx.FormString("comparison_headline")
|
||||
config.Comparison.Subheadline = ctx.FormString("comparison_subheadline")
|
||||
config.Comparison.Columns = make([]pages_module.ComparisonColumnConfig, 3)
|
||||
@@ -535,7 +554,7 @@ func PagesContentPost(ctx *context.Context) {
|
||||
return
|
||||
}
|
||||
ctx.Flash.Success(ctx.Tr("repo.settings.pages.saved"))
|
||||
ctx.Redirect(ctx.Repo.Repository.Link() + "/settings/pages/content")
|
||||
ctx.Redirect(ctx.Repo.Repository.Link() + "/settings/pages/comparison")
|
||||
}
|
||||
|
||||
func PagesSocial(ctx *context.Context) {
|
||||
|
||||
@@ -1341,6 +1341,7 @@ func registerWebRoutes(m *web.Router) {
|
||||
m.Post("/hero/upload_image", repo_setting.PagesHeroUploadImage)
|
||||
m.Post("/hero/delete_image", repo_setting.PagesHeroDeleteImage)
|
||||
m.Combo("/content").Get(repo_setting.PagesContent).Post(repo_setting.PagesContentPost)
|
||||
m.Combo("/comparison").Get(repo_setting.PagesComparison).Post(repo_setting.PagesComparisonPost)
|
||||
m.Combo("/social").Get(repo_setting.PagesSocial).Post(repo_setting.PagesSocialPost)
|
||||
m.Combo("/pricing").Get(repo_setting.PagesPricing).Post(repo_setting.PagesPricingPost)
|
||||
m.Combo("/footer").Get(repo_setting.PagesFooter).Post(repo_setting.PagesFooterPost)
|
||||
|
||||
Reference in New Issue
Block a user