Skip to content

Instantly share code, notes, and snippets.

View greystate's full-sized avatar
:octocat:
Octocatering

Chriztian Steinmeier greystate

:octocat:
Octocatering
View GitHub Profile
using System.Collections.Generic;
using System.Linq;
using Umbraco.Community.Contentment.DataEditors;
using Umbraco.Core.PropertyEditors;
using Umbraco.Web;
namespace MyWebsite.DataSources
{
public class PropertyDataDataSource : IDataListSource
{
@greystate
greystate / gist:b1c445fc9d7a5082a4609eff3ac5da99
Created January 9, 2017 19:09 — forked from lxcodes/gist:1010364
Set Cursor at the End of a ContentEditable
function setEndOfContenteditable(contentEditableElement)
{
var range,selection;
if(document.createRange)//Firefox, Chrome, Opera, Safari, IE 9+
{
range = document.createRange();//Create a range (a range is a like the selection but invisible)
range.selectNodeContents(contentEditableElement);//Select the entire contents of the element with the range
range.collapse(false);//collapse the range to the end point. false means collapse to end rather than the start
selection = window.getSelection();//get the selection object (allows you to change selection)
selection.removeAllRanges();//remove any selections already made
@greystate
greystate / umbraco-forms-newsletteroptin.xslt
Created December 1, 2016 21:45 — forked from MarcStoecker/umbraco-forms-newsletteroptin.xslt
A template for email opt-in mails (XSLT) for Umbraco Forms
<?xml version="1.0" encoding="utf-8"?>
<xsl:stylesheet version="1.0"
xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
xmlns:msxsl="urn:schemas-microsoft-com:xslt"
xmlns:user="urn:my-scripts"
xmlns:umbraco.library="urn:umbraco.library"
exclude-result-prefixes="xsl msxsl user umbraco.library">
<xsl:output method="html" media-type="text/html" doctype-public="-//W3C//DTD XHTML 1.0 Strict//EN"
doctype-system="DTD/xhtml1-strict.dtd"
@greystate
greystate / overview
Last active August 29, 2015 14:20 — forked from pauljcripps/overview
aim is to add UID using the generate-id function to the parent element (Object) and also to descendants so when imported into a database there are primary/foreign keys to knit it all back together again.
xslt currently properly assigns UID to Object and children but then assigns a new (but the same) UID to further descendants within each Child block; ie all children of child 1 get UID X, all children of child 2 get UID Y, etc.
So nearly there but not quite...
Files:
Schema (xsd)
Transform (xslt)
<root id="-1">
<HomePage id="1234" parentID="-1" level="1" creatorID="1" sortOrder="0" createDate="2014-12-16T00:00:00" updateDate="2014-12-16T00:00:00" nodeName="Home" urlName="home" path="-1,1156" isDoc="" nodeType="1111" creatorName="admin" writerName="admin" writerID="1" template="0" nodeTypeAlias="HomePage">
<archetypeLinks><![CDATA[{"fieldsets":[{"properties":[{"alias":"linkUrl","value":"http://www.example.com/"},{"alias":"linkLabel","value":"Website"}],"alias":"externalLink","disabled":false},{"properties":[{"alias":"linkUrl","value":"http://www.example2.com/"},{"alias":"linkLabel","value":"Webshop"}],"alias":"externalLink","disabled":false}]}]]></archetypeLinks>
<json:archetypeLinks xmlns:json="http://pimpmyxslt.com/json">
<fieldsets>
<properties>
<alias>linkUrl</alias>
<value>http://www.example.com/</value>
</properties>
<properties>
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using umbraco.cms.businesslogic.Tags;
using umbraco.interfaces;
using Umbraco.Forms.Core;
using Umbraco.Web;
namespace Contour.Addon.Tags
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using Archetype.Models;
@using Archetype.Extensions;
@{
Layout = null;
}
//use case #1 - Covers a single Archetype
@foreach (var fieldset in Model.Content.GetPropertyValue<ArchetypeModel>("a1"))
{
@greystate
greystate / VortoPropertyIndexer.cs
Last active August 29, 2015 14:06 — forked from darrenferguson/VortoPropertyIndexer
(Forked only to rename file for getting syntax highlighting — I have no C# skills to otherwise improve the code 🙈 :-)
using System.Collections.Generic;
using Moriyama.Library.Architecture;
using Newtonsoft.Json;
namespace Application.Search
{
public class VortoPropertyIndexer
{
// Somewhere in startup
//ExamineManager.Instance.IndexProviderCollection["ExternalIndexer"].GatheringNodeData += MoriyamaApplicationEventHandlerGatheringNodeData;
public class CompanyViewModel {
// use partial view "StreetAddress.cshtml"
public StreetAddress MainAddress {get; set;}
// use partial view "CompactAddress.cshtml"
[UIHint("CompactAddress")]
public StreetAddress StoreAddress {get; set;}
<!-- For non-Retina iPhone, iPod Touch, and Android 2.1+ devices: -->
<link rel="apple-touch-icon-precomposed" href="apple-touch-icon-precomposed.png">
<!-- For the iPad mini and the first- and second-generation iPad on iOS ≤ 6: -->
<link rel="apple-touch-icon-precomposed" sizes="72x72" href="apple-touch-icon-72x72-precomposed.png">
<!-- For the iPad mini and the first- and second-generation iPad on iOS ≥ 7: -->
<link rel="apple-touch-icon-precomposed" sizes="76x76" href="apple-touch-icon-76x76-precomposed.png">
<!-- For iPhone with high-resolution Retina display running iOS ≤ 6: -->