Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fixed problem with saving multiple repeaters closes #59 closes #167 #169

Merged
merged 1 commit into from
Jun 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions system/admin/handlers.go
Original file line number Diff line number Diff line change
Expand Up @@ -1851,15 +1851,16 @@ func editHandler(res http.ResponseWriter, req *http.Request) {
// and correctly format for db storage. Essentially, we need
// fieldX.0: value1, fieldX.1: value2 => fieldX: []string{value1, value2}
fieldOrderValue := make(map[string]map[string][]string)
ordVal := make(map[string][]string)
for k, v := range req.PostForm {
if strings.Contains(k, ".") {
fo := strings.Split(k, ".")

// put the order and the field value into map
field := string(fo[0])
order := string(fo[1])
fieldOrderValue[field] = ordVal
if len(fieldOrderValue[field]) == 0 {
fieldOrderValue[field] = make(map[string][]string)
}

// orderValue is 0:[?type=Thing&id=1]
orderValue := fieldOrderValue[field]
Expand Down
5 changes: 3 additions & 2 deletions system/api/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,16 @@ func createContentHandler(res http.ResponseWriter, req *http.Request) {
// and correctly format for db storage. Essentially, we need
// fieldX.0: value1, fieldX.1: value2 => fieldX: []string{value1, value2}
fieldOrderValue := make(map[string]map[string][]string)
ordVal := make(map[string][]string)
for k, v := range req.PostForm {
if strings.Contains(k, ".") {
fo := strings.Split(k, ".")

// put the order and the field value into map
field := string(fo[0])
order := string(fo[1])
fieldOrderValue[field] = ordVal
if len(fieldOrderValue[field]) == 0 {
fieldOrderValue[field] = make(map[string][]string)
}

// orderValue is 0:[?type=Thing&id=1]
orderValue := fieldOrderValue[field]
Expand Down
5 changes: 3 additions & 2 deletions system/api/update.go
Original file line number Diff line number Diff line change
Expand Up @@ -84,15 +84,16 @@ func updateContentHandler(res http.ResponseWriter, req *http.Request) {
// and correctly format for db storage. Essentially, we need
// fieldX.0: value1, fieldX.1: value2 => fieldX: []string{value1, value2}
fieldOrderValue := make(map[string]map[string][]string)
ordVal := make(map[string][]string)
for k, v := range req.PostForm {
if strings.Contains(k, ".") {
fo := strings.Split(k, ".")

// put the order and the field value into map
field := string(fo[0])
order := string(fo[1])
fieldOrderValue[field] = ordVal
if len(fieldOrderValue[field]) == 0 {
fieldOrderValue[field] = make(map[string][]string)
}

// orderValue is 0:[?type=Thing&id=1]
orderValue := fieldOrderValue[field]
Expand Down
5 changes: 3 additions & 2 deletions system/db/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,15 +36,16 @@ func SetConfig(data url.Values) error {
// and correctly format for db storage. Essentially, we need
// fieldX.0: value1, fieldX.1: value2 => fieldX: []string{value1, value2}
fieldOrderValue := make(map[string]map[string][]string)
ordVal := make(map[string][]string)
for k, v := range data {
if strings.Contains(k, ".") {
fo := strings.Split(k, ".")

// put the order and the field value into map
field := string(fo[0])
order := string(fo[1])
fieldOrderValue[field] = ordVal
if len(fieldOrderValue[field]) == 0 {
fieldOrderValue[field] = make(map[string][]string)
}

// orderValue is 0:[?type=Thing&id=1]
orderValue := fieldOrderValue[field]
Expand Down