How you can create nested tabs in the backend? My task: create two new tabs within one tab. Let's say there are three tabs "Abc", "Def", and "Hig" with different fields inside. So, I need to create two new tabs (like the second level) inside the "Def" tab. How to do it? I didn't find a solution in the documentation.
The cleanest approach would be to use the nestedForm widget. Check out the documentation here: https://octobercms.com/docs/backend/forms#widget-nestedform
Related
I want to develop a simple app with a few screens:
List of items that user can select. (7 items)
Sub-list of items based on the value selected in the first screen (another 5+ items for every 7 items from the first screen)
Simple screen showing some strings and two images based on the value selected in the second screen.
What is the best way of defining those values in terms of Flutter best practices?
Right now I have a list of strings in my main.dart (first screen):
List<String> menuItems = <String>[ "Item 1", "Item 2", "Item 3" ];
When one of the items is pressed by the user, index of the selected ListTile is passed to the second screen (list_screen.dart).
And now I don't know what is a best way to go from here. Should I declare 7 lists in that file for every item that can be selected in the first screen? And then in the third screen declare next lists for both strings and images? This seems like a mess and will result in long files with the actual widget declarations preceded by a huge number of list variables.
Or is there a better way to store the structure for that kind of app? In Android native I was doing that using arrays in .xml files. Maybe creating separate .dart files for every screen's data is the right way?
I suggest learning about State management (bloc, Cubit, Provider) those are the top 3 libraries, I like cubit because it is simple and straightforward, now, storing variables can be done in 2 different ways, you can store them in XML or JSON file and set it ina assets older, then you parse the data in the controller class. or, you can store them as lists in the controller (cubit file) and let the three screens read from this cubit file and react to the changes made by the controller. you can use a local database also.
I hope I answered your question .
Using the Api Explorer updating a template with a whole new set of tabs just appends the new tabs on top of the old ones.
The only way we can find to delete old tabs is this endpoint (with a broken documentation link) which assumes that I would like to carefully send a bespoke delete for each recipient and attach each tabId that isn't relevant. This is incorrect. I have new tabs that are correct, and old tabs that I don't care about.
Workarounds that I'd try, but are also not possible*:
delete the template and create a new one (there is no delete template endpoint)
delete all tabs in a template before updating the template (I cannot find any bulk delete actions for tabs)
list all tabs, and then for-each them into a delete (the list tabs endpoint is giving us a 404)
move the template to an archive/trash folder and create a new one in it's place. (it is not possible to move a template's folder location using Template Update)
update our representation of a tab with the tabId in the response, using X,Y,Page coordinates (coordinates are rounded/quantized, and you'd have to do fuzzy math for every tab to find the closest one, and that's super gross)
How are you supposed to replace all the tabs in a template?
*so far as I can tell
Solution to workaround 1:
The move envelopes endpoint also moves templates.
Make sure your folderId is "recyclebin"
{
"envelopeIds": [
"689c311a-118e-447d-a77d-3ea856510a75"
]
}
Related tip for workaround 4: (undocumented) a PUT to https://{baseUrl}/api/accounts/{accountId}/folders/templates
can move a template's folder
{
"foldersTemplates": [
{
"templateId": "eae13fee-dc17-40f5-aa09-f4d1705c31b6",
"folderId": "fb803413-bf4a-4706-9621-03f6915b3305",
"newFolderId": "a954b249-04ce-4fde-b564-1afa87c8beab"
}
]
}
I've got a simple repeater that list links to uploaded documents using cms.file. I'm drawing a blank on adjust the ORDER BY based on publish date. I can't find anything here on this, so i apologize if this is a duplicate.
Best practice is to add custom field to page type (in this case cms.file or better create the new one) and set ORDER BY condition to this new field. There are also properties like DocumentModifiedWhen, DocumentCreatedWhen, DocumentCheckedOutWhen you can use.
I'm going to use DocumentModifiedWhen as the ORDER By statement.
There are two fields [DocumentPublishTo] and [DocumentPublishFrom] that you can think of using. These are the two fields which appear at the bottom of each form page by default.
I tried using smart image in multi composite field. In that the images are getting persisted, the remaining fields in the multi composite fields are not getting persisted. when i edited the dialog for the first time the values are getting stored on the node. when i edit the dialog next time it is showing me empty fields for the fields other than smart image.
This won't work. SmartImage and SmartFile have some restrictions to them. And there are two different versions: SmartImage and SmartFile vs. Html5SmartImage and Html5SmartFile. Depending on your actual Version of CQ it is even only possible to have the smartimage as a separate tab without any other fields. On top of that the behaviour for the different browser and versions together with the configuration of your SmartImage have different outcomes in JCR. This is even true for AEM 5.6.1 and the Html5 versions of the the xtype.
I can't post the full solution (as the code is not mine) but give some pointers how you could achieve your requirement:
Write your own Widget that replaces the multifield xtype. The author called it genericmultifield and what it does is to open an additional configurable dialog for each item. In this dialog you have the full controll again. It stores each item as a separate node below your resource from where you open your main dialog.
Though you need good ExtJs knowledge to achieve this and considering AEM 6, with a complete new Touch UI I am not sure if it is wise to do so. I didn't have time to check out AEM6, but maybe they already have something like this in their new UI.
I am creating a gallery/albums site in Drupal 6.
Perhaps the description will be a bit detailed, but still on some reason it's a problem to create a gallery in Drupal in a simple way.
As for now I am using CCK + Views + FileField + ImageCache + Lightbox2 combination.
This has allowed me to
- create Album CCK node type that can hold multiple images
- create a view that displays Albums in 9x9 fashion (using pager and items per row)
But here is one problem. While the main 9x9 view with albums displays nicely, when I drill down into particular Album node by clicking it's picture, it displays the uploaded node images in a vertical row and I am unable to control it's formatting.
Apparently, I have 2 options
a) to somehow control the html output of my CCK field with its files (to divide into rows)
b) or to create another view to display pictures from one album
As for now, I am not sure which of these two ways is the best and what specifically I need to do.
a) I can create node-album.tpl file - but all its content will already be in a single $content variable, which I don't be able to break into 3 items in a row. Am I wrong?
b) if I decide to create a view to display items from a single Album node, I am not sure how I reference it from the parent Albums view. The problem is that in view's Fields section I am able to override the Link, but it offers only 2 replacement patterns to pass to a potential "child" view, which are [title] and [field_images_fid] - is that enough to create a child view to show images from a specific album?
I just recorded a screencast outlining one approach. There's quite a bit of discussion in the comment threads about alternative methods; I'd definitely suggest using Views Attach if you want more control over the presentation of the gallery itself.
I can create node-album.tpl file - but all its content will already be in a single $content variable, which I don't be able to break into 3 items in a row. Am I wrong?
You are right and wrong.
In your template.php file you can pass other variables into your node-album.tpl, you could pass in the $node variable and display in a very customised way, although this will remove flexibility later on, as if you use another module to add things to $content you will have to edit the tpl file to access new variables.
To do this you use the preprocess_page hook in the template.php file. You can add variables to the $vars array and use these in the node-album.tpl file. I think that $node will already be defined in the tpl file, which will probably make your life easier. you can disregard content altogether.
If this doesn’t work for you, you can also create a custom module and use hook_nodeapi and hook_theme to theme things any way you like, while still using $content. However this may be a bit too much work for you needs (if you want to go this way, reply and I'll write a separate answer).