edit loads

This commit is contained in:
Dan Ballard 2015-09-22 08:30:51 -07:00
parent 4e632602f4
commit 0b17312c22
2 changed files with 6 additions and 8 deletions

View File

@ -204,7 +204,7 @@ func editFormHandler(w http.ResponseWriter, r *http.Request, user *user.User, se
}
session.Save(r, w)
ShowTemplate("post", w, map[string]interface{}{"user": user, "flashes": flashes, "categories": categories.CategoriesTree, "link": newsItem.Url, "title": newsItem.Title, "notes": newsItem.Notes, "popup": false, "category": newsItem.Category_id, "id": newsItem.Id()})
ShowTemplate("post", w, map[string]interface{}{"user": user, "flashes": flashes, "categories": categories.CategoriesTree, "link": newsItem.Url, "title": newsItem.Title, "notes": newsItem.Notes, "popup": false, "category_id": newsItem.Category_id, "id": newsItem.Id()})
return
}
@ -225,8 +225,6 @@ func editPostHandler(w http.ResponseWriter, r *http.Request, user *user.User, se
popup := r.FormValue("popup")
category_id, err := strconv.Atoi(r.FormValue("category"))
if err != nil {
var flashes = make(map[string]interface{})

View File

@ -11,7 +11,7 @@
<select class="form-control add-category" name="category" placeholder="Category">
<option value="-1">-- Pick a Category --</option>
{{range $category := .categories}}
{{template "option-category" dict "category" $category "category_id" .category_id}}
{{template "option-category" dict "category" $category "category_id" $.category_id}}
{{end}}
</select>
</div>
@ -24,8 +24,8 @@
{{define "option-category"}}
<option value="{{$category.Id}}" {{if eq $category.Id $category_id}}selected="true"{{end}} >{{$category.ToString}}</option>
{{range $child := $category.Children}}
{{template "option-category" dict "category" $child "category_id" .category_id}}
{{end}}
<option value="{{.category.Id}}" {{if eq .category.Id .category_id}}selected="true"{{end}} >{{.category.ToString}}</option>
{{range $child := .category.Children}}
{{template "option-category" dict "category" $child "category_id" $.category_id}}
{{end}}
{{end}}