Sitecore Hackathon 2015 Part I – Sitecore SPEAK

Assert.IsNotNullOrEmpty (teamName, “Team name can’t be null”)

Last weekend the second 24 hour Sitecore Hackathon took place with the best and brightest from the community competed in teams to build the best Sitecore 8 Module. My brother and I decided to enter a team with a nerdy name referencing the Sitecore API. This was my first Hackathon and I had a romantic view of it being like that scene in The Social Network however in reality it came to be something even better.

Approach

With the Hackathon starting at Saturday 1AM GMT we stayed awake long enough to choose a category before crashing after a long working day. We opted for Best Development Experience Module; being developers we had a few ideas that could make tasks we repeat easier.

We agreed that with just 24 hours to deliver, we had to aim for something with achievable core functionality. This is where the idea to improve resetting Items to standard values came in. The idea was about giving more flexibility to allow fields of an Item to be reset independently as opposed to the core functionality of resetting the whole item. After User Story definition and sprint planning we decided that the Module would exist within a SPEAK Modal opened by a custom button in the Content Editor ribbon. It would give relevant information on each field; originating Template, current value, standard value etc even working with multiple Base Templates.

Standard Values Controller

The guiding principle was to to have multiple points of entry to the Module so that developers would form a habit of using it, i.e. removing the overhead of accessing the Module for all the scenarios or reducing the it to the point where it is negligible:

  1. Pressing the ribbon button when viewing an Item allows control over the item’s fields.
  2. Pressing the ribbon button when viewing a Template Item allows control over all items that are based on that Template.
  3. Pressing the Launch Pad button allows Items and Item Templates to be selected via search.

Implementation

As the Module exists within SPEAK we would require designing a SPEAK Layout, creating Javascript for the Page Code, a Razor cshtml file for the View. Finally, utilising Sitecore.Services.Client’s EntityService and IRepository to facilitate the controller to perform the fetch and update functions.

SPEAK

SPEAK being a great accelerator meant that we had the Modal appearing in Sitecore in minutes, leaving us to concentrate on the Page Code and View.

SPEAK Design Layout

The ListControl is bound to a custom Razor file we based on the existing Sitecore Title.cshtml file with modifications to render out the modal and allow the functionality to select/unselect fields to be reset.

I can’t take credit for the great work Mike produced for the Page Code, his blogs cover pretty much everything needed to know about SPEAK.

In order for the Modal to show the correct fields of the Item in Context when the ribbon button is clicked. The Item Id is retrieved via QueryString and passed to the GetFields function on initialision of the SPEAK Modal. This in turn calls and executes EntityService and binds the output to the datasource.

The update functions in much the same way; fetching the Item via EntityService then looping through each Field, flagging those to reset to standard values, and calling the save function on the Item to trigger the update.

Part II – EntityService in Sitecore.Services.Client >

Advertisements

3 thoughts on “Sitecore Hackathon 2015 Part I – Sitecore SPEAK

  1. Pingback: My Sitecore Modules and Contributions | Mike Robbins

  2. Pingback: Sitecore Hackathon 2015 Part II – EntityService in Sitecore.Services.Client | Exercising Sitecore

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s