From 4ee97edf27c01cd6e4576535640973ec5b3f28ea Mon Sep 17 00:00:00 2001 From: Mads Rasmussen Date: Wed, 9 Sep 2015 10:05:38 +0200 Subject: [PATCH] Content: change buttons to umb-button and umb-button-group --- .../views/content/content.edit.controller.js | 29 +++++----- .../src/views/content/edit.html | 54 ++++++++----------- 2 files changed, 38 insertions(+), 45 deletions(-) diff --git a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js index b1dcfb46d5..0634471df1 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js +++ b/src/Umbraco.Web.UI.Client/src/views/content/content.edit.controller.js @@ -11,13 +11,15 @@ function ContentEditController($scope, $rootScope, $routeParams, $q, $timeout, $ //setup scope vars $scope.defaultButton = null; $scope.subButtons = []; - $scope.isNew = $routeParams.create; $scope.page = {}; $scope.page.loading = false; $scope.page.menu = {}; $scope.page.menu.currentNode = null; $scope.page.menu.currentSection = appState.getSectionState("currentSection"); + $scope.page.listViewPath = null; + $scope.page.isNew = $routeParams.create; + $scope.page.buttonGroupState = "init"; function init(content) { @@ -74,6 +76,8 @@ function ContentEditController($scope, $rootScope, $routeParams, $q, $timeout, $ function performSave(args) { var deferred = $q.defer(); + $scope.page.buttonGroupState = "busy"; + contentEditingHelper.contentEditorPerformSave({ statusMessage: args.statusMessage, saveMethod: args.saveMethod, @@ -84,12 +88,17 @@ function ContentEditController($scope, $rootScope, $routeParams, $q, $timeout, $ init($scope.content); syncTreeNode($scope.content, data.path); + $scope.page.buttonGroupState = "success"; + deferred.resolve(data); }, function (err) { //error if (err) { editorState.set($scope.content); } + + $scope.page.buttonGroupState = "error"; + deferred.reject(err); }); @@ -134,7 +143,7 @@ function ContentEditController($scope, $rootScope, $routeParams, $q, $timeout, $ $scope.content = data; if (data.isChildOfListView && data.trashed === false) { - $scope.listViewPath = ($routeParams.page) + $scope.page.listViewPath = ($routeParams.page) ? "/content/content/edit/" + data.parentId + "?page=" + $routeParams.page : "/content/content/edit/" + data.parentId; } @@ -161,6 +170,8 @@ function ContentEditController($scope, $rootScope, $routeParams, $q, $timeout, $ if (formHelper.submitForm({ scope: $scope, statusMessage: "Unpublishing...", skipValidation: true })) { + $scope.page.buttonGroupState = "busy"; + contentResource.unPublish($scope.content.id) .then(function (data) { @@ -176,6 +187,8 @@ function ContentEditController($scope, $rootScope, $routeParams, $q, $timeout, $ syncTreeNode($scope.content, data.path); + $scope.page.buttonGroupState = "success"; + }); } @@ -210,19 +223,7 @@ function ContentEditController($scope, $rootScope, $routeParams, $q, $timeout, $ } - - }; - // this method is called for all action buttons and then we proxy based on the btn definition - $scope.performAction = function (btn) { - - if (!btn || !angular.isFunction(btn.handler)) { - throw "btn.handler must be a function reference"; - } - - if (!$scope.busy) { - btn.handler.apply(this); - } }; } diff --git a/src/Umbraco.Web.UI.Client/src/views/content/edit.html b/src/Umbraco.Web.UI.Client/src/views/content/edit.html index f84dc6e1fd..cbbad8267d 100644 --- a/src/Umbraco.Web.UI.Client/src/views/content/edit.html +++ b/src/Umbraco.Web.UI.Client/src/views/content/edit.html @@ -39,41 +39,33 @@ - + - + + - + + -