-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmeta_collection_edit.go
More file actions
31 lines (26 loc) · 873 Bytes
/
meta_collection_edit.go
File metadata and controls
31 lines (26 loc) · 873 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
package admin
import (
"errors"
"github.com/qor/qor/resource"
)
// CollectionEditConfig meta configuration used for collection edit
type CollectionEditConfig struct {
Template string
Max uint
metaConfig
}
// GetTemplate get template for collection edit
func (collectionEditConfig CollectionEditConfig) GetTemplate(context *Context, metaType string) ([]byte, error) {
if metaType == "form" && collectionEditConfig.Template != "" {
return context.Asset(collectionEditConfig.Template)
}
return nil, errors.New("not implemented")
}
// ConfigureQorMeta configure collection edit meta
func (collectionEditConfig *CollectionEditConfig) ConfigureQorMeta(metaor resource.Metaor) {
if meta, ok := metaor.(*Meta); ok {
if meta.Permission != nil || meta.Resource.Permission != nil {
meta.Permission = meta.Permission.Concat(meta.Resource.Permission)
}
}
}