|
|
|
@@ -5,8 +5,8 @@ package setting
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"fmt"
|
|
|
|
|
"strings"
|
|
|
|
|
"net/http"
|
|
|
|
|
"strings"
|
|
|
|
|
|
|
|
|
|
repo_model "code.gitea.io/gitea/models/repo"
|
|
|
|
|
"code.gitea.io/gitea/modules/json"
|
|
|
|
@@ -261,7 +261,7 @@ func PagesContent(ctx *context.Context) {
|
|
|
|
|
func PagesContentPost(ctx *context.Context) {
|
|
|
|
|
config := getPagesLandingConfig(ctx)
|
|
|
|
|
config.Stats = nil
|
|
|
|
|
for i := 0; i < 10; i++ {
|
|
|
|
|
for i := range 10 {
|
|
|
|
|
value := ctx.FormString(fmt.Sprintf("stat_value_%d", i))
|
|
|
|
|
label := ctx.FormString(fmt.Sprintf("stat_label_%d", i))
|
|
|
|
|
if value == "" && label == "" {
|
|
|
|
@@ -270,7 +270,7 @@ func PagesContentPost(ctx *context.Context) {
|
|
|
|
|
config.Stats = append(config.Stats, pages_module.StatConfig{Value: value, Label: label})
|
|
|
|
|
}
|
|
|
|
|
config.ValueProps = nil
|
|
|
|
|
for i := 0; i < 10; i++ {
|
|
|
|
|
for i := range 10 {
|
|
|
|
|
title := ctx.FormString(fmt.Sprintf("valueprop_title_%d", i))
|
|
|
|
|
desc := ctx.FormString(fmt.Sprintf("valueprop_desc_%d", i))
|
|
|
|
|
icon := ctx.FormString(fmt.Sprintf("valueprop_icon_%d", i))
|
|
|
|
@@ -280,7 +280,7 @@ func PagesContentPost(ctx *context.Context) {
|
|
|
|
|
config.ValueProps = append(config.ValueProps, pages_module.ValuePropConfig{Title: title, Description: desc, Icon: icon})
|
|
|
|
|
}
|
|
|
|
|
config.Features = nil
|
|
|
|
|
for i := 0; i < 20; i++ {
|
|
|
|
|
for i := range 20 {
|
|
|
|
|
title := ctx.FormString(fmt.Sprintf("feature_title_%d", i))
|
|
|
|
|
desc := ctx.FormString(fmt.Sprintf("feature_desc_%d", i))
|
|
|
|
|
icon := ctx.FormString(fmt.Sprintf("feature_icon_%d", i))
|
|
|
|
@@ -309,7 +309,7 @@ func PagesSocial(ctx *context.Context) {
|
|
|
|
|
func PagesSocialPost(ctx *context.Context) {
|
|
|
|
|
config := getPagesLandingConfig(ctx)
|
|
|
|
|
config.SocialProof.Logos = nil
|
|
|
|
|
for i := 0; i < 20; i++ {
|
|
|
|
|
for i := range 20 {
|
|
|
|
|
logo := ctx.FormString(fmt.Sprintf("logo_%d", i))
|
|
|
|
|
if logo == "" {
|
|
|
|
|
continue
|
|
|
|
@@ -317,7 +317,7 @@ func PagesSocialPost(ctx *context.Context) {
|
|
|
|
|
config.SocialProof.Logos = append(config.SocialProof.Logos, logo)
|
|
|
|
|
}
|
|
|
|
|
config.SocialProof.Testimonials = nil
|
|
|
|
|
for i := 0; i < 10; i++ {
|
|
|
|
|
for i := range 10 {
|
|
|
|
|
quote := ctx.FormString(fmt.Sprintf("testimonial_quote_%d", i))
|
|
|
|
|
author := ctx.FormString(fmt.Sprintf("testimonial_author_%d", i))
|
|
|
|
|
role := ctx.FormString(fmt.Sprintf("testimonial_role_%d", i))
|
|
|
|
@@ -348,7 +348,7 @@ func PagesPricingPost(ctx *context.Context) {
|
|
|
|
|
config.Pricing.Headline = ctx.FormString("pricing_headline")
|
|
|
|
|
config.Pricing.Subheadline = ctx.FormString("pricing_subheadline")
|
|
|
|
|
config.Pricing.Plans = nil
|
|
|
|
|
for i := 0; i < 5; i++ {
|
|
|
|
|
for i := range 5 {
|
|
|
|
|
name := ctx.FormString(fmt.Sprintf("plan_name_%d", i))
|
|
|
|
|
price := ctx.FormString(fmt.Sprintf("plan_price_%d", i))
|
|
|
|
|
if name == "" && price == "" {
|
|
|
|
@@ -356,7 +356,7 @@ func PagesPricingPost(ctx *context.Context) {
|
|
|
|
|
}
|
|
|
|
|
featuresText := ctx.FormString(fmt.Sprintf("plan_%d_features", i))
|
|
|
|
|
var features []string
|
|
|
|
|
for _, f := range strings.Split(featuresText, "\n") {
|
|
|
|
|
for f := range strings.SplitSeq(featuresText, "\n") {
|
|
|
|
|
f = strings.TrimSpace(f)
|
|
|
|
|
if f != "" {
|
|
|
|
|
features = append(features, f)
|
|
|
|
@@ -393,7 +393,7 @@ func PagesFooterPost(ctx *context.Context) {
|
|
|
|
|
config.CTASection.Button.Variant = ctx.FormString("cta_button_variant")
|
|
|
|
|
config.Footer.Copyright = ctx.FormString("footer_copyright")
|
|
|
|
|
config.Footer.Links = nil
|
|
|
|
|
for i := 0; i < 10; i++ {
|
|
|
|
|
for i := range 10 {
|
|
|
|
|
label := ctx.FormString(fmt.Sprintf("footer_link_label_%d", i))
|
|
|
|
|
url := ctx.FormString(fmt.Sprintf("footer_link_url_%d", i))
|
|
|
|
|
if label == "" && url == "" {
|
|
|
|
@@ -402,7 +402,7 @@ func PagesFooterPost(ctx *context.Context) {
|
|
|
|
|
config.Footer.Links = append(config.Footer.Links, pages_module.FooterLink{Label: label, URL: url})
|
|
|
|
|
}
|
|
|
|
|
config.Footer.Social = nil
|
|
|
|
|
for i := 0; i < 10; i++ {
|
|
|
|
|
for i := range 10 {
|
|
|
|
|
platform := ctx.FormString(fmt.Sprintf("social_platform_%d", i))
|
|
|
|
|
url := ctx.FormString(fmt.Sprintf("social_url_%d", i))
|
|
|
|
|
if platform == "" && url == "" {
|
|
|
|
@@ -433,7 +433,12 @@ func PagesThemePost(ctx *context.Context) {
|
|
|
|
|
config.Theme.Mode = ctx.FormString("theme_mode")
|
|
|
|
|
config.SEO.Title = ctx.FormString("seo_title")
|
|
|
|
|
config.SEO.Description = ctx.FormString("seo_description")
|
|
|
|
|
keywords := ctx.FormString("seo_keywords"); if keywords != "" { config.SEO.Keywords = strings.Split(keywords, ",") } else { config.SEO.Keywords = nil }
|
|
|
|
|
keywords := ctx.FormString("seo_keywords")
|
|
|
|
|
if keywords != "" {
|
|
|
|
|
config.SEO.Keywords = strings.Split(keywords, ",")
|
|
|
|
|
} else {
|
|
|
|
|
config.SEO.Keywords = nil
|
|
|
|
|
}
|
|
|
|
|
config.SEO.OGImage = ctx.FormString("og_image")
|
|
|
|
|
if err := savePagesLandingConfig(ctx, config); err != nil {
|
|
|
|
|
ctx.ServerError("SavePagesConfig", err)
|
|
|
|
|