mirror of
https://github.com/Dvorinka/PPve.git
synced 2026-06-05 04:52:58 +00:00
please work finally
This commit is contained in:
@@ -74,6 +74,8 @@ type BannerStyle struct {
|
|||||||
ImagePosition string `json:"imagePosition"` // center, left, right
|
ImagePosition string `json:"imagePosition"` // center, left, right
|
||||||
ImageX int `json:"imageX"` // X position for custom
|
ImageX int `json:"imageX"` // X position for custom
|
||||||
ImageY int `json:"imageY"` // Y position for custom
|
ImageY int `json:"imageY"` // Y position for custom
|
||||||
|
Background string `json:"background,omitempty"`
|
||||||
|
ContainerStyle string `json:"containerStyle,omitempty"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var (
|
var (
|
||||||
@@ -194,6 +196,7 @@ func UpdateBannerHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
Text: r.FormValue("text"),
|
Text: r.FormValue("text"),
|
||||||
Link: r.FormValue("link"),
|
Link: r.FormValue("link"),
|
||||||
Style: BannerStyle{
|
Style: BannerStyle{
|
||||||
|
// Parse style values from form
|
||||||
BackgroundColor: r.FormValue("style[backgroundColor]"),
|
BackgroundColor: r.FormValue("style[backgroundColor]"),
|
||||||
TextColor: r.FormValue("style[textColor]"),
|
TextColor: r.FormValue("style[textColor]"),
|
||||||
TextAlign: r.FormValue("style[textAlign]"),
|
TextAlign: r.FormValue("style[textAlign]"),
|
||||||
@@ -201,14 +204,34 @@ func UpdateBannerHandler(w http.ResponseWriter, r *http.Request) {
|
|||||||
Padding: r.FormValue("style[padding]"),
|
Padding: r.FormValue("style[padding]"),
|
||||||
Margin: r.FormValue("style[margin]"),
|
Margin: r.FormValue("style[margin]"),
|
||||||
BorderRadius: r.FormValue("style[borderRadius]"),
|
BorderRadius: r.FormValue("style[borderRadius]"),
|
||||||
IsVisible: r.FormValue("style[isVisible]") == "true",
|
IsVisible: r.FormValue("isVisible") == "true" || r.FormValue("style[isVisible]") == "true",
|
||||||
// Add image position fields
|
// Add image position fields
|
||||||
ImagePosition: r.FormValue("style[imagePosition]"),
|
ImagePosition: r.FormValue("style[imagePosition]"),
|
||||||
ImageX: parseIntOrDefault(r.FormValue("style[imageX]"), 0),
|
ImageX: parseIntOrDefault(r.FormValue("style[imageX]"), 0),
|
||||||
ImageY: parseIntOrDefault(r.FormValue("style[imageY]"), 0),
|
ImageY: parseIntOrDefault(r.FormValue("style[imageY]"), 0),
|
||||||
|
// Additional style fields
|
||||||
|
Background: r.FormValue("style[background]"),
|
||||||
|
ContainerStyle: r.FormValue("style[containerStyle]"),
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Handle the background style (gradient or solid color)
|
||||||
|
if bgStyle := r.FormValue("style[background]"); bgStyle != "" {
|
||||||
|
if strings.Contains(bgStyle, "gradient") {
|
||||||
|
// If it's a gradient, use it as is
|
||||||
|
newBanner.Style.BackgroundColor = bgStyle
|
||||||
|
} else if bgStyle != newBanner.Style.BackgroundColor {
|
||||||
|
// If it's a different solid color, use it
|
||||||
|
newBanner.Style.BackgroundColor = bgStyle
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// Handle container style if present
|
||||||
|
if containerStyle := r.FormValue("style[containerStyle]"); containerStyle != "" {
|
||||||
|
// You can parse additional styles from containerStyle if needed
|
||||||
|
log.Printf("Container style received: %s", containerStyle)
|
||||||
|
}
|
||||||
|
|
||||||
// Log the banner data for debugging
|
// Log the banner data for debugging
|
||||||
log.Printf("Parsed banner data: %+v", newBanner)
|
log.Printf("Parsed banner data: %+v", newBanner)
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user