package types import ( "html/template" "strconv" "github.com/GoAdminGroup/go-admin/context" "github.com/GoAdminGroup/go-admin/modules/language" "github.com/GoAdminGroup/go-admin/modules/utils" ) type DefaultSelection struct { *BaseButton Options FieldOptions Placeholder string Width int } func btnUUID() string { return "info-btn-" + utils.Uuid(10) } func GetDefaultSelection(placeholder string, options FieldOptions, action Action, widths ...int) *DefaultSelection { id := btnUUID() action.SetBtnId("." + id) var width = 100 if len(widths) > 0 { width = widths[0] } node := action.GetCallbacks() return &DefaultSelection{ BaseButton: &BaseButton{ Id: id, Action: action, Url: node.Path, Method: node.Method, }, Placeholder: placeholder, Width: width, Options: options, } } func (b *DefaultSelection) Content(ctx *context.Context) (template.HTML, template.JS) { optionsHtml := `` for _, op := range b.Options { optionsHtml += `` } h := template.HTML(`