remove name print; add js to add item when there's nothing left

pull/144/head
Henrique Dias 2016-06-27 21:45:42 +01:00
parent a7bffd2e76
commit 2c22f06b03
2 changed files with 8 additions and 5 deletions

View File

@ -621,7 +621,14 @@ var addFrontMatterItem = function(event) {
document.getElementById(bid).querySelector('.action.add').addEventListener('click', addFrontMatterItem);
break;
default:
block.querySelector('.group').insertAdjacentHTML('beforeend', `<div class="block" id="block-${bid}" data-content="${bid}">
let group = block.querySelector('.group');
if (group == null) {
block.insertAdjacentHTML('afterbegin', '<div class="group"></div>');
group = block.querySelector('.group');
}
group.insertAdjacentHTML('beforeend', `<div class="block" id="block-${bid}" data-content="${bid}">
<label for="${bid}">${name}</label>
<input name="${bid}" id="${bid}" type="text" data-parent-type="object"></input>
<div class="action delete" data-delete="block-${bid}">

View File

@ -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
}