Skip to content

Commit

Permalink
Merge pull request josdejong#405 from israelito3000/feature/template_…
Browse files Browse the repository at this point in the history
…properties

Feature/rename template properties.
  • Loading branch information
josdejong authored May 25, 2017
2 parents 0ddc940 + 75ecd91 commit c20e243
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 10 deletions.
15 changes: 9 additions & 6 deletions examples/10_templates.html
Original file line number Diff line number Diff line change
Expand Up @@ -39,18 +39,21 @@ <h1>Item templates</h1>
var options = {
templates: [
{
menu: 'Person',
name: 'PersonTemplate',
data: {
text: 'Person',
title: 'Insert a Person Node',
className: 'jsoneditor-type-object',
field: 'PersonTemplate',
value: {
'firstName': 'John',
'lastName': 'Do',
'age': 28
}
},
{
menu: 'Address',
name: 'AddressTemplate',
data: {
text: 'Address',
title: 'Insert a Address Node',
field: 'AddressTemplate',
value: {
'street': "",
'city': "",
'state': "",
Expand Down
8 changes: 4 additions & 4 deletions src/js/Node.js
Original file line number Diff line number Diff line change
Expand Up @@ -3193,10 +3193,10 @@ Node.prototype.addTemplates = function (menu, append) {
};
templates.forEach(function (template) {
menu.push({
text: template.menu,
className: (template.class || 'jsoneditor-type-object'),
title: template.menu,
click: (append ? appendData.bind(this, template.name, template.data) : insertData.bind(this, template.name, template.data))
text: template.text,
className: (template.className || 'jsoneditor-type-object'),
title: template.title,
click: (append ? appendData.bind(this, template.field, template.value) : insertData.bind(this, template.field, template.value))
});
});
};
Expand Down

0 comments on commit c20e243

Please sign in to comment.