From 2c22f06b03d7cdbf1188fe40b4f56fb7b37c1dd2 Mon Sep 17 00:00:00 2001 From: Henrique Dias Date: Mon, 27 Jun 2016 21:45:42 +0100 Subject: [PATCH] remove name print; add js to add item when there's nothing left --- assets/public/js/application.js | 9 ++++++++- internal/file/update.go | 4 ---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/assets/public/js/application.js b/assets/public/js/application.js index be19c825..f0292722 100644 --- a/assets/public/js/application.js +++ b/assets/public/js/application.js @@ -621,7 +621,14 @@ var addFrontMatterItem = function(event) { document.getElementById(bid).querySelector('.action.add').addEventListener('click', addFrontMatterItem); break; default: - block.querySelector('.group').insertAdjacentHTML('beforeend', `
+ let group = block.querySelector('.group'); + + if (group == null) { + block.insertAdjacentHTML('afterbegin', '
'); + group = block.querySelector('.group'); + } + + group.insertAdjacentHTML('beforeend', `
diff --git a/internal/file/update.go b/internal/file/update.go index fe473488..3d07d70e 100644 --- a/internal/file/update.go +++ b/internal/file/update.go @@ -4,7 +4,6 @@ import ( "bytes" "encoding/json" "errors" - "fmt" "io/ioutil" "net/http" "path/filepath" @@ -19,9 +18,6 @@ func (i *Info) Update(w http.ResponseWriter, r *http.Request, c *config.Config) var data map[string]interface{} kind := r.Header.Get("kind") - // TODO: remove - fmt.Println(i.Name) - if kind == "" { return http.StatusBadRequest, nil }