Skip to content

Instantly share code, notes, and snippets.

View kgiszewski's full-sized avatar

Kevin Giszewski kgiszewski

View GitHub Profile
@kgiszewski
kgiszewski / gist:67787c06629723c7b329
Last active August 29, 2015 14:03
Store Hours Prop Converter
//model
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace StoreHours.Models
{
public class StoreHoursModel
@inherits Umbraco.Web.Mvc.UmbracoViewPage<ArchetypeFieldsetModel>
@using TableEditor.Models;
@using Archetype.Models;
@{
if (Model == null)
{
return;
}
var tableModel = Model.GetValue<TableEditorModel>("table");
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Web.Http;
using Umbraco.Core.Logging;
using Umbraco.Web.WebApi;
using SomeNS.Umbraco.Extensions.Models;
var myArchetype = new ArchetypeModel()
{
Fieldsets = new List<ArchetypeFieldsetModel>()
{
new ArchetypeFieldsetModel()
{
Alias = "fs1",
Properties = new List<ArchetypePropertyModel>()
{
new ArchetypePropertyModel()
public static IHtmlString TransformGlossaryTerms(this string input, ControllerContext context)
{
if (String.IsNullOrWhiteSpace(input))
{
return new HtmlString(input);
}
var glossaryTerms = new List<string>();
foreach (var term in NodeHelper.Instance.Glossary.Descendants("GlossaryTerm"))
.archetypeEditor .archetypeProperty {
clear: none;
}
.archetypeEditor textarea {
min-width: auto;
width: auto;
}
.row8-4 .firstColumn {
@using Newtonsoft.Json;
@using Archetype.Models;
var myArchetype = JsonConvert.DeserializeObject<ArchetypeModel>(luceneResult.Fields[field]);//this has to be pure Archetype JSON
var firstFieldset = myArchetype.Fieldsets.FirstOrDefault();//assuming it's always one fieldset or less
if (firstFieldset != null)
{
<div>
@inherits Umbraco.Web.Mvc.UmbracoTemplatePage
@using Archetype.Models
@using Archetype.Extensions
@* Ensure that the Current Page has children, where the property umbracoNaviHide is not True *@
@if (CurrentPage.Children.Where("Visible").Any())
{
@* For each child page under the root node, where the property umbracoNaviHide is not True *@
foreach (var childPage in Model.Content.Children.Where("Visible"))
//Register some JS with Umbraco
//~/App_Plugins/ArchetypeLabelTemplates/package.manifest
{
"javascript": [
"~/App_Plugins/ArchetypeLabelTemplates/urlpicker.js"
]
}
//Define your label code here
//~/App_Plugins/ArchetypeLabelTemplates/urlpicker.js
[HttpPost]
public object MyMethod(List<string> ids)
{
}