|
1 | | -@inherits Custom.Hybrid.Razor12 |
| 1 | +@inherits Custom.Hybrid.Razor14 |
2 | 2 | @using ToSic.Razor.Blade; |
3 | | -@using ToSic.Sxc.Services; |
4 | 3 | @{ |
5 | 4 | /* 1. Pre-Checks: Determine which Album to show or show error |
6 | 5 | * This will check if the url specifies a specific album, and if yes, use that |
7 | 6 | * If not, use the one configured in the module (for single-album scenarios) |
8 | 7 | * If nothing is found, it will stop after this code block (see `return` below) |
9 | 8 | */ |
10 | | - |
11 | | - // Get the PageServices for setting Titles and HTTP error headers |
12 | | - var pageSvc = GetService<IPageService>(); |
13 | | - var imgSvc = GetService<IImageService>(); |
14 | | - var scrubSvc = GetService<IScrub>(); |
15 | | - var toolbarSvc = GetService<IToolbarService>(); |
16 | | - |
17 | 9 | // Get page Parameters (works on Dnn & Oqtane) |
18 | 10 | var albumInUrl = CmsContext.Page.Parameters["Album"]; |
19 | 11 | var isDetailViewOfAlbum = Text.Has(albumInUrl); |
|
32 | 24 | <div>@Html.Raw(Resources.AlbumNotFoundText)</div> |
33 | 25 | <a href="@Link.To()" class="btn btn-outline-primary btn-sm">@Resources.BackToOverview</a> |
34 | 26 |
|
35 | | - pageSvc.SetHttpStatus(404); |
| 27 | + Kit.Page.SetHttpStatus(404); |
36 | 28 | return; |
37 | 29 | } |
38 | 30 | } |
|
44 | 36 | */ |
45 | 37 |
|
46 | 38 | // 2.1 Set the title of the page |
47 | | - pageSvc.SetTitle(album.Title + " | "); // will prepend to the existing title |
48 | | - // pageSvc.SetTitle(album.Title, "[album]"); // Alternative: this would replace a placeholder [album] in the title with the title |
| 39 | + Kit.Page.SetTitle(album.Title + " | "); // will prepend to the existing title |
| 40 | + // Kit.Page.SetTitle(album.Title, "[album]"); // Alternative: this would replace a placeholder [album] in the title with the title |
49 | 41 |
|
50 | 42 | // 2.2 Determine if we should show as Masonry |
51 | 43 | var albumTiling = Text.Has(album.Presentation.TileStructure) |
|
70 | 62 | // 2.9 Helpers used later in the Template |
71 | 63 | var helpers = CreateInstance("SortImages.cs"); // Has helper code for sorting |
72 | 64 |
|
73 | | - var gallerySettings = CmsContext.View.Identifier == "masonry" ? imgSvc.Settings("Content", resizeMode:"max") : Settings.Images.Content; |
| 65 | + var gallerySettings = CmsContext.View.Identifier == "masonry" ? Kit.Image.Settings("Content", resizeMode:"max") : Settings.Images.Content; |
74 | 66 | var galleryFactor = CmsContext.View.Identifier == "masonry" ? "4/12" : "3/12"; |
75 | 67 | } |
76 | 68 | @* 4. Show the Album *@ |
|
88 | 80 |
|
89 | 81 | // Build the Caption for the Lightbox - will later be converted to an attribute |
90 | 82 | var caption = (Content.Presentation.ShowImageTitle && Text.Has(pic.Metadata.Title)) |
91 | | - ? Tag.H6().Wrap(scrubSvc.All(pic.Metadata.Title)) + Tag.P().Wrap(scrubSvc.All(pic.Metadata.Description)) |
| 83 | + ? Tag.H6().Wrap(Kit.Scrub.All(pic.Metadata.Title)) + Tag.P().Wrap(Kit.Scrub.All(pic.Metadata.Description)) |
92 | 84 | : ""; |
93 | 85 |
|
94 | 86 | // Toolbar parameters (for admins) to ensure the metadata-button does what's needed |
|
97 | 89 | "metadata?entityId=" + pic.Metadata.EntityId + "&contentType=ImageMetadata&for=file:" + pic.FileId |
98 | 90 | }; |
99 | 91 |
|
100 | | - @* 4.3a Optionally wrap inside a special <div> if it's not Masonry-layout *@ |
| 92 | + var picToolbar = Kit.Toolbar.Empty().Metadata(pic, "ImageMetadata").Condition(!Content.IsDemoItem); |
| 93 | + |
| 94 | + @* 4.3a Optionally wrap inside a special <div> if it's not Masonrylayout *@ |
101 | 95 | if(!useMasonry) { @Tag.Div().Class("col-12 col-sm-6 col-md-4 col-lg-3 mb-4").TagStart } |
102 | 96 | @* 4.4 Now show each image *@ |
103 | | - var lbPic = imgSvc.Picture(pic.Url, settings:"Lightbox"); |
| 97 | + var lbPic = Kit.Image.Picture(pic.Url, settings:"Lightbox"); |
104 | 98 | <a class="app-ga7" @fancyboxAttribute data-src="@pic.Url" data-srcset="@lbPic.SrcSet" data-sizes="@lbPic.Sizes" data-preload="false" data-caption="@caption"> |
105 | 99 |
|
106 | | - <figure class="app-ga7-image @effect" @Edit.TagToolbar(toolbar: metaToolbarConfig, condition: !Content.IsDemoItem)> |
| 100 | + <figure class="app-ga7-image @effect" @pic.Toolb> |
107 | 101 | @* 4.5 Show the Overlay, an optional title (based on settings) and the image itself *@ |
108 | 102 | <figcaption class="overlay d-flex align-items-end"> |
109 | 103 | @if(Text.Has(picTitle)) { <div class="caption">@picTitle</div> } |
110 | 104 | </figcaption> |
111 | 105 |
|
112 | | - @imgSvc.Picture(pic.Url, settings: gallerySettings, factor: galleryFactor) |
| 106 | + @Kit.Image.Picture(pic.Url, settings: gallerySettings, factor: galleryFactor) |
113 | 107 | </figure> |
114 | 108 | </a> |
115 | 109 | @* 4.3b close <div> if we opened it above *@ |
|
0 commit comments