Skip to content

Instantly share code, notes, and snippets.

View sotirisf's full-sized avatar

Sotiris Filippidis sotirisf

View GitHub Profile
using System.Collections.Generic;
using Umbraco.Cms.Core.Models.PublishedContent;
using Umbraco.Cms.Core.PropertyEditors;
using Umbraco.Cms.Core.Services;
using Umbraco.Cms.Core.Web;
using Umbraco.Cms.Web.Common.PublishedModels;
using Umbraco.Community.Contentment.DataEditors;
using Umbraco.Extensions;
namespace Themelion.Common.DataSources
@sotirisf
sotirisf / config.json
Last active November 22, 2021 14:12
UmbracoCustomBlockView gists
{
"name": "items",
"defaultTitleAlias": "title",
"defaultItemsAlias": "items",
"items": [
{
"name": "myBlockAlias",
"titleAlias": "myTitleAlias",
"thumbsAlias": "myImageAlias",
@sotirisf
sotirisf / TreeVariantSettingsController.cs
Last active December 19, 2020 16:26
Hide unpublished variants 3
using System.Configuration;
using System.Web.Http;
namespace Site.Core.ApiControllers
{
public class TreeVariantSettingsController : Umbraco.Web.WebApi.UmbracoApiController
{
[HttpGet]
public string HideUnpublishedVariantsFromTree()
{
@sotirisf
sotirisf / hider.js
Last active December 19, 2020 16:27
Hide unpublished variants 2
var enableHideNodes = "";
$.ajax({
url: "/umbraco/api/TreeVariantSettings/HideUnpublishedVariantsFromTree",
success: function (data) {
enableHideNodes = data;
}
, async: false
});
@sotirisf
sotirisf / SiteEvents.cs
Created December 19, 2020 16:01
Hide upublished variants 1
using System.Configuration;
using System.Linq;
using Umbraco.Core;
using Umbraco.Core.Composing;
using Umbraco.Web;
using Umbraco.Web.Trees;
namespace Site.Core
{
public class SiteEvents : IUserComposer
@using Umbraco.Web.PublishedModels;
@using System.Configuration;
@inherits Umbraco.Web.Mvc.UmbracoViewPage
@{
if (!(Model is IAbstractPageSections)) { return; }
var introBlock = (Model as IAbstractPageSections).IntroSection;
if (introBlock.Any(x => (x.Content as IAbstractSectionBlock).Disabled == false))
@sotirisf
sotirisf / SectionIntroImageSliderBlockCdf.cshtml
Created December 13, 2020 18:37
Umazel 2.0 Block Handling again
@using DotSee.Common
@using ClientDependency.Core.Mvc
@inherits Umbraco.Web.Mvc.UmbracoViewPage<Umbraco.Core.Models.Blocks.BlockListItem>
@{
Html.RequiresCss("/Css/plugin/owl.carousel.css", CdfPriority.Medium, CdfGroup.Section);
Html.RequiresJs("/scripts/plugin/owl.carousel.min.js", CdfPriority.Medium, CdfGroup.Section);
Html.RequiresCss("/Css/plugin/colorbox.css", CdfPriority.Medium, CdfGroup.Section);
Html.RequiresJs("/scripts/plugin/jquery.colorbox-min.js", CdfPriority.Medium, CdfGroup.Section);
@sotirisf
sotirisf / SectionTextBlock.cshtml
Created December 13, 2020 18:15
uMazel 2.0 Section Handling 3
@inherits Umbraco.Web.Mvc.UmbracoViewPage<Umbraco.Core.Models.Blocks.BlockListItem>
@using Site.Core;
@using DotSee.Common;
@{
SectionTextBlock currSection = Model.Content as SectionTextBlock;
SectionTextBlockSettings settings = Model.Settings as SectionTextBlockSettings;
bool isPartOfMultiCol = (ViewData["isMultiCol"] ?? "0").ToString() == "1";
@sotirisf
sotirisf / _renderBlock.cshtml
Created December 13, 2020 17:42
uMazel 2.0 Block Elements Handling 2
@inherits UmbracoViewPage<Umbraco.Core.Models.Blocks.BlockListItem>
@{
var isMulticol = (ViewData["isMultiCol"] ?? "0").ToString();
switch (Model.Content.ContentType.Alias)
{
default:
var controllerContext = Html.ViewContext.Controller.ControllerContext;
@sotirisf
sotirisf / _pageBlockRenderer.cshtml
Created December 13, 2020 17:14
uMazel 2.0 block elements handling
@using Umbraco.Web.PublishedModels;
@inherits Umbraco.Web.Mvc.UmbracoViewPage
@{
if (!(Model is IAbstractPageSections)) { return; }
var introBlock = (Model as IAbstractPageSections).IntroSection;
if (introBlock.Any(x => (x.Content as IAbstractSectionBlock).Disabled == false))