Add weight to page create
This commit is contained in:
@@ -276,6 +276,12 @@
|
||||
"required": false,
|
||||
"title": "Description"
|
||||
},
|
||||
{
|
||||
"type": "int",
|
||||
"name": "weight",
|
||||
"required": false,
|
||||
"title": "Page tree weight"
|
||||
},
|
||||
{
|
||||
"type": "bool",
|
||||
"name": "visible",
|
||||
|
||||
@@ -113,6 +113,12 @@
|
||||
"title": "Description",
|
||||
"type": "string"
|
||||
},
|
||||
{
|
||||
"name": "weight",
|
||||
"required": false,
|
||||
"title": "Page tree weight",
|
||||
"type": "int"
|
||||
},
|
||||
{
|
||||
"name": "visible",
|
||||
"required": false,
|
||||
|
||||
@@ -87,6 +87,7 @@ func (ctrl *Page) Create(ctx context.Context, r *request.PageCreate) (interface{
|
||||
Handle: r.Handle,
|
||||
Description: r.Description,
|
||||
Visible: r.Visible,
|
||||
Weight: r.Weight,
|
||||
}
|
||||
)
|
||||
|
||||
|
||||
@@ -192,6 +192,10 @@ type PageCreate struct {
|
||||
rawDescription string
|
||||
Description string
|
||||
|
||||
hasWeight bool
|
||||
rawWeight string
|
||||
Weight int
|
||||
|
||||
hasVisible bool
|
||||
rawVisible string
|
||||
Visible bool
|
||||
@@ -279,6 +283,11 @@ func (r *PageCreate) Fill(req *http.Request) (err error) {
|
||||
r.rawDescription = val
|
||||
r.Description = val
|
||||
}
|
||||
if val, ok := post["weight"]; ok {
|
||||
r.hasWeight = true
|
||||
r.rawWeight = val
|
||||
r.Weight = parseInt(val)
|
||||
}
|
||||
if val, ok := post["visible"]; ok {
|
||||
r.hasVisible = true
|
||||
r.rawVisible = val
|
||||
@@ -1078,6 +1087,21 @@ func (r *PageCreate) GetDescription() string {
|
||||
return r.Description
|
||||
}
|
||||
|
||||
// HasWeight returns true if weight was set
|
||||
func (r *PageCreate) HasWeight() bool {
|
||||
return r.hasWeight
|
||||
}
|
||||
|
||||
// RawWeight returns raw value of weight parameter
|
||||
func (r *PageCreate) RawWeight() string {
|
||||
return r.rawWeight
|
||||
}
|
||||
|
||||
// GetWeight returns casted value of weight parameter
|
||||
func (r *PageCreate) GetWeight() int {
|
||||
return r.Weight
|
||||
}
|
||||
|
||||
// HasVisible returns true if visible was set
|
||||
func (r *PageCreate) HasVisible() bool {
|
||||
return r.hasVisible
|
||||
|
||||
Reference in New Issue
Block a user