added UUID to card and form field
This commit is contained in:
@@ -90,6 +90,7 @@ type cardSection struct {
|
|||||||
|
|
||||||
// card represents a card in the card section
|
// card represents a card in the card section
|
||||||
type card struct {
|
type card struct {
|
||||||
|
ID string `bson:"id" json:"id"`
|
||||||
Icon string `bson:"icon"`
|
Icon string `bson:"icon"`
|
||||||
Title string `bson:"title"`
|
Title string `bson:"title"`
|
||||||
Description string `bson:"description"`
|
Description string `bson:"description"`
|
||||||
@@ -105,6 +106,7 @@ type contactSection struct {
|
|||||||
|
|
||||||
// formField represents a form field in the contact section
|
// formField represents a form field in the contact section
|
||||||
type formField struct {
|
type formField struct {
|
||||||
|
ID string `bson:"id" json:"id"`
|
||||||
Name string `bson:"name"`
|
Name string `bson:"name"`
|
||||||
Label string `bson:"label"`
|
Label string `bson:"label"`
|
||||||
Placeholder string `bson:"placeholder"`
|
Placeholder string `bson:"placeholder"`
|
||||||
|
|||||||
+11
-2
@@ -310,7 +310,12 @@ func (s *cmsService) copyFormToEntity(form *CMSForm, cms *CMS) {
|
|||||||
if len(form.Contact.Fields) > 0 {
|
if len(form.Contact.Fields) > 0 {
|
||||||
cms.Contact.Fields = make([]formField, len(form.Contact.Fields))
|
cms.Contact.Fields = make([]formField, len(form.Contact.Fields))
|
||||||
for i, field := range form.Contact.Fields {
|
for i, field := range form.Contact.Fields {
|
||||||
cms.Contact.Fields[i] = formField(field)
|
cms.Contact.Fields[i] = formField{
|
||||||
|
Name: field.Name,
|
||||||
|
Label: field.Label,
|
||||||
|
Placeholder: field.Placeholder,
|
||||||
|
Required: field.Required,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -343,7 +348,11 @@ func (s *cmsService) copyCardSectionForm(formSection *cardSectionForm, entitySec
|
|||||||
if len(formSection.Cards) > 0 {
|
if len(formSection.Cards) > 0 {
|
||||||
entitySection.Cards = make([]card, len(formSection.Cards))
|
entitySection.Cards = make([]card, len(formSection.Cards))
|
||||||
for i, cardForm := range formSection.Cards {
|
for i, cardForm := range formSection.Cards {
|
||||||
entitySection.Cards[i] = card(cardForm)
|
entitySection.Cards[i] = card{
|
||||||
|
Icon: cardForm.Icon,
|
||||||
|
Title: cardForm.Title,
|
||||||
|
Description: cardForm.Description,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user