Skip to content

Instantly share code, notes, and snippets.

View naepalm's full-sized avatar

Janae Cram naepalm

View GitHub Profile
@naepalm
naepalm / ContactForm.cs
Created December 3, 2015 19:49
Contact Form for Umbraco with a Departments dropdown list. Assumes the dropdown list is NestedContent on the selected Email Template.
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
naepalm / FAQListing.cshtml
Last active October 8, 2019 23:45
An example of different ways to code the Umbraco FAQ Package's content.
@using FAQ
@inherits UmbracoTemplatePage
@{
Layout = null;
}
<h1>@Model.Content.Name</h1>
<h2>Render All FAQ Items</h2>
@naepalm
naepalm / TheEnd.md
Last active October 14, 2019 01:03
People say you only die once, but Bryce Kenoyer knows the unlucky ones have a chance to die twice.

The Witching Hour, October 12, 2019

She spent an entire five minutes standing in the woods a short walk from her house, screaming. It doesn't matter. Screaming her pain into the void has only resulted in something happening once over the last two years she's done it when the night has been particularly bad. And in that moment, there had been a gorgon. But tonight, with the worst news she's had in three years, Bryce needed to do something - even if it's entirely futile - to let it out.

That was a half an hour ago. Now, she's sitting in the treehouse, burrowed in her insulated sleeping bag with half a bottle of whiskey left and no end to the misery. But a crisp, clear October night means the stars are out and beautiful against the dark sky. So Bryce stares at it as she takes pulls from the bottle, body warm but face cold against the air, and she remembers.


Early Evening, January 17, 2016

@naepalm
naepalm / Pagination.cshtml
Last active December 22, 2021 12:29
A "quick & easy" razor pagination to plug into an Umbraco View, Partial View, or Macro
@{
var pageSize = 8;
if(Model.Content.HasValue("numberOfItemsPerPage")){
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)