package web import ( "net/http" "videoweb/app/service/configser" "github.com/gin-gonic/gin" ) var dialogTemplates = map[string]string{ "download": "downloadAppDialog", "login": "loginDialog", "register": "registerDialog", "search": "searchDialog", } // DialogFragment renders only the requested dialog body. Styles and behavior // are loaded by dialogLoader.js after the first user interaction. func DialogFragment(c *gin.Context) { name := c.Param("name") templateName, ok := dialogTemplates[name] if !ok { c.Status(http.StatusNotFound) return } data := gin.H{} if name == "download" { data["appConfig"] = configser.FetchAppConfigVMOrEmpty(c) } c.Header("Cache-Control", "private, max-age=300") c.HTML(http.StatusOK, templateName, data) }