From fd2b9ce67dadb1383d987b02d8a51ff186b34c92 Mon Sep 17 00:00:00 2001 From: antoine Date: Tue, 27 May 2014 12:37:43 +0200 Subject: [PATCH 1/4] /umbraco/dialogs/tuning.aspx removed --- src/Umbraco.Web.UI/Umbraco.Web.UI.csproj | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj index 40ddecb06f..9660654391 100644 --- a/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj +++ b/src/Umbraco.Web.UI/Umbraco.Web.UI.csproj @@ -537,7 +537,6 @@ treeInit.aspx - From 6382515258e63a57082a849c74ed05944ce044e3 Mon Sep 17 00:00:00 2001 From: antoine Date: Wed, 28 May 2014 11:29:08 +0200 Subject: [PATCH 2/4] Device preview always enable --- src/Umbraco.Web.UI/Umbraco/js/tuning.panel.js | 64 ++++++++++--------- src/Umbraco.Web.UI/Umbraco/preview/index.html | 8 +-- 2 files changed, 39 insertions(+), 33 deletions(-) diff --git a/src/Umbraco.Web.UI/Umbraco/js/tuning.panel.js b/src/Umbraco.Web.UI/Umbraco/js/tuning.panel.js index 618a3b3a81..5181956345 100644 --- a/src/Umbraco.Web.UI/Umbraco/js/tuning.panel.js +++ b/src/Umbraco.Web.UI/Umbraco/js/tuning.panel.js @@ -44,7 +44,7 @@ var setFrameIsLoaded = function (tuningParameterUrl) { console.info("iframe id loaded " + tuningParameterUrl); var scope = angular.element($("#tuningPanel")).scope(); scope.tuningParameterUrl = tuningParameterUrl; - scope.frameLoaded++; + scope.enableTuning++; scope.frameFirstLoaded = true; scope.$apply(); } @@ -60,8 +60,12 @@ angular.module("umbraco.tuning", ['ui.bootstrap', 'spectrumcolorpicker', 'ui.sli .controller("Umbraco.tuningController", function ($scope, $modal, $http, $window, $timeout, $location) { $scope.isOpen = false; - $scope.frameLoaded = 0; + + $scope.frameLoaded = false; + $scope.enableTuning = 0; $scope.frameFirstLoaded = false; + + $scope.tuningParameterUrl = ""; $scope.schemaFocus = "body"; $scope.settingIsOpen = 'previewDevice'; @@ -128,28 +132,31 @@ angular.module("umbraco.tuning", ['ui.bootstrap', 'spectrumcolorpicker', 'ui.sli // Refresh all less parameters for every changes watching tuningModel var refreshtuning = function () { var parameters = []; - $.each($scope.tuningModel.categories, function (indexCategory, category) { - $.each(category.sections, function (indexSection, section) { - $.each(section.subSections, function (indexSubSection, subSection) { - $.each(subSection.fields, function (indexField, field) { - // value - parameters.splice(parameters.length + 1, 0, "'@" + field.alias + "':'" + field.value + "'"); + if ($scope.tuningModel) { + $.each($scope.tuningModel.categories, function (indexCategory, category) { + $.each(category.sections, function (indexSection, section) { + $.each(section.subSections, function (indexSubSection, subSection) { + $.each(subSection.fields, function (indexField, field) { - // special init for font family picker - if (field.type == "fontFamilyPicker") { - parameters.splice(parameters.length + 1, 0, "'@" + field.alias + "_weight':'" + field.fontWeight + "'"); - parameters.splice(parameters.length + 1, 0, "'@" + field.alias + "_Style':'" + field.fontStyle + "'"); - } + // value + parameters.splice(parameters.length + 1, 0, "'@" + field.alias + "':'" + field.value + "'"); + // special init for font family picker + if (field.type == "fontFamilyPicker") { + parameters.splice(parameters.length + 1, 0, "'@" + field.alias + "_weight':'" + field.fontWeight + "'"); + parameters.splice(parameters.length + 1, 0, "'@" + field.alias + "_Style':'" + field.fontStyle + "'"); + } + + }) }) }) - }) - }); - - // Refrech page style - document.getElementById("resultFrame").contentWindow.refrechLayout(parameters); + }); + // Refrech page style + if (document.getElementById("resultFrame").contentWindow.refrechLayout) + document.getElementById("resultFrame").contentWindow.refrechLayout(parameters); + } } var openIntelTuning = function () { @@ -243,15 +250,13 @@ angular.module("umbraco.tuning", ['ui.bootstrap', 'spectrumcolorpicker', 'ui.sli // Delete current page tuning $scope.deleteTuning = function () { - $('.btn-default-delete').attr("disabled", true); $http.get('/Umbraco/Api/tuning/Delete', { params: { pageId: $location.search().id } }) .success(function (data) { - $scope.frameLoaded++; + $scope.enableTuning++; $scope.pageId = $scope.pageId + "&n=123456"; $('.btn-default-delete').attr("disabled", false); }) - } // Toggle panel @@ -353,9 +358,9 @@ angular.module("umbraco.tuning", ['ui.bootstrap', 'spectrumcolorpicker', 'ui.sli $scope.googleFontFamilies = data; }) - // watch framLoaded - $scope.$watch("frameLoaded", function () { - if ($scope.frameLoaded > 0) { + // watch framLoaded, only if iframe page have EnableTuning() + $scope.$watch("enableTuning", function () { + if ($scope.enableTuning > 0) { initTuning(); $scope.$watch('tuningModel', function () { refreshtuning(); @@ -363,11 +368,12 @@ angular.module("umbraco.tuning", ['ui.bootstrap', 'spectrumcolorpicker', 'ui.sli } }, true) - // first panel init - initTuning(); - - // toggle panel - $scope.togglePanel(); + // First default load + $timeout(function () { + // toggle panel + $scope.frameLoaded = true; + $timeout(function () { 1000, $scope.togglePanel(); }); + }, 1000); }) diff --git a/src/Umbraco.Web.UI/Umbraco/preview/index.html b/src/Umbraco.Web.UI/Umbraco/preview/index.html index fe726c661f..cf5210cffe 100644 --- a/src/Umbraco.Web.UI/Umbraco/preview/index.html +++ b/src/Umbraco.Web.UI/Umbraco/preview/index.html @@ -16,7 +16,7 @@ -