edit loads
This commit is contained in:
parent
4e632602f4
commit
0b17312c22
|
@ -204,7 +204,7 @@ func editFormHandler(w http.ResponseWriter, r *http.Request, user *user.User, se
|
||||||
}
|
}
|
||||||
|
|
||||||
session.Save(r, w)
|
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
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -225,8 +225,6 @@ func editPostHandler(w http.ResponseWriter, r *http.Request, user *user.User, se
|
||||||
|
|
||||||
popup := r.FormValue("popup")
|
popup := r.FormValue("popup")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
category_id, err := strconv.Atoi(r.FormValue("category"))
|
category_id, err := strconv.Atoi(r.FormValue("category"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
var flashes = make(map[string]interface{})
|
var flashes = make(map[string]interface{})
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<select class="form-control add-category" name="category" placeholder="Category">
|
<select class="form-control add-category" name="category" placeholder="Category">
|
||||||
<option value="-1">-- Pick a Category --</option>
|
<option value="-1">-- Pick a Category --</option>
|
||||||
{{range $category := .categories}}
|
{{range $category := .categories}}
|
||||||
{{template "option-category" dict "category" $category "category_id" .category_id}}
|
{{template "option-category" dict "category" $category "category_id" $.category_id}}
|
||||||
{{end}}
|
{{end}}
|
||||||
</select>
|
</select>
|
||||||
</div>
|
</div>
|
||||||
|
@ -24,8 +24,8 @@
|
||||||
|
|
||||||
|
|
||||||
{{define "option-category"}}
|
{{define "option-category"}}
|
||||||
<option value="{{$category.Id}}" {{if eq $category.Id $category_id}}selected="true"{{end}} >{{$category.ToString}}</option>
|
<option value="{{.category.Id}}" {{if eq .category.Id .category_id}}selected="true"{{end}} >{{.category.ToString}}</option>
|
||||||
{{range $child := $category.Children}}
|
{{range $child := .category.Children}}
|
||||||
{{template "option-category" dict "category" $child "category_id" .category_id}}
|
{{template "option-category" dict "category" $child "category_id" $.category_id}}
|
||||||
{{end}}
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
Loading…
Reference in New Issue