This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('darkweekend', ['ngRoute', 'ngAnimate', 'ui.router', 'dw.controllers', 'dw.services']) | |
.config(['$urlRouterProvider', '$stateProvider', '$locationProvider', function ($urlRouterProvider, $stateProvider, $locationProvider) { | |
//$urlRouterProvider.otherwise("/ab"); $locationProvider.html5Mode(true); | |
$locationProvider.html5Mode(true); | |
$stateProvider | |
.state("home", { | |
url: "*path", | |
templateProvider: function (templateService, contentService, $q, $stateParams) { | |
var d = $q.defer(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@inherits Umbraco.Web.Mvc.UmbracoViewPage<AngRenderModel> | |
@{ | |
Layout = Model.isApp ? "Blank.cshtml" : "Static.cshtml"; | |
} | |
@section Content { | |
@if(Model.isApp) { | |
<div ng-bind-html="html(content.body)"></div> | |
<img umb-media="content.Properties.image.DataValue" /> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
app.controller('RouteController', ['$scope', 'PublishedContent', '$sce', 'contentService', function ($scope, PublishedContent, $sce, contentService) { | |
// we set the content to be the published content. Now the view has access to all of its properties. | |
$scope.content = PublishedContent; | |
$scope.html = function (s) { | |
return $sce.trustAsHtml(s); | |
} | |
}]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('dw.controllers', ['dw.services']). | |
controller('AppController', ['$rootScope', '$scope', '$location', '$routeParams', 'contentService', function ($rootScope, $scope, $location, $routeParams, contentService) { | |
$rootScope.safeApply = function (fn) { | |
var phase = this.$root.$$phase; | |
if (phase == '$apply' || phase == '$digest') { | |
if (fn && (typeof (fn) === 'function')) { | |
fn(); | |
} | |
} else { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
angular.module('dw.services', []) | |
.value('serviceBase', "/umbraco/api/pagegenapi/") | |
.factory('serviceApi', ['serviceBase', function (serviceBase) { | |
var service = { | |
base: serviceBase, | |
getMedia: serviceBase + 'GetMedia', | |
getContent: serviceBase + 'getContent', | |
getPath: serviceBase + 'getPage', | |
getChildren: serviceBase + 'getChildren' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"Id": 1053, | |
"Name": "Site", | |
"Url": "/", | |
"Path": "-1,1053", | |
"ContentTypeAlias": "SiteMaster", | |
"Properties": { | |
"umbracoRedirect": { | |
"DataValue": "", | |
"HasValue": false, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MvcApplication1.Controllers | |
{ | |
// mvc needs a class to serialize a post, this is for a url | |
public class UrlModel | |
{ | |
public string url { get; set; } | |
} | |
// id class for post | |
public class IdModel |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MvcApplication1.Models | |
{ | |
public class PropertyViewModel | |
{ | |
public object DataValue { get; set; } | |
public bool HasValue { get; set; } | |
public string PropertyTypeAlias { get; set; } | |
public object Value { get; set; } | |
public object XPathValue { get; set; } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace App.Models | |
{ | |
public class AngRenderModel : Umbraco.Web.Models.RenderModel | |
{ | |
public bool isApp { get; set; } | |
public AngRenderModel(): base(UmbracoContext.Current.PublishedContentRequest.PublishedContent) | |
{ | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
namespace MvcApplication1.Controllers | |
{ | |
public class DefaultController : Umbraco.Web.Mvc.RenderMvcController | |
{ | |
// | |
// GET: /Default/ | |
public ActionResult Index(AngRenderModel model) | |
{ |
OlderNewer