Progresses on #76

pull/78/head
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") }} {{ if or (eq $value.Type "object") (eq $value.Type "array") }}
<fieldset id="{{ $value.Name }}" data-type="{{ $value.Type }}"> <fieldset id="{{ $value.Name }}" data-type="{{ $value.Type }}">
<h3>{{ SplitCapitalize $value.Title }}</h3> <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 }} {{ 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> </fieldset>
{{ else }} {{ else }}

View File

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