updates
parent
94a71a6eb3
commit
7a2f1965e3
File diff suppressed because one or more lines are too long
|
@ -280,12 +280,13 @@ $(document).on('ready pjax:success', function() {
|
||||||
fieldset = $(this).parent().parent();
|
fieldset = $(this).parent().parent();
|
||||||
type = fieldset.data("type");
|
type = fieldset.data("type");
|
||||||
name = fieldset.attr("id");
|
name = fieldset.attr("id");
|
||||||
|
newItem = "";
|
||||||
|
|
||||||
// Main add button, below the title
|
// Main add button, below the title
|
||||||
if (fieldset.is('div') && fieldset.hasClass("frontmatter")) {
|
if (fieldset.is('div') && fieldset.hasClass("frontmatter")) {
|
||||||
fieldset = $('.blocks');
|
fieldset = $('.blocks');
|
||||||
fieldset.prepend('<div class="block" id="' + defaultId + '"></div>');
|
fieldset.prepend('<div class="block" id="' + defaultId + '"></div>');
|
||||||
title = $("#" + defaultId);
|
newItem = $("#" + defaultId);
|
||||||
type = "object";
|
type = "object";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -299,16 +300,9 @@ $(document).on('ready pjax:success', function() {
|
||||||
fieldset.append('<div id="' + name + '-' + $(input).length + '" data-type="array-item"><input name="' + name + ':auto" id="' + name + '"></input><span class="actions"> <button class="delete">−</button></span></div></div>');
|
fieldset.append('<div id="' + name + '-' + $(input).length + '" data-type="array-item"><input name="' + name + ':auto" id="' + name + '"></input><span class="actions"> <button class="delete">−</button></span></div></div>');
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
|
|
||||||
/* WHAT IS THIS FOR?
|
|
||||||
if (title.is('h2')) {
|
|
||||||
type = "object"
|
|
||||||
}
|
|
||||||
|
|
||||||
if (type == "object") {
|
if (type == "object") {
|
||||||
fieldset.after('<input id="new-admin-item-123" placeholder="Write the field name and press enter..."></input>');
|
newItem.html('<input id="name-' + defaultId + '" placeholder="Write the field name and press enter..."></input>');
|
||||||
element = $("#new-admin-item-123");
|
element = $("#name-" + defaultId);
|
||||||
|
|
||||||
if (!document.cookie.replace(/(?:(?:^|.*;\s*)placeholdertip\s*\=\s*([^;]*).*$)|^.*$/, "$1")) {
|
if (!document.cookie.replace(/(?:(?:^|.*;\s*)placeholdertip\s*\=\s*([^;]*).*$)|^.*$/, "$1")) {
|
||||||
var date = new Date();
|
var date = new Date();
|
||||||
|
@ -327,7 +321,7 @@ $(document).on('ready pjax:success', function() {
|
||||||
value = element.val();
|
value = element.val();
|
||||||
|
|
||||||
if (value == "") {
|
if (value == "") {
|
||||||
element.remove();
|
newItem.remove();
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -350,8 +344,8 @@ $(document).on('ready pjax:success', function() {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (elements.length == 1) {
|
if (elements.length == 1) {
|
||||||
title.after('<input name="' + name + ':auto" id="' + name + '"></input><br>');
|
newItem.append('<input name="' + name + ':auto" id="' + name + '"></input><br>');
|
||||||
title.after('<label for="' + name + '">' + value + ' <span class="actions"><button class="delete"><i class="fa fa-minus"></i></button></span></label>');
|
newItem.prepend('<label for="' + name + '">' + value + '</label> <span class="actions"><button class="delete">−</button></span>');
|
||||||
} else {
|
} else {
|
||||||
var fieldset = "<fieldset id=\"{{ $value.Name }}\" data-type=\"{{ $value.Type }}\">\r\n<h3>{{ $value.Title }}\r\n<span class=\"actions\">\r\n<button class=\"add\"><i class=\"fa fa-plus\"><\/i><\/button>\r\n<button class=\"delete\"><i class=\"fa fa-minus\"><\/i><\/button>\r\n<\/span>\r\n<\/h3>\r\n<\/fieldset>";
|
var fieldset = "<fieldset id=\"{{ $value.Name }}\" data-type=\"{{ $value.Type }}\">\r\n<h3>{{ $value.Title }}\r\n<span class=\"actions\">\r\n<button class=\"add\"><i class=\"fa fa-plus\"><\/i><\/button>\r\n<button class=\"delete\"><i class=\"fa fa-minus\"><\/i><\/button>\r\n<\/span>\r\n<\/h3>\r\n<\/fieldset>";
|
||||||
|
|
||||||
|
@ -363,7 +357,7 @@ $(document).on('ready pjax:success', function() {
|
||||||
|
|
||||||
fieldset = fieldset.replace("{{ $value.Title }}", elements[0]);
|
fieldset = fieldset.replace("{{ $value.Title }}", elements[0]);
|
||||||
fieldset = fieldset.replace("{{ $value.Name }}", name);
|
fieldset = fieldset.replace("{{ $value.Name }}", name);
|
||||||
title.after(fieldset);
|
newItem.after(fieldset);
|
||||||
}
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
@ -371,6 +365,15 @@ $(document).on('ready pjax:success', function() {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
|
||||||
|
/* WHAT IS THIS FOR?
|
||||||
|
if (title.is('h2')) {
|
||||||
|
type = "object"
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
|
|
Loading…
Reference in New Issue