Skip to content

Commit

Permalink
improve razor snippets
Browse files Browse the repository at this point in the history
  • Loading branch information
iJungleboy committed Mar 4, 2024
1 parent 2abed04 commit b3d1c65
Show file tree
Hide file tree
Showing 6 changed files with 141 additions and 33 deletions.
58 changes: 29 additions & 29 deletions docs/api/dot-net/Custom.Hybrid.RazorTyped.html

Large diffs are not rendered by default.

37 changes: 37 additions & 0 deletions docs/api/dot-net/ToSic.Sxc.Context.ICmsView.html
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,43 @@ <h4 class="section">Property Value</h4>



<a id="ToSic_Sxc_Context_ICmsView_Resources_" data-uid="ToSic.Sxc.Context.ICmsView.Resources*"></a>

<h3 id="ToSic_Sxc_Context_ICmsView_Resources" data-uid="ToSic.Sxc.Context.ICmsView.Resources">
Resources
<a class="header-action link-secondary" title="View source" href="https://github.com/2sic/2sxc/blob/develop/Src/Sxc/ToSic.Sxc/Context/CmsContext/ICmsView.cs/#L105"><i class="bi bi-code-slash"></i></a>
</h3>

<div class="markdown level1 summary"><p>Settings of this view.
This property only works in the new typed code.</p>
<p>Note that many views don't have their own settings, so this would be empty = <code>null</code>.</p>
</div>
<div class="markdown level1 conceptual"></div>

<div class="codewrapper">
<pre><code class="lang-csharp hljs">ITypedItem Resources { get; }</code></pre>
</div>





<h4 class="section">Property Value</h4>
<dl class="parameters">
<dt><a class="xref" href="ToSic.Sxc.Data.ITypedItem.html">ITypedItem</a></dt>
<dd></dd>
</dl>




<h4 class="section" id="ToSic_Sxc_Context_ICmsView_Resources_remarks">Remarks</h4>
<div class="markdown level1 remarks"><p>Resources added to API in v17.04</p>
</div>




<a id="ToSic_Sxc_Context_ICmsView_Settings_" data-uid="ToSic.Sxc.Context.ICmsView.Settings*"></a>

<h3 id="ToSic_Sxc_Context_ICmsView_Settings" data-uid="ToSic.Sxc.Context.ICmsView.Settings">
Expand Down
2 changes: 1 addition & 1 deletion docs/index.json
Original file line number Diff line number Diff line change
Expand Up @@ -2057,7 +2057,7 @@
"api/dot-net/ToSic.Sxc.Context.ICmsView.html": {
"href": "api/dot-net/ToSic.Sxc.Context.ICmsView.html",
"title": "Interface ICmsView | 2sxc 17 for Dnn and Oqtane",
"keywords": "Interface ICmsView Namespace ToSic.Sxc.Context Assembly ToSic.Sxc.dll View context information. 🪒 In Dynamic Razor it's found on CmsContext.View 🪒 In Typed Razor it's found on MyView [PublicApi] public interface ICmsView : IHasMetadata Remarks Added in 2sxc 12.02 Properties Edition Edition used - if any. Otherwise empty string. 🪒 Use in Razor: CmsContext.View.Edition 🪒 Use in Typed Razor: MyView.Edition string Edition { get; } Property Value string Folder This is the preferred way to get the Url or Path to the current view. This is different from the App.Folder, because it will also contain the edition (if there is an edition) 🪒 Use in Razor: CmsContext.View.Folder - eg CmsContext.View.Folder.Url 🪒 Use in Typed Razor: MyView.Edition - eg MyView.Folder.Url IFolder Folder { get; } Property Value IFolder Remarks Added in v16.04 Id View configuration ID 🪒 Use in Dynamic Razor: CmsContext.View.Id 🪒 Use in Typed Razor: MyView.Id int Id { get; } Property Value int Identifier An optional identifier which the View configuration can provide. Use this when you want to use the same template but make minor changes based on the View selected (like change the number of columns). Usually you will use either this OR the Settings 🪒 Use in Razor: CmsContext.View.Identifier 🪒 Use in Typed Razor: MyView.Identifier string Identifier { get; } Property Value string Metadata Metadata of the current view IMetadata Metadata { get; } Property Value IMetadata Remarks Added in v13.12 Name Name of the view as configured - note that because of i18n it could be different depending on the language. To clearly identify a view, use the Identifier or use Settings 🪒 Use in Dynamic Razor: CmsContext.View.Name 🪒 Use in Typed Razor: MyView.Name string Name { get; } Property Value string Settings Settings of this view. This property only works in the new typed code. Note that many views don't have their own settings, so this would be empty = null. ITypedItem Settings { get; } Property Value ITypedItem"
"keywords": "Interface ICmsView Namespace ToSic.Sxc.Context Assembly ToSic.Sxc.dll View context information. 🪒 In Dynamic Razor it's found on CmsContext.View 🪒 In Typed Razor it's found on MyView [PublicApi] public interface ICmsView : IHasMetadata Remarks Added in 2sxc 12.02 Properties Edition Edition used - if any. Otherwise empty string. 🪒 Use in Razor: CmsContext.View.Edition 🪒 Use in Typed Razor: MyView.Edition string Edition { get; } Property Value string Folder This is the preferred way to get the Url or Path to the current view. This is different from the App.Folder, because it will also contain the edition (if there is an edition) 🪒 Use in Razor: CmsContext.View.Folder - eg CmsContext.View.Folder.Url 🪒 Use in Typed Razor: MyView.Edition - eg MyView.Folder.Url IFolder Folder { get; } Property Value IFolder Remarks Added in v16.04 Id View configuration ID 🪒 Use in Dynamic Razor: CmsContext.View.Id 🪒 Use in Typed Razor: MyView.Id int Id { get; } Property Value int Identifier An optional identifier which the View configuration can provide. Use this when you want to use the same template but make minor changes based on the View selected (like change the number of columns). Usually you will use either this OR the Settings 🪒 Use in Razor: CmsContext.View.Identifier 🪒 Use in Typed Razor: MyView.Identifier string Identifier { get; } Property Value string Metadata Metadata of the current view IMetadata Metadata { get; } Property Value IMetadata Remarks Added in v13.12 Name Name of the view as configured - note that because of i18n it could be different depending on the language. To clearly identify a view, use the Identifier or use Settings 🪒 Use in Dynamic Razor: CmsContext.View.Name 🪒 Use in Typed Razor: MyView.Name string Name { get; } Property Value string Resources Settings of this view. This property only works in the new typed code. Note that many views don't have their own settings, so this would be empty = null. ITypedItem Resources { get; } Property Value ITypedItem Remarks Resources added to API in v17.04 Settings Settings of this view. This property only works in the new typed code. Note that many views don't have their own settings, so this would be empty = null. ITypedItem Settings { get; } Property Value ITypedItem"
},
"api/dot-net/ToSic.Sxc.Context.IParameters.html": {
"href": "api/dot-net/ToSic.Sxc.Context.IParameters.html",
Expand Down
61 changes: 60 additions & 1 deletion docs/public/2sxc-scripts.js
Original file line number Diff line number Diff line change
@@ -1 +1,60 @@
function attachFancybox(){var t=$(".fancybox-auto");t.each((function(t,o){o.id||(o.id="rndId-"+Math.floor(Math.random()*Math.floor(9999999)));var n=$(o).parent().attr("class");if(n){var a=n.split(" ").find((t=>t.startsWith("context")));a&&$(o).addClass(a)}})),t.click((function(){showDivWithSvg(this.id)}))}function showDivWithSvg(t){var o=t+"-clone",n=document.getElementById(o);n||((n=document.getElementById(t).cloneNode(!0)).id=o,n.style.width="95%",$(n).click((function(){$.fancybox.close()})),document.body.appendChild(n)),$.fancybox.open({src:"#"+o,type:"inline"})}$(document).ready((function(){$("img").not("#logo").not(".for-link").each((function(){var t=$(this);console.log("img",t);var o=t.attr("src");t.css("cursor","zoom-in"),t.css("cursor","-moz-zoom-in"),t.css("cursor","-webkit-zoom-in"),t.attr("alt",o),t.featherlight(o)}));const t=$(".version-button");t.attr("href",t.attr("href")+"?version=16.09&path="+window.location.pathname)})),$(attachFancybox);
// Activate featherlite for quick lightboxes
$(document).ready(function() {
//find all images, but not the logo, and add the lightbox
$('img').not('#logo').not('.for-link').each(function() {
var $img = $(this);
// debug
console.log('img', $img);
var filename = $img.attr('src')
//add cursor
$img.css('cursor','zoom-in');
$img.css('cursor','-moz-zoom-in');
$img.css('cursor','-webkit-zoom-in');

//add featherlight
$img.attr('alt', filename);
$img.featherlight(filename);
});

// attach current link to the version box
const vButton = $('.version-button');
vButton.attr('href', vButton.attr('href') + '?version=16.09&path=' + window.location.pathname);
});

// Fancybox
function attachFancybox() {
var containers = $(".fancybox-auto");
// add ID if missing
containers.each(function(i, e) {
if(!e.id) e.id = 'rndId-' + Math.floor(Math.random() * Math.floor(9999999))

// check if we need to attach some classes from parent
var pcls = $(e).parent().attr("class");
if(pcls) {
var clsList = pcls.split(' ');
var contextCls = clsList.find(c => c.startsWith('context'));
if(contextCls) $(e).addClass(contextCls);
}
});
// attach click
containers.click(function() {
showDivWithSvg(this.id);
});
}
$(attachFancybox);

function showDivWithSvg(target) {
var newName = target + '-clone';
var clone = document.getElementById(newName);
if(!clone) {
clone = document.getElementById(target).cloneNode(true);
clone.id = newName;
clone.style.width = "95%";
$(clone).click(function() { $.fancybox.close() })
document.body.appendChild(clone);
}
$.fancybox.open( {
src: '#' + newName,
type: 'inline',
});
}
3 changes: 1 addition & 2 deletions docs/public/main.js

Large diffs are not rendered by default.

13 changes: 13 additions & 0 deletions docs/xrefmap.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19327,6 +19327,19 @@ references:
isSpec: "True"
fullName: ToSic.Sxc.Context.ICmsView.Name
nameWithType: ICmsView.Name
- uid: ToSic.Sxc.Context.ICmsView.Resources
name: Resources
href: api/dot-net/ToSic.Sxc.Context.ICmsView.html#ToSic_Sxc_Context_ICmsView_Resources
commentId: P:ToSic.Sxc.Context.ICmsView.Resources
fullName: ToSic.Sxc.Context.ICmsView.Resources
nameWithType: ICmsView.Resources
- uid: ToSic.Sxc.Context.ICmsView.Resources*
name: Resources
href: api/dot-net/ToSic.Sxc.Context.ICmsView.html#ToSic_Sxc_Context_ICmsView_Resources_
commentId: Overload:ToSic.Sxc.Context.ICmsView.Resources
isSpec: "True"
fullName: ToSic.Sxc.Context.ICmsView.Resources
nameWithType: ICmsView.Resources
- uid: ToSic.Sxc.Context.ICmsView.Settings
name: Settings
href: api/dot-net/ToSic.Sxc.Context.ICmsView.html#ToSic_Sxc_Context_ICmsView_Settings
Expand Down

0 comments on commit b3d1c65

Please sign in to comment.