Skip to content

Instantly share code, notes, and snippets.

@komainu85
komainu85 / FriendlyUrl.cs
Last active September 10, 2015 11:50
Sitecore Friendly URL Computed Field
using System.Xml;
using Sitecore.ContentSearch;
using Sitecore.ContentSearch.ComputedFields;
using Sitecore.Data.Items;
using Sitecore.Links;
using Sitecore.Xml;
namespace MikeRobbins.ContentSearch.ComputedFields
{
public class FriendlyUrl : AbstractComputedIndexField
@komainu85
komainu85 / Form label animation with no-js fallback.markdown
Created August 4, 2015 09:45
Form label animation with no-js fallback

Form label animation with no-js fallback

Simply add a surrounding element with a class name of "input-wrap" then add a class to your input, textarea etc... of "input-wrap__field" and you should see some sweet animation :)

A Pen by Matthew Neil on CodePen.

License.

@komainu85
komainu85 / IDBinder.cs
Last active August 29, 2015 14:25
Sitecore ID Model Binder
using Sitecore.Data;
using System.Web.Mvc;
namespace MikeRobbins.SitecoreUtilities.ModelBinders
{
public class IDBinder : DefaultModelBinder
{
public override object BindModel(ControllerContext controllerContext, ModelBindingContext bindingContext)
{
ID id = ID.Null;
@komainu85
komainu85 / Automapper Adapter Pattern
Created July 17, 2015 14:51
Automapper Adapter Pattern
public class Mapper : IMapper
{
public T Map<S, T>(S source)
{
AutoMapper.Mapper.CreateMap<S, T>();
T result = AutoMapper.Mapper.Map<S, T>(source);
return result;
}
@komainu85
komainu85 / Open Content Editor Tab Within Custom Editor Sitecore.js
Last active August 29, 2015 14:24
Open Content Editor Tab Within Custom Editor Sitecore
parent.scForm.postRequest(\'\', \'\', \'\', \'contenteditor:launchtab(url={ITEMIDHERE}, la={LANGUAGENAMEHERE}, datasource=sitecore)\')
@komainu85
komainu85 / ChartController.cs
Created June 24, 2015 14:58
Sitecore Services API Controller
namespace MikeRobbins.Controllers
{
[ServicesController]
public class ChartController : ServicesApiController
{
private ISearcher _searcher;
private IMapper _mapper;
public ChartController(ISearcher iSearcher, IMapper iMapper)
{
@komainu85
komainu85 / Sitecore SPEAK open tab in parent Content Editor
Created June 23, 2015 13:19
Sitecore SPEAK open tab in parent Content Editor
parent.scForm.postRequest(\'\', \'\', \'\', \'contenteditor:launchtab(url={{DatasourceId}}, la=en, datasource=sitecore)\')
public class DmsManager : IDmsManager
{
readonly Guid _searchPageEventGuid = Sitecore.Context.Database.GetItem("{0C179613-2073-41AB-992E-027D03D523BF}").ID.Guid;
readonly Guid _downloadPageEventGuid = Sitecore.Context.Database.GetItem("{FA72E131-3CFD-481C-8E15-04496E9586DC}").ID.Guid;
private ICurrentPageContext CurrentPage()
{
return Tracker.Current.Session.Interaction.CurrentPage;
}
@komainu85
komainu85 / Entity Service Validation Model.cs
Last active August 29, 2015 14:21
Entity Service Validation Model
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Web;
namespace MikeRobbins.EntityServiceDemo.Models
{
public class NewsArticle : Sitecore.Services.Core.Model.EntityIdentity
{
@komainu85
komainu85 / Entity Service Validation JavaScript
Created May 25, 2015 16:57
Entity Service Validation JavaScript
EntityService.utils.validator.add("notPastDate", function (value, params) {
var result = false;
var currentDate = new Date();
result = value >= currentDate;
return result;
});