Skip to content

Instantly share code, notes, and snippets.

Pawel Bres pbres

Block or report user

Report or block pbres

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View Examine searchPath
public void OnApplicationStarted(UmbracoApplicationBase umbracoApplication, ApplicationContext applicationContext)
{
ExamineManager.Instance.IndexProviderCollection["ExternalIndexer"].GatheringNodeData += OnGatheringNodeData;
}
private void OnGatheringNodeData(object sender, IndexingNodeDataEventArgs e)
{
if (e.Fields.ContainsKey("path"))
{
e.Fields["searchPath"] = e.Fields["path"].Replace(',', ' ');
View 5 colums layout with Bootstrap 4
<div class="container">
<div class="row">
<div class="col"><img class="img-fluid" src="http://lorempixel.com/400/200/sports" /></div>
<div class="col"><img class="img-fluid" src="http://lorempixel.com/400/200/city" /></div>
<div class="col"><img class="img-fluid" src="http://lorempixel.com/400/200/animals" /></div>
<div class="col"><img class="img-fluid" src="http://lorempixel.com/400/200/technics" /></div>
<div class="col"><img class="img-fluid" src="http://lorempixel.com/400/200/nature" /></div>
</div>
</div>
View UmbracoSitemapService
public class UmbracoSitemapService
{
private readonly UmbracoHelper _umbracoHelper;
public UmbracoSitemapService()
{
_umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
}
public List<SitemapItem> GetItemsAsList(int startNodeId)
View SitemapController
public class SitemapController : RenderMvcController
{
public ActionResult SitemapXml()
{
var startNode = CurrentPage.Site();
if (startNode != null)
{
var sitemapService = new UmbracoSitemapService();
var items = sitemapService.GetItemsAsList(startNode.Id);
View SiteMapItem
public class SitemapItem
{
public string Url { get; set; }
public string LastUpdateDate { get; set; }
public string Name { get; set; }
}
View clickItemFunction
function clickItem(item) {
if (item.id == 2147483647){
$location.path(item.editPath);
}else{
$location.path($scope.entityType + '/' +$scope.entityType + '/edit/' +item.id);
}
}
@pbres
pbres / app.js
Created Oct 7, 2016
Angular scripts for form validation
View app.js
var app = angular.module("app", []);
app.controller("LoginFormController", ['$scope', function ($scope) {
$scope.emailRegex = /^(([^<>()\[\]\\.,;:\s@"]+(\.[^<>()\[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
$scope.loginFormSubmit = function (event) {
$scope.validation = true;
if (!$scope.loginform.$valid) {
event.preventDefault();
@pbres
pbres / UmbracoLoginForm
Last active Oct 7, 2016
Umbraco Login Form with Angular validation
View UmbracoLoginForm
@inherits Umbraco.Web.Macros.PartialViewMacroPage
@using System.Web.Mvc.Html
@using ClientDependency.Core.Mvc
@using Umbraco.Web
@using Umbraco.Web.Models
@using Umbraco.Web.Controllers
@{
var loginModel = new LoginModel();
@pbres
pbres / colorpicker.html
Created Sep 15, 2016
ColorPicker for Umbraco Grid DataType Settings/Style sections
View colorpicker.html
<div ng-controller="Umbraco.PropertyEditors.ColorPickerController">
<ul class="thumbnails color-picker">
<li ng-repeat="preval in model.prevalues" ng-class="{active: model.value === preval}">
<a ng-click="toggleItem(preval)" class="thumbnail" hex-bg-color="{{preval}}">
</a>
</li>
</ul>
<input type="hidden" name="modelValue" ng-model="model.value" val-property-validator="validateMandatory"/>
</div>
You can’t perform that action at this time.