Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

View pbres's full-sized avatar

Pawel Bres pbres

View GitHub Profile
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(',', ' ');
<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>
public class UmbracoSitemapService
{
private readonly UmbracoHelper _umbracoHelper;
public UmbracoSitemapService()
{
_umbracoHelper = new UmbracoHelper(UmbracoContext.Current);
}
public List<SitemapItem> GetItemsAsList(int startNodeId)
public class SitemapController : RenderMvcController
{
public ActionResult SitemapXml()
{
var startNode = CurrentPage.Site();
if (startNode != null)
{
var sitemapService = new UmbracoSitemapService();
var items = sitemapService.GetItemsAsList(startNode.Id);
public class SitemapItem
{
public string Url { get; set; }
public string LastUpdateDate { get; set; }
public string Name { get; set; }
}
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 October 7, 2016 10:07
Angular scripts for form validation
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 October 7, 2016 09:45
Umbraco Login Form with Angular validation
@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 September 15, 2016 19:12
ColorPicker for Umbraco Grid DataType Settings/Style sections
<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>