I came here looking for an answer to the same question.
SInce there doesn't seem to be one though, I had a look at the controller getName function and it doesn't (at least to my angular noob eyes) look like there is a way to do this with a template. So what I did was simply change the string literal "Item" that is used in the default name to "Block".
File is located App_Plugins\NestedContent\Js\nestedcontent.controllers.js and the string to change is on line 81.
Thanks for the headsup Suzyb - have since checked and it is now Line 196 of App_Plugins\NestedContent\Js\nestedcontent.controllers.js :
var name = "Item " + (idx + 1);
I extended this slightly - I needed to be able to view and edit the titles of each nested content item. This may not be exactly right but what I did was:
create a new docType called "NC - Shared - Item Title" with a single property called "Title"
added it via composition to each of my Nested Content items (e.g. "NC - Info Text Slice")
changed the Nested Content nestedcontent.controllers.js code as follows:
$scope.getName = function (idx) {
if ($scope.model.value[idx]) {
if ($scope.model.value[idx].title)
{
name = $scope.model.value[idx].title;
}
else
{
name = "Item " + (idx + 1);
}
This now takes my newly added "title" property instead of "Item " + x, but if title is missing it should use Item X instead. Changing the title immediately changes it in the back-end:
Of course test this and customise this to your own specific needs/feedback any bugs - but hopefully it gives a further option in terms of adding a title and helping to work through long lists of nested content items (have seen this done on a list of locations before).
Just found my own post after coming across the issue again, and you're totally right Ashkan. I clicked to expand the help text next to the "Add" button and it does tell you how to do this:
Can confirm, works without needing to edit the code :D
Changing 'item 1' to 'something 1'
Is it possible to change the 'Name Template' so it displays a word of my choosing followed by the index number. I've tried a few things like:
Content Block {{id}}
Content Block {{index}}
Content Block {{$index}}
Thanks for any help you can give and for creating a great package!!
Can anyone help provide an answer to my question? Many thanks, James
I came here looking for an answer to the same question.
SInce there doesn't seem to be one though, I had a look at the controller getName function and it doesn't (at least to my angular noob eyes) look like there is a way to do this with a template. So what I did was simply change the string literal "Item" that is used in the default name to "Block".
File is located App_Plugins\NestedContent\Js\nestedcontent.controllers.js and the string to change is on line 81.
Hi Suzyb,
That has given me a solution to my problem. Thank you very much!
James
Thanks for the headsup Suzyb - have since checked and it is now Line 196 of App_Plugins\NestedContent\Js\nestedcontent.controllers.js :
I extended this slightly - I needed to be able to view and edit the titles of each nested content item. This may not be exactly right but what I did was:
changed the Nested Content nestedcontent.controllers.js code as follows:
This now takes my newly added "title" property instead of "Item " + x, but if title is missing it should use Item X instead. Changing the title immediately changes it in the back-end:
Of course test this and customise this to your own specific needs/feedback any bugs - but hopefully it gives a further option in terms of adding a title and helping to work through long lists of nested content items (have seen this done on a list of locations before).
Emma
Strange, but I was able to do it very easily.
Thanks Ashkan! I was wondering what
Name Template
was meant for. Now understood.Hi,
Just found my own post after coming across the issue again, and you're totally right Ashkan. I clicked to expand the help text next to the "Add" button and it does tell you how to do this:
Can confirm, works without needing to edit the code :D
Emma
Does anyone know how to style these separately?
Just to update this based on the Nested Content in Core (and have tested on Umbraco Version 8)
If my property name is "propertyName" and I want the Name and number to be included in the Nested Content view, the syntax in the template editor is:
This will show:
This is as per Dave Woestenborghs reply https://our.umbraco.com/packages/backoffice-extensions/nested-content/nested-content-feedback/91350-nested-content-template-field and the documentaiton https://our.umbraco.com/documentation/Getting-Started/Backoffice/Property-Editors/Built-in-Property-Editors/Nested-Content/#configuring-nested-content
This question is pretty old and has been pretty well answered, but just wanted to add that you can also combine plain text with calculated values like
Which of course would generate "Column 1" etc
is working on a reply...