Skip to content

Instantly share code, notes, and snippets.

View nul800sebastiaan's full-sized avatar
🔥

Sebastiaan Janssen nul800sebastiaan

🔥
View GitHub Profile
View
<div class="span9">
@Html.ValidationSummary(true)
@Html.TextAreaFor(model => model.Post,
new{@class = "span9 input-xlarge",
placeholder = "What are you doing?"})
@Html.TextBoxFor(model => model.Mentions,
new{@class = "span9 tokeninput",
placeholder = "Who should be notified?"})
@nul800sebastiaan
nul800sebastiaan / gist:4755162
Created February 11, 2013 15:36
Register Web API route in Umbraco 6
using System.Linq;
using System.Web.Http;
using System.Web.Routing;
using Umbraco.Core.Events;
using Umbraco.Core.Models;
using Umbraco.Core.Publishing;
using umbraco.interfaces;
namespace Site.EventHandlers
{
@inherits umbraco.MacroEngines.DynamicNodeContext
<div id="xsltsearch">
<div id="xsltsearch_results">
@{
var term = Request["search"];
if (term != null)
{
@nul800sebastiaan
nul800sebastiaan / gist:5256117
Created March 27, 2013 17:09
Implement Umbraco Macro Error event handler.
using System;
using umbraco.interfaces;
namespace MyNameSpace
{
public class StartupEventHandlers : IApplicationStartupHandler
{
public StartupEventHandlers()
{
umbraco.macro.Error += macro_Error;
<system.data>
<DbProviderFactories>
<remove invariant="System.Data.SqlServerCe.4.0"/>
<add name="Microsoft SQL Server Compact Data Provider 4.0" invariant="System.Data.SqlServerCe.4.0" description=".NET Framework Data Provider for Microsoft SQL Server Compact" type="System.Data.SqlServerCe.SqlCeProviderFactory, System.Data.SqlServerCe, Version=4.0.0.0, Culture=neutral, PublicKeyToken=89845dcd8080cc91" />
<remove invariant="MySql.Data.MySqlClient"/>
<add name="MySQL Data Provider" invariant="MySql.Data.MySqlClient" description=".Net Framework Data Provider for MySQL" type="MySql.Data.MySqlClient.MySqlClientFactory, MySql.Data, Version=6.6.4.0, Culture=neutral, PublicKeyToken=c5687fc88969c44d" />
</DbProviderFactories>
</system.data>
<script src="@Url.Content("~/Scripts/jquery-1.6.4.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery/jquery.unobtrusive-ajax.min.js")" type="text/javascript"></script>
<li><a href="#" id="login-result"></a></li>
@using (Ajax.BeginForm("LoginMember", "LoginSurface", new AjaxOptions { UpdateTargetId = "login-result" }))
{
var mediaImage = ms.CreateMedia("MyName", parentId, "Image");
mediaImage.SetValue("umbracoFile", file); // file is of type HttpPostedFile, HttpPostedFileBase (for example: Request.Files[i]) or HttpPostedFileWrapper
ms.Save(mediaImage);
<add name="umbracoDbDSN" connectionString="Data Source=|DataDirectory|\Umbraco.sdf" providerName="System.Data.SqlServerCe.4.0" />
Should be (notice the FLUSH INTERVAL in the connectionString):
<add name="umbracoDbDSN" connectionString="Data Source=|DataDirectory|\Umbraco.sdf;FLUSH INTERVAL=1" providerName="System.Data.SqlServerCe.4.0" />
SidebarNavigation.cshtml
@{
@*Get the root of the website *@
var root = Model.AncestorOrSelf(2);
}
<ul class="list2">
@foreach (var page in root.Children.Where("Visible"))
{
<li class="@page.IsAncestorOrSelf(Model, "current", "") @page.IsLast("last", "")">
@inherits umbraco.MacroEngines.DynamicNodeContext
@*
Macro to display a gallery from a media folder. Add the below parameter to the macro
and use it to point the macro at a specific media folder to display it's content as
a simple list.
Macro Parameters To Create, for this macro to work:
Show:True Alias:mediaId Name:Media Folder ID Type:MediaCurrent
*@