0
votes

I'm able to create a page template of modules and copy it to a new page fine.

Problem is that this template page consists of modules that close the view picker without editing/adding any data and as a result have only one single multiple of each module.

My aim is to create a template page of modules that have a row of three modules already placed on the template page but when I copy this it links the multiples with the original template (I presume it considers adding a multiple of three to a module is entering data which breaks the copy template procedure?).

Is there a work around that I can have a module always drop on as a multiple of 3 for a link list template?

Thx

1
I'm not sure if I get the question. Let me try to rephrase it: You have a list of items (tiles, link-blocks or something) and you want to see 3 items in the preview so it looks nice. And your issues is that it only has one if you don't fully initialize the module - which you need to create a template-page. correct? - iJungleBoy
Yes exactly, I want to preview 3 items without initializing the module so as to allow me to create a template of the page. Currently I can only achieve this with one item previews. I guess I'm asking is there a way to drop 3 item previews down each time a module is placed on a page? - denisjoconnor

1 Answers

1
votes

Basically your special wish is to create a more complex preview than the default preview provides. In this case the strategy is as follows:

  1. in your template, detect that you are showing the preview item
  2. show the optimized preview as you want it

How is this done? Basically the preview-item can be detected with high reliability either with the entityID, or the guid (if you want to guarantee that this functionality works after app-export/re-import).

The code is ca. like this

// detect the demo item, because we shouldn't add inner content while still showing this one
var isDemoItem = Content.EntityGuid.ToString() == "e90752f1-29d5-46a3-984c-408d97feae91"; // use your demo-item guid here
var fakeList = new List<DynamicEntity>();
fakeList.Add(Content);
fakeList.Add(Content);
fakeList.Add(Content);

@foreach (var Content in ( isDemoItem ? fakeList : AsDynamic(Data["Default"]) ))
{
    ...
}

Our content-accordeon app (not yet published, but visible in github) uses a similar strategy, to ensure that the demo-accordeon doesn't accidentally get content inside it in the preview-item

https://github.com/2sic/app-accordion-bootstrap3/blob/master/_Accordion.cshtml