Progresses on #76

This commit is contained in:
Henrique Dias 2016-06-19 14:48:17 +01:00
parent ef04101eee
commit a397e89d20
2 changed files with 2 additions and 6 deletions

View File

@ -4,7 +4,7 @@
{{ if or (eq $value.Type "object") (eq $value.Type "array") }}
<fieldset id="{{ $value.Name }}" data-type="{{ $value.Type }}">
<h3>{{ SplitCapitalize $value.Title }}</h3>
<button class="delete">remove</button>
<button class="delete" data-delete="{{ $value.Name }}">remove</button>
{{ if (eq $value.Type "array") }}<div class="itens">{{ end }}{{ template "frontmatter" $value.Content }}{{ if (eq $value.Type "array") }}<button class="add">&#43;</button></div>{{ end }}
</fieldset>
{{ else }}

View File

@ -254,11 +254,7 @@ $(document).on('page:editor', function() {
$("#content").on('click', '.delete', function(event) {
event.preventDefault();
button = $(this);
name = button.parent().parent().attr("for") || button.parent().parent().attr("id") || button.parent().parent().parent().attr("id");
name = name.replace(/\[/, '\\[');
name = name.replace(/\]/, '\\]');
name = $(this).data("delete");
$('label[for="' + name + '"]').fadeOut().remove();
$('#' + name).fadeOut().remove();