Merge branch 'temp-U4-5963' into dev-v7

This commit is contained in:
Sebastiaan Janssen
2015-10-28 17:02:51 +01:00
13 changed files with 190 additions and 139 deletions

View File

@@ -1 +1,17 @@
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 400;
src: url('../fonts/opensans/OpenSans-Regular-webfont.eot');
src: local('Open Sans'), local('OpenSans'), url('../fonts/opensans/OpenSans-Regular-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/opensans/OpenSans-Regular-webfont.ttf') format('truetype'), url('../fonts/opensans/OpenSans-Regular-webfont.svg#open_sansregular') format('svg');
}
@font-face {
font-family: 'Open Sans';
font-style: normal;
font-weight: 600;
src: url('../fonts/opensans/OpenSans-Semibold-webfont.eot');
src: local('Open Sans Semibold'), local('OpenSans-Semibold'), url('../fonts/opensans/OpenSans-Semibold-webfont.eot?#iefix') format('embedded-opentype'), url('../fonts/opensans/OpenSans-Semibold-webfont.ttf') format('truetype'), url('../fonts/opensans/OpenSans-Semibold-webfont.svg#open_sanssemibold') format('svg');
}
abbr,address,article,aside,audio,b,blockquote,body,canvas,caption,cite,code,dd,del,details,dfn,div,dl,dt,em,fieldset,figcaption,figure,footer,form,h1,h2,h3,h4,h5,h6,header,hgroup,html,i,iframe,img,ins,kbd,label,legend,li,mark,menu,nav,object,ol,p,pre,q,samp,section,small,span,strong,sub,summary,sup,table,tbody,td,tfoot,th,thead,time,tr,ul,var,video{margin:0;padding:0;outline:0;border:0;background:0 0;vertical-align:baseline;font-size:100%}article,aside,details,figcaption,figure,footer,header,hgroup,menu,nav,section{display:block}nav ul{list-style:none}blockquote,q{quotes:none}blockquote:after,blockquote:before,q:after,q:before{content:'';content:none}a{margin:0;padding:0;background:0 0;vertical-align:baseline;font-size:100%}ins{background-color:#ff9;color:#000;text-decoration:none}mark{background-color:#ff9;color:#000;font-weight:700;font-style:italic}del{text-decoration:line-through}abbr[title],dfn[title]{border-bottom:1px dotted;cursor:help}table{border-spacing:0;border-collapse:collapse}hr{display:block;margin:1em 0;padding:0;height:1px;border:0;border-top:1px solid #ccc}input,select{vertical-align:middle}html{-webkit-font-smoothing:antialiased;-moz-osx-font-smoothing:grayscale}*,:after,:before{box-sizing:border-box}body,html{height:100%;width:100%;color:#fff;font-family:'Open Sans',sans-serif;font-weight:400;font-size:.9375em;line-height:1.5}h1{font-size:1.7em;margin:40px auto 10px;font-weight:700}h2{font-size:1.35em;margin:0 auto .4em;font-weight:700}h3{font-size:1em;font-weight:400;font-style:italic}p{font-size:1em;line-height:1.6}p+a{margin-top:1rem;display:inline-block}a,a:active,a:visited{text-decoration:none}.cta{margin:4.5em auto 1.5em;padding-bottom:4.5em}.button,.button:visited{padding:.9375em 1.875em;border-radius:.1em;font-weight:600;font-size:1.2em;background:#2e99f4;color:#fff;display:inline-block;border:none;transition:all 200ms ease-in-out}.button:hover,.button:visited:hover{border-bottom:none;background:#0c80e3}section{background:url(../img/nonodesbg.jpg) center center/cover;height:100%;width:100%;display:table;padding:3em 1.75em}section a,section a:focus,section a:visited{color:#46a5f5;font-size:1.1625em;border-bottom:1px solid transparent;transition:border-bottom 100ms ease-in-out}section a:focus:hover,section a:hover,section a:visited:hover{border-bottom:1px solid}section:after{content:"";position:absolute;top:0;right:0;bottom:0;left:0;background:rgba(0,0,0,.17);background:linear-gradient(45deg,rgba(85,98,112,.1) 10%,rgba(255,107,107,.1) 95%);z-index:0}section article{display:table-cell;vertical-align:middle;margin:0 auto;text-align:center;position:relative;z-index:100}section article>div{max-width:60em;margin:0 auto}section .logo{background:url(../img/logo.png) no-repeat;width:91px;height:91px;margin:0 auto}section .row{overflow:hidden}section .row .col{text-align:left;width:100%}section .row .col:nth-child(2){margin-top:3em}@media screen and (min-width:48em){body,html{font-size:1em}h1{font-size:2.5em;margin:70px auto 0;letter-spacing:.5px}h2{font-size:1.4375em;margin:0 auto 1em}h3{font-size:1.2em}a{font-size:1.1rem;font-weight:600}p+a{margin-top:3rem}.cta{margin:7.5em auto 2.5em;border-bottom:1px solid rgba(255,255,255,.5);padding-bottom:7.5em}section{padding:0 15px}section .row .col{float:left;width:50%;padding-right:5%;display:inline-block}section .row .col:nth-child(2){padding-right:0;padding-left:5%;margin-top:0}.button{font-size:1.1625em}}

View File

@@ -1,16 +1,17 @@
LazyLoad.js([
'/Umbraco/lib/jquery/jquery.min.js',
'/Umbraco/lib/jquery-ui/jquery-ui.min.js',
'/Umbraco/lib/angular/1.1.5/angular.min.js',
'/Umbraco/lib/underscore/underscore-min.js',
'/Umbraco/js/app.js',
'/Umbraco/js/umbraco.resources.js',
'/Umbraco/js/umbraco.services.js',
'/Umbraco/js/umbraco.security.js',
'/Umbraco/ServerVariables',
'/Umbraco/lib/spectrum/spectrum.js',
'https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js',
'/umbraco/js/canvasdesigner.panel.js',
'../lib/jquery/jquery.min.js',
'../lib/jquery-ui/jquery-ui.min.js',
'../lib/angular/1.1.5/angular.min.js',
'../lib/underscore/underscore-min.js',
'../lib/umbraco/Extensions.js',
'../js/app.js',
'../js/umbraco.resources.js',
'../js/umbraco.services.js',
'../js/umbraco.security.js',
'../ServerVariables',
'../lib/spectrum/spectrum.js',
'../js/canvasdesigner.panel.js',
], function () {
jQuery(document).ready(function () {
angular.bootstrap(document, ['Umbraco.canvasdesigner']);

View File

@@ -9,11 +9,6 @@ var canvasdesignerConfig = {
schema: "body",
selector: "body",
editors: [
{
type: "wide",
category: "Dimension",
name: "Layout"
},
{
type: "background",
category: "Color",

View File

@@ -104,6 +104,30 @@ angular.module("Umbraco.canvasdesigner")
}
};
function loadFont(font, variant) {
WebFont.load({
google: {
families: [font.fontFamily + ":" + variant]
},
loading: function () {
console.log('loading');
},
active: function () {
$scope.selectedFont = font;
$scope.selectedFont.fontWeight = googleGetWeight(variant);
$scope.selectedFont.fontStyle = googleGetStyle(variant);
// If $apply isn't called, the new font family isn't applied until the next user click.
$scope.change({
fontFamily: $scope.selectedFont.fontFamily,
fontType: $scope.selectedFont.fontType,
fontWeight: $scope.selectedFont.fontWeight,
fontStyle: $scope.selectedFont.fontStyle,
});
}
});
}
var webFontScriptLoaded = false;
$scope.showFontPreview = function (font, variant) {
if (!variant)
@@ -114,27 +138,19 @@ angular.module("Umbraco.canvasdesigner")
// Font needs to be independently loaded in the iframe for live preview to work.
document.getElementById("resultFrame").contentWindow.getFont(font.fontFamily + ":" + variant);
WebFont.load({
google: {
families: [font.fontFamily + ":" + variant]
},
loading: function () {
console.log('loading');
},
active: function () {
$scope.selectedFont = font;
$scope.selectedFont.fontWeight = googleGetWeight(variant);
$scope.selectedFont.fontStyle = googleGetStyle(variant);
// If $apply isn't called, the new font family isn't applied until the next user click.
$scope.change({
fontFamily: $scope.selectedFont.fontFamily,
fontType: $scope.selectedFont.fontType,
fontWeight: $scope.selectedFont.fontWeight,
fontStyle: $scope.selectedFont.fontStyle,
if (!webFontScriptLoaded) {
$.getScript('https://ajax.googleapis.com/ajax/libs/webfont/1/webfont.js')
.done(function() {
webFontScriptLoaded = true;
loadFont(font, variant);
})
.fail(function() {
console.log('error loading webfont');
});
}
});
}
else {
loadFont(font, variant);
}
}
else {

View File

@@ -1,27 +0,0 @@
/**
* @ngdoc directive
* @name umbraco.directives.directive:umbAvatar
* @restrict E
**/
function avatarDirective() {
return {
restrict: "E", // restrict to an element
replace: true, // replace the html element with the template
templateUrl: 'views/directives/umb-avatar.html',
scope: {
name: '@',
email: '@',
hash: '@'
},
link: function(scope, element, attr, ctrl) {
scope.$watch("hash", function (val) {
//set the gravatar url
scope.gravatar = "https://www.gravatar.com/avatar/" + val + "?s=40";
});
}
};
}
angular.module('umbraco.directives').directive("umbAvatar", avatarDirective);

View File

@@ -1,5 +1,5 @@
angular.module('umbraco.services')
.factory('userService', function ($rootScope, eventsService, $q, $location, $log, securityRetryQueue, authResource, dialogService, $timeout, angularHelper) {
.factory('userService', function ($rootScope, eventsService, $q, $location, $log, securityRetryQueue, authResource, dialogService, $timeout, angularHelper, $http) {
var currentUser = null;
var lastUserId = null;
@@ -250,7 +250,7 @@ angular.module('umbraco.services')
}
setCurrentUser(data);
currentUser.avatar = 'https://www.gravatar.com/avatar/' + data.emailHash + '?s=40&d=404';
deferred.resolve(currentUser);
});

View File

@@ -372,9 +372,6 @@ function xmlhelper($http) {
fromJson: function (json) {
var xml = x2js.json2xml_str(json);
return xml;
},
parseFeed: function (url) {
return $http.jsonp('//ajax.googleapis.com/ajax/services/feed/load?v=1.0&num=50&callback=JSON_CALLBACK&q=' + encodeURIComponent(url));
}
};
}

View File

@@ -88,27 +88,32 @@ function MainController($scope, $rootScope, $location, $routeParams, $timeout, $
tmhDynamicLocale.set($scope.user.locale);
}
if($scope.user.emailHash){
$timeout(function () {
//yes this is wrong..
$("#avatar-img").fadeTo(1000, 0, function () {
$timeout(function () {
//this can be null if they time out
if ($scope.user && $scope.user.emailHash) {
var avatarBaseUrl = "//www.gravatar.com/avatar/",
hash = $scope.user.emailHash;
if ($scope.user.emailHash) {
$scope.avatar = [
{ value: avatarBaseUrl + hash + ".jpg?s=30&d=mm" },
{ value: avatarBaseUrl + hash + ".jpg?s=60&d=mm" },
{ value: avatarBaseUrl + hash + ".jpg?s=90&d=mm" }
];
}
//let's attempt to load the avatar, it might not exist or we might not have
// internet access so we'll detect it first
$http.get("https://www.gravatar.com/avatar/" + $scope.user.emailHash + ".jpg?s=64&d=404")
.then(
function successCallback(response) {
$("#avatar-img").fadeTo(1000, 0, function () {
$scope.$apply(function () {
//this can be null if they time out
if ($scope.user && $scope.user.emailHash) {
var avatarBaseUrl = "https://www.gravatar.com/avatar/",
hash = $scope.user.emailHash;
$scope.avatar = [
{ value: avatarBaseUrl + hash + ".jpg?s=30&d=mm" },
{ value: avatarBaseUrl + hash + ".jpg?s=60&d=mm" },
{ value: avatarBaseUrl + hash + ".jpg?s=90&d=mm" }
];
}
});
$("#avatar-img").fadeTo(1000, 1);
});
}, function errorCallback(response) {
//cannot load it from the server so we cannot do anything
});
$("#avatar-img").fadeTo(1000, 1);
});
}, 3000);
}
}));

View File

@@ -1,3 +0,0 @@
<a href="#" title="{{name}}">
<img ng-src="{{gravatar}}" />
</a>

View File

@@ -16,15 +16,8 @@
<meta name="description" content="">
<meta name="author" content="">
<link href='https://fonts.googleapis.com/css?family=Open+Sans:300,400,700,600' rel='stylesheet' type='text/css'>
<link href='https://fonts.googleapis.com/css?family=Asap:400,700,400italic,700italic' rel='stylesheet' type='text/css'>
<link rel="stylesheet" href="../../Umbraco/assets/css/nonodes.style.min.css" />
<!--[if lt IE 9]>
<script src="https://cdnjs.cloudflare.com/ajax/libs/modernizr/2.7.1/modernizr.min.js"></script>
<![endif]-->
</head>
<body>

View File

@@ -87,7 +87,7 @@ namespace Umbraco.Web
}
//[Obsolete("This should not be used, GetGridHtml methods accepting HtmlHelper as a parameter or GetGridHtml extensions on HtmlHelper should be used instead")]
[Obsolete("This should not be used, GetGridHtml methods accepting HtmlHelper as a parameter or GetGridHtml extensions on HtmlHelper should be used instead")]
public static MvcHtmlString GetGridHtml(this IPublishedProperty property, string framework = "bootstrap3")
{
var asString = property.Value as string;
@@ -97,13 +97,13 @@ namespace Umbraco.Web
return htmlHelper.GetGridHtml(property, framework);
}
//[Obsolete("This should not be used, GetGridHtml methods accepting HtmlHelper as a parameter or GetGridHtml extensions on HtmlHelper should be used instead")]
[Obsolete("This should not be used, GetGridHtml methods accepting HtmlHelper as a parameter or GetGridHtml extensions on HtmlHelper should be used instead")]
public static MvcHtmlString GetGridHtml(this IPublishedContent contentItem)
{
return GetGridHtml(contentItem, "bodyText", "bootstrap3");
}
//[Obsolete("This should not be used, GetGridHtml methods accepting HtmlHelper as a parameter or GetGridHtml extensions on HtmlHelper should be used instead")]
[Obsolete("This should not be used, GetGridHtml methods accepting HtmlHelper as a parameter or GetGridHtml extensions on HtmlHelper should be used instead")]
public static MvcHtmlString GetGridHtml(this IPublishedContent contentItem, string propertyAlias)
{
Mandate.ParameterNotNullOrEmpty(propertyAlias, "propertyAlias");
@@ -111,7 +111,7 @@ namespace Umbraco.Web
return GetGridHtml(contentItem, propertyAlias, "bootstrap3");
}
//[Obsolete("This should not be used, GetGridHtml methods accepting HtmlHelper as a parameter or GetGridHtml extensions on HtmlHelper should be used instead")]
[Obsolete("This should not be used, GetGridHtml methods accepting HtmlHelper as a parameter or GetGridHtml extensions on HtmlHelper should be used instead")]
public static MvcHtmlString GetGridHtml(this IPublishedContent contentItem, string propertyAlias, string framework)
{
Mandate.ParameterNotNullOrEmpty(propertyAlias, "propertyAlias");
@@ -127,7 +127,7 @@ namespace Umbraco.Web
return htmlHelper.GetGridHtml(contentItem, propertyAlias, framework);
}
//[Obsolete("This shouldn't need to be used but because the obsolete extension methods above don't have access to the current HtmlHelper, we need to create a fake one, unfortunately however this will not pertain the current views viewdata, tempdata or model state so should not be used")]
[Obsolete("This shouldn't need to be used but because the obsolete extension methods above don't have access to the current HtmlHelper, we need to create a fake one, unfortunately however this will not pertain the current views viewdata, tempdata or model state so should not be used")]
private static HtmlHelper CreateHtmlHelper(object model)
{
var cc = new ControllerContext

View File

@@ -868,8 +868,7 @@ namespace Umbraco.Web
}
#endregion
#region Wrap
public static HtmlTagWrapper Wrap(this HtmlHelper html, string tag, string innerText, params IHtmlTagWrapper[] children)
@@ -935,7 +934,71 @@ namespace Umbraco.Web
return item;
}
#endregion
#endregion
}
#region canvasdesigner
public static IHtmlString EnableCanvasDesigner(this HtmlHelper html,
UrlHelper url,
UmbracoContext umbCtx)
{
return html.EnableCanvasDesigner(url, umbCtx, string.Empty, string.Empty);
}
public static IHtmlString EnableCanvasDesigner(this HtmlHelper html,
UrlHelper url,
UmbracoContext umbCtx, string canvasdesignerConfigPath)
{
return html.EnableCanvasDesigner(url, umbCtx, canvasdesignerConfigPath, string.Empty);
}
public static IHtmlString EnableCanvasDesigner(this HtmlHelper html,
UrlHelper url,
UmbracoContext umbCtx, string canvasdesignerConfigPath, string canvasdesignerPalettesPath)
{
var umbracoPath = url.Content(SystemDirectories.Umbraco);
string previewLink = @"<script src=""{0}/lib/jquery/jquery.min.js"" type=""text/javascript""></script>" +
@"<script src=""{1}"" type=""text/javascript""></script>" +
@"<script src=""{2}"" type=""text/javascript""></script>" +
@"<script type=""text/javascript"">var pageId = '{3}'</script>" +
@"<script src=""{0}/js/canvasdesigner.front.js"" type=""text/javascript""></script>";
string noPreviewLinks = @"<link href=""{1}"" type=""text/css"" rel=""stylesheet"" data-title=""canvasdesignerCss"" />";
// Get page value
int pageId = umbCtx.PublishedContentRequest.UmbracoPage.PageID;
string[] path = umbCtx.PublishedContentRequest.UmbracoPage.SplitPath;
string result = string.Empty;
string cssPath = CanvasDesignerUtility.GetStylesheetPath(path, false);
if (umbCtx.InPreviewMode)
{
canvasdesignerConfigPath = string.IsNullOrEmpty(canvasdesignerConfigPath) == false
? canvasdesignerConfigPath
: string.Format("{0}/js/canvasdesigner.config.js", umbracoPath);
canvasdesignerPalettesPath = string.IsNullOrEmpty(canvasdesignerPalettesPath) == false
? canvasdesignerPalettesPath
: string.Format("{0}/js/canvasdesigner.palettes.js", umbracoPath);
if (string.IsNullOrEmpty(cssPath) == false)
result = string.Format(noPreviewLinks, cssPath) + Environment.NewLine;
result = result + string.Format(previewLink, umbracoPath, canvasdesignerConfigPath, canvasdesignerPalettesPath, pageId);
}
else
{
// Get css path for current page
if (string.IsNullOrEmpty(cssPath) == false)
result = string.Format(noPreviewLinks, cssPath);
}
return new HtmlString(result);
}
#endregion
}
}

View File

@@ -14,6 +14,9 @@ using Umbraco.Core.Xml;
using Umbraco.Web.Routing;
using Umbraco.Web.Security;
using System.Collections.Generic;
using System.IO;
using System.Web.Mvc;
using System.Web.Routing;
using Umbraco.Core.Cache;
namespace Umbraco.Web
@@ -1170,52 +1173,44 @@ namespace Umbraco.Web
#region canvasdesigner
public HtmlString EnableCanvasDesigner()
[Obsolete("Use EnableCanvasDesigner on the HtmlHelper extensions instead")]
public IHtmlString EnableCanvasDesigner()
{
return EnableCanvasDesigner(string.Empty, string.Empty);
}
public HtmlString EnableCanvasDesigner(string canvasdesignerConfigPath)
[Obsolete("Use EnableCanvasDesigner on the HtmlHelper extensions instead")]
public IHtmlString EnableCanvasDesigner(string canvasdesignerConfigPath)
{
return EnableCanvasDesigner(canvasdesignerConfigPath, string.Empty);
}
public HtmlString EnableCanvasDesigner(string canvasdesignerConfigPath, string canvasdesignerPalettesPath)
[Obsolete("Use EnableCanvasDesigner on the HtmlHelper extensions instead")]
public IHtmlString EnableCanvasDesigner(string canvasdesignerConfigPath, string canvasdesignerPalettesPath)
{
var html = CreateHtmlHelper("");
var urlHelper = new UrlHelper(UmbracoContext.HttpContext.Request.RequestContext);
return html.EnableCanvasDesigner(urlHelper, UmbracoContext, canvasdesignerConfigPath, canvasdesignerPalettesPath);
}
string previewLink = @"<script src=""/Umbraco/lib/jquery/jquery.min.js"" type=""text/javascript""></script>" +
@"<script src=""{0}"" type=""text/javascript""></script>" +
@"<script src=""{1}"" type=""text/javascript""></script>" +
@"<script type=""text/javascript"">var pageId = '{2}'</script>" +
@"<script src=""/umbraco/js/canvasdesigner.front.js"" type=""text/javascript""></script>";
string noPreviewLinks = @"<link href=""{0}"" type=""text/css"" rel=""stylesheet"" data-title=""canvasdesignerCss"" />";
// Get page value
int pageId = UmbracoContext.PublishedContentRequest.UmbracoPage.PageID;
string[] path = UmbracoContext.PublishedContentRequest.UmbracoPage.SplitPath;
string result = string.Empty;
string cssPath = CanvasDesignerUtility.GetStylesheetPath(path, false);
if (UmbracoContext.Current.InPreviewMode)
[Obsolete("This shouldn't need to be used but because the obsolete extension methods above don't have access to the current HtmlHelper, we need to create a fake one, unfortunately however this will not pertain the current views viewdata, tempdata or model state so should not be used")]
private HtmlHelper CreateHtmlHelper(object model)
{
var cc = new ControllerContext
{
canvasdesignerConfigPath = !string.IsNullOrEmpty(canvasdesignerConfigPath) ? canvasdesignerConfigPath : "/umbraco/js/canvasdesigner.config.js";
canvasdesignerPalettesPath = !string.IsNullOrEmpty(canvasdesignerPalettesPath) ? canvasdesignerPalettesPath : "/umbraco/js/canvasdesigner.palettes.js";
if (!string.IsNullOrEmpty(cssPath))
result = string.Format(noPreviewLinks, cssPath) + Environment.NewLine;
RequestContext = UmbracoContext.HttpContext.Request.RequestContext
};
var viewContext = new ViewContext(cc, new FakeView(), new ViewDataDictionary(model), new TempDataDictionary(), new StringWriter());
var htmlHelper = new HtmlHelper(viewContext, new ViewPage());
return htmlHelper;
}
result = result + string.Format(previewLink, canvasdesignerConfigPath, canvasdesignerPalettesPath, pageId);
}
else
[Obsolete("This shouldn't need to be used but because the obsolete extension methods above don't have access to the current HtmlHelper, we need to create a fake one, unfortunately however this will not pertain the current views viewdata, tempdata or model state so should not be used")]
private class FakeView : IView
{
public void Render(ViewContext viewContext, TextWriter writer)
{
// Get css path for current page
if (!string.IsNullOrEmpty(cssPath))
result = string.Format(noPreviewLinks, cssPath);
}
return new HtmlString(result);
}
#endregion