Skip to content

Instantly share code, notes, and snippets.

@joeriks
Created December 29, 2011 23:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save joeriks/1536616 to your computer and use it in GitHub Desktop.
Save joeriks/1536616 to your computer and use it in GitHub Desktop.
A very raw jQuery mobile template for umbraco - no local js&css files needed, just paste as template and go
<%@ Master Language="C#" MasterPageFile="~/umbraco/masterpages/default.master" AutoEventWireup="true" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolderDefault" runat="server">
<!-- save as a template with the name mobile, I guess you could also use the urls .../mobile instead of ?alttemplate=mobile -->
<!DOCTYPE html>
<html>
<head>
<title>
<umbraco:item field="name" runat="server"></umbraco:item>
</title>
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.css" />
<script type="text/javascript" src="http://code.jquery.com/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="http://code.jquery.com/mobile/1.0/jquery.mobile-1.0.min.js"></script>
</head>
<body>
<div data-role="page">
<div data-role="header">
<div data-role="header" data-position="inline">
<a href="/?altTemplate=mobile" data-icon="home">Home</a>
<h1>
<umbraco:item field="name" runat="server"></umbraco:item>
</h1>
</div>
<div data-role="navbar">
<ul>
<umbraco:macro runat="server" language="cshtml">
@{
var navLevel = 1;
if (Model.Level>1)
{
navLevel = 2;
}
foreach(var c in Model.AncestorOrSelf(navLevel).Children)
{
if(c.Id == Model.Id)
{
<li><a href="@c.Url?altTemplate=mobile" class="ui-btn-active">@c.Name</a></li>
}
else
{
<li><a href="@c.Url?altTemplate=mobile">@c.Name</a></li>
}
}
}
</umbraco:macro>
</ul>
</div>
</div>
<asp:ContentPlaceHolder ID="MainContent" runat="server">
<div data-role="content">
<p class="introduction">
<strong>
<umbraco:item field="introduction" runat="server"></umbraco:item>
</strong>
</p>
<umbraco:item field="bodyText" runat="server"></umbraco:item>
</div>
</asp:ContentPlaceHolder>
<div data-role="footer">
No footer here yet</div>
</div>
</body>
</html>
</asp:Content>
@rg07
Copy link

rg07 commented Apr 3, 2013

This works great, except any Url Link that is in the content area, does not load. It hangs on the jquery spinner. Has anyone else ran into this with this code. The navigation works fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment