Hi there. I am a complete noob on Umbraco, but I'm liking what I see so far. I do have a couple of questions that I hope don't offend anyone!
I'm essentially playing with the supplied template (1) installation to see what I can do, and came up with a couple of things that I'd like to do but can't work out whether they're possible. I'm not even totally sure on the terminology, so apologies for any confusion.
When editing the home page, based on the Home document Type which uses the Grid Frontpage property, I can add different Row Configurations, use the ones that are there etc. These are what I can add and edit when modifying the Content in the page - I'm not sure what to call each of these 'rows' that are added to the page. (I add them by cliking the 'plus' at the bottom of the content and choosing which row configuration I want).
1st question - can I set a visible flag on these rows somehow, perhaps via a style or setting (json configuration), so that they appear in the content of the page in the editor, but do or don't show up when the site page is rendered, based on the flag? If so, how could I do that? I'd like to set some 'rows' up that are ready to go, but not 'published'. I know the publish dates apply to the whole page, so that's not what I'm after.
2nd question - is there a way to duplicate these rows? As the editor makes them appear to be nice, stand-alone 'widgets' almost, it would be great if I could take one that was already set up and duplicate it, before changing the content within it. It seems handy, but is it possible?
Some of what you want could be possible, but I'd like to say first I don't think umbraco currently fully embraces the concepts behind your idea. How much mileage you can get from my advice here will be dependent on how comfortable you are with rendering the grid.
Simple answer to question 2 is no.
In answer to question 1 - You could add a setting to the grid see here
An example configuration entry for your case might be (if there are already other settings it would be added in the fashion described in 'Adding multiple settings' on the link provided)
{
"label": "Published",
"description": "Unpublished rows will not appear",
"key": "data-published",
"view": "radiobuttonlist",
"prevalues": [
"published",
"unpublished"
]
}
You would then edit the partial view for rendering the grid itself usually under ~/Views/Partials/Grid (and then something like Bootstrap3.cshtml or Fanoe.cshtml)
you would add a condition where you only output content if the value of the 'data-published' setting was equal to 'published'. To figure out how to do this look at the RenderElementAttributes function which normally resides in the Grid partial view it should demonstrate that in this context the data-published property will be a JProperty so you will find and check its value accordingly.
As I said at the start Umbraco doesn't really have unpublished and published rows in the same way as documents you would add the bits of code described to give something like the same effect. Also note there is no way of displaying this setting in the backoffice for some rows but not others.
In case anyone else might find this helpful, I was able to implement this by doing the following (only a tiny change to Ian's code, and then the editor code).
This is what went into the settings in the Grid Editor in the Document Type:
{
"label": "Published",
"description": "Unpublished rows will not appear (unselected will still appear)",
"key": "rowpublished",
"view": "radiobuttonlist",
"prevalues": [
"published",
"unpublished"
]
}
And this is the change I made to the Fanoe.cshtml Grid Editor code. Essentially, I just didn't call the RenderRow if it was set to unpublished.
if (row.config.rowpublished != "unpublished")
{
@renderRow(row, true);
}
This was more of an experiment than anything, but I think it could come in handy. Thanks again Ian!
Noob questions - rows in content
Hi there. I am a complete noob on Umbraco, but I'm liking what I see so far. I do have a couple of questions that I hope don't offend anyone!
I'm essentially playing with the supplied template (1) installation to see what I can do, and came up with a couple of things that I'd like to do but can't work out whether they're possible. I'm not even totally sure on the terminology, so apologies for any confusion.
When editing the home page, based on the Home document Type which uses the Grid Frontpage property, I can add different Row Configurations, use the ones that are there etc. These are what I can add and edit when modifying the Content in the page - I'm not sure what to call each of these 'rows' that are added to the page. (I add them by cliking the 'plus' at the bottom of the content and choosing which row configuration I want).
1st question - can I set a visible flag on these rows somehow, perhaps via a style or setting (json configuration), so that they appear in the content of the page in the editor, but do or don't show up when the site page is rendered, based on the flag? If so, how could I do that? I'd like to set some 'rows' up that are ready to go, but not 'published'. I know the publish dates apply to the whole page, so that's not what I'm after.
2nd question - is there a way to duplicate these rows? As the editor makes them appear to be nice, stand-alone 'widgets' almost, it would be great if I could take one that was already set up and duplicate it, before changing the content within it. It seems handy, but is it possible?
Thanks for any help guys!
Some of what you want could be possible, but I'd like to say first I don't think umbraco currently fully embraces the concepts behind your idea. How much mileage you can get from my advice here will be dependent on how comfortable you are with rendering the grid.
Simple answer to question 2 is no.
In answer to question 1 - You could add a setting to the grid see here
An example configuration entry for your case might be (if there are already other settings it would be added in the fashion described in 'Adding multiple settings' on the link provided)
}
You would then edit the partial view for rendering the grid itself usually under ~/Views/Partials/Grid (and then something like Bootstrap3.cshtml or Fanoe.cshtml)
when it is looping through the rows..
or in..
you would add a condition where you only output content if the value of the 'data-published' setting was equal to 'published'. To figure out how to do this look at the RenderElementAttributes function which normally resides in the Grid partial view it should demonstrate that in this context the data-published property will be a JProperty so you will find and check its value accordingly.
As I said at the start Umbraco doesn't really have unpublished and published rows in the same way as documents you would add the bits of code described to give something like the same effect. Also note there is no way of displaying this setting in the backoffice for some rows but not others.
Wow, thank you so much Ian! That is exactly what I was hoping for! I guess Umbraco possibly does have the friendliest community!!
It was the grid code step I was missing - along with any idea on what to do there. Thanks for that so much, I really appreciate it.
In case anyone else might find this helpful, I was able to implement this by doing the following (only a tiny change to Ian's code, and then the editor code).
This is what went into the settings in the Grid Editor in the Document Type:
And this is the change I made to the Fanoe.cshtml Grid Editor code. Essentially, I just didn't call the RenderRow if it was set to unpublished.
This was more of an experiment than anything, but I think it could come in handy. Thanks again Ian!
is working on a reply...