Skip to content

Instantly share code, notes, and snippets.


Janae Cram naepalm

View GitHub Profile
naepalm / FAQListing.cshtml
Last active Oct 8, 2019
An example of different ways to code the Umbraco FAQ Package's content.
View FAQListing.cshtml
@using FAQ
@inherits UmbracoTemplatePage
Layout = null;
<h2>Render All FAQ Items</h2>
naepalm / Editors\Base.cshtml
Last active Oct 30, 2017
Grid view & controls for Skybrud's strongly typed models with Responsive BP
View Editors\Base.cshtml
@model GridControl
@using Grid.Web
@using Skybrud.Umbraco.GridData
<text>@Html.Partial(Model.EditorView(), Model)</text>
catch (Exception ex) {
naepalm / TextPage.cshtml
Last active Mar 21, 2016
Basic text page template content with headings & general content for styling
View TextPage.cshtml
@inherits UmbracoViewPage<TextPageViewModel>
@using Client.Web.Models.ViewModels
Layout = "OneColumn.cshtml";
<section id="primary" class="col-s-8 offset-s-2">
<h1>Heading 1</h1>
naepalm / Pagination.cshtml
Last active Dec 22, 2021
A "quick & easy" razor pagination to plug into an Umbraco View, Partial View, or Macro
View Pagination.cshtml
var pageSize = 8;
pageSize = Model.Content.GetPropertyValue<int>("numberOfItemsPerPage");}
var page = 1; int.TryParse(Request.QueryString["page"], out page);
var items = Umbraco.TypedContent(Model.Content.Id).Children.Where(x => x.DocumentTypeAlias == "exampleAlias" && x.IsVisible()).OrderByDescending(x => x.CreateDate);
var totalPages = (int)Math.Ceiling((double)items.Count() / (double)pageSize);
if (page > totalPages)
View EventsLogic.cs
namespace Client.Web.Models
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Buzz.Hybrid;
using Buzz.Hybrid.Models;
naepalm / MediaSave.cshtml
Last active Dec 3, 2015
A little razor template snippet that re-saves/republishes all media in Umbraco
View MediaSave.cshtml
@using Umbraco.Core.Models;
var mediaService = ApplicationContext.Current.Services.MediaService;
naepalm / ContactForm.cs
Created Dec 3, 2015
Contact Form for Umbraco with a Departments dropdown list. Assumes the dropdown list is NestedContent on the selected Email Template.
View ContactForm.cs
using System.Collections.Generic;
using System.Linq;
using System.Web.Mvc;
using Umbraco.Core.Models;
using Umbraco.Web;
namespace Forms.Web.Models
public class ContactForm
naepalm / ContentExtensions.cs
Last active Jan 10, 2019
A set of useful extension methods for Umbraco properties.
View ContentExtensions.cs
namespace Client.Web
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Models;
using Newtonsoft.Json;
using Umbraco.Core.Models;
View CacheService.cs
public class CacheService : ICacheService
private readonly MemoryCache _memoryCache = new MemoryCache("Cache.Key");
public void Add<T>(T cacheObject, string key)
var cacheItemPolicy = new CacheItemPolicy
AbsoluteExpiration = DateTimeOffset.Now.AddHours(24)
naepalm / Helpers.js
Last active Aug 3, 2017
Helper functions for react, such as price currency formatting.
View Helpers.js
var Helpers = {
* @function formatMoney
* @param {number} n - The number to be formatted
* @param {string} d - The character to be used for the decimal. Defaults to ".".
* @param {string} t - the character to be used for the thousands separator. Defaults to ",".
* @param {int} c - the number of decimal places. Defaults to 2.
* @returns {string}
* @description Formats a number to a price