Skip to content

Instantly share code, notes, and snippets.

View rsleggett's full-sized avatar

Rob Stevenson-Leggett rsleggett

View GitHub Profile
Write-Host "Running Content Manager upgrade script"
$items = Get-ChildItem -File -Path dd4t-tbb
[Reflection.Assembly]::LoadWithPartialName("System.EnterpriseServices") | Out-Null
[System.EnterpriseServices.Internal.Publish] $publish = new-object System.EnterpriseServices.Internal.Publish
foreach($item In $items)
{
Write-Host "Installing $item in GAC"
$publish.GacInstall($item.FullName)
@rsleggett
rsleggett / gist:8035646
Last active December 31, 2015 19:49
Example CD_Storage_Conf
<?xml version="1.0" encoding="UTF-8"?>
<Configuration Version="7.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="schemas/cd_storage_conf.xsd">
<Global>
<ObjectCache Enabled="false">
<Policy Type="LRU" Class="com.tridion.cache.LRUPolicy">
<Param Name="MemSize" Value="16mb"/>
</Policy>
<Features>
@rsleggett
rsleggett / ComponentController.cs
Created November 29, 2013 14:31
ComponentController with autoloading strongly typed view models
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text;
using BuildingBlocks.DD4T.MarkupModels;
using DD4T.Mvc.Controllers;
using System.Web.Mvc;
@rsleggett
rsleggett / ContextDelegates
Last active December 22, 2015 00:38
Context Engine Demo Gist
private bool SmartPhoneContext(HttpContextBase context)
{
try
{
var contextEngine = new ContextEngine();
return contextEngine.Device.IsMobile && !contextEngine.Device.IsTablet && contextEngine.Device.DisplayWidth > 480;
}
catch(Exception)
{
return false;
@rsleggett
rsleggett / Action.cs
Last active December 16, 2015 01:19
DD4T AutoModels example
public ActionResult Heading(IComponentPresentation componentPresentation)
{
var model = ComponentViewModelBuilder.Build<HeadingViewModel>(componentPresentation.Component);
return View(model);
}
@rsleggett
rsleggett / MyCustomExternalActivity.cs
Last active December 15, 2015 06:09
Example SDLTridion Workflow Activity
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
//This gives us StreamReader
using System.IO;
//This gives us the Data Contract info from the client
using Tridion.ContentManager.CoreService.Client;
//This gives us the core service methods and properties
// specific to workflow: must reference Tridion.ContentManager.CoreService.Workflow from
@rsleggett
rsleggett / DemoView.cshtml
Created February 11, 2013 22:39
DD4T UI 2012 for a Multimedia Link field
@using DD4T.Mvc.Html
@model DD4T.ContentModel.IComponentPresentation
<div>
@Html.SiteEditComponentPresentation(Model)
<div class="image">
@Html.SiteEditField(Model, Model.Component.Fields["image"])
<img src="@Model.Component.Fields["image"].LinkedComponentValues[0].MultiMedia.Url" alt="blah"/>
</div>
@rsleggett
rsleggett / DD4TResourceHelper.cs
Created January 28, 2013 00:03
This gist shows code for an IResourceProvider backed by DD4T. Depends on log4net. Assumes you have an implementation of the ICacheWrapper interface inserted into the IoC container being used as the DependencyResolver
using System.Web.Mvc;
using DD4T.ContentModel.Contracts.Providers;
using DD4T.ContentModel.Factories;
using DD4T.Providers.SDLTridion2011sp1;
using log4net;
namespace BuildingBlocks.DD4T.Core
{
public static class DD4TResourceHelper
{
@rsleggett
rsleggett / ComponentView.cshtml
Last active December 10, 2015 22:18 — forked from anonymous/ComponentView.cshtml
UI2012 samples for DD4T
@using DD4T.Mvc.Html
@model DD4T.ContentModel.IComponentPresentation
<div>
@Html.SiteEditComponentPresentation(Model)
<h1>@Html.SiteEditField(Model, Model.Component.Fields["title"])@Model.Component.Fields["title"].Value</h1>
</div>