From fbe388a616415957dece5eb44be4cc4b50faae27 Mon Sep 17 00:00:00 2001 From: perploug Date: Tue, 1 Oct 2013 10:10:55 +0200 Subject: [PATCH] Cleans up rte embed dialog --- src/Umbraco.Web.UI.Client/src/less/hacks.less | 2 +- .../common/dialogs/rteembed.controller.js | 59 ++++++++++--------- .../src/views/common/dialogs/rteembed.html | 56 ++++++++---------- 3 files changed, 55 insertions(+), 62 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/less/hacks.less b/src/Umbraco.Web.UI.Client/src/less/hacks.less index 1badd7e905..1f83c0f686 100644 --- a/src/Umbraco.Web.UI.Client/src/less/hacks.less +++ b/src/Umbraco.Web.UI.Client/src/less/hacks.less @@ -17,7 +17,7 @@ .umbracoDialog form{height: 100%;} /*ensures dialogs doesnt have side-by-side labels */ -.umbracoDialog .controls-row{margin-left: 0px !important;} +.umbracoDialog .controls-row, .umb-modal .controls-row{margin-left: 0px !important;} .controls-row img { max-width: none; diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/rteembed.controller.js b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/rteembed.controller.js index 5adf5d41a2..07fb7ab332 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/rteembed.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/rteembed.controller.js @@ -1,48 +1,49 @@ angular.module("umbraco").controller("Umbraco.Dialogs.RteEmbedController", function ($scope, $http) { - $scope.url = ""; - $scope.width = 500; - $scope.height = 300; - $scope.constrain = true; - $scope.preview = ""; - $scope.success = false; - $scope.info = ""; - $scope.supportsDimensions = false; + $scope.form = {}; + $scope.form.url = ""; + $scope.form.width = 360; + $scope.form.height = 240; + $scope.form.constrain = true; + $scope.form.preview = ""; + $scope.form.success = false; + $scope.form.info = ""; + $scope.form.supportsDimensions = false; var origWidth = 500; var origHeight = 300; $scope.showPreview = function(){ - if ($scope.url != "") { - - $scope.preview = "
"; - $scope.info = ""; - $scope.success = false; + if ($scope.form.url != "") { + $scope.form.show = true; + $scope.form.preview = "
"; + $scope.form.info = ""; + $scope.form.success = false; - $http({ method: 'GET', url: '/umbraco/UmbracoApi/RteEmbed/GetEmbed', params: { url: $scope.url, width: $scope.width, height: $scope.height } }) + $http({ method: 'GET', url: '/umbraco/UmbracoApi/RteEmbed/GetEmbed', params: { url: $scope.form.url, width: $scope.form.width, height: $scope.form.height } }) .success(function (data) { - $scope.preview = ""; + $scope.form.preview = ""; switch (data.Status) { case 0: //not supported - $scope.info = "Not Supported"; + $scope.form.info = "Not Supported"; break; case 1: //error - $scope.info = "Computer says no"; + $scope.form.info = "Computer says no"; break; case 2: - $scope.preview = data.Markup; - $scope.supportsDimensions = data.SupportsDimensions; - $scope.success = true; + $scope.form.preview = data.Markup; + $scope.form.supportsDimensions = data.SupportsDimensions; + $scope.form.success = true; break; } }) .error(function() { - $scope.preview = ""; - $scope.info = "Computer says no"; + $scope.form.preview = ""; + $scope.form.info = "Computer says no"; }); } @@ -52,24 +53,24 @@ $scope.changeSize = function (type) { var width, height; - if ($scope.constrain) { - width = parseInt($scope.width, 10); - height = parseInt($scope.height, 10); + if ($scope.form.constrain) { + width = parseInt($scope.form.width, 10); + height = parseInt($scope.form.height, 10); if (type == 'width') { origHeight = Math.round((width / origWidth) * height); - $scope.height = origHeight; + $scope.form.height = origHeight; } else { origWidth = Math.round((height / origHeight) * width); - $scope.width = origWidth; + $scope.form.width = origWidth; } } - if ($scope.url != "") { + if ($scope.form.url != "") { $scope.showPreview(); } }; $scope.insert = function(){ - $scope.submit($scope.preview); + $scope.submit($scope.form.preview); }; }); \ No newline at end of file diff --git a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/rteembed.html b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/rteembed.html index e752b0685e..85f45ef400 100644 --- a/src/Umbraco.Web.UI.Client/src/views/common/dialogs/rteembed.html +++ b/src/Umbraco.Web.UI.Client/src/views/common/dialogs/rteembed.html @@ -1,39 +1,31 @@ 
-
- -
-
-
- - - + -
- -
- -
- -
- - -
-
- - x - - -
-
-

-
-
-
-
- + +
+