Skip to content

Commit

Permalink
Disable the move and copy buttons of various dialogs until a target n…
Browse files Browse the repository at this point in the history
…ode is selected (fixes umbraco#3241)
  • Loading branch information
kjac committed Oct 10, 2018
1 parent afa3e9b commit f8bc233
Show file tree
Hide file tree
Showing 8 changed files with 12 additions and 10 deletions.
2 changes: 1 addition & 1 deletion src/Umbraco.Web.UI.Client/src/views/content/copy.html
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@
<a class="btn btn-link" ng-click="nav.hideDialog()" ng-if="!busy">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary" ng-click="copy()" ng-disabled="busy">
<button class="btn btn-primary" ng-click="copy()" ng-disabled="busy || !target">
<localize key="actions_copy">Copy</localize>
</button>
</div>
Expand Down
4 changes: 2 additions & 2 deletions src/Umbraco.Web.UI.Client/src/views/content/move.html
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,8 @@
<a class="btn btn-link" ng-click="nav.hideDialog()" ng-if="!busy">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary" ng-click="move()" ng-disabled="busy">
<button class="btn btn-primary" ng-click="move()" ng-disabled="busy || !target">
<localize key="actions_move">Move</localize>
</button>
</div>
</div>
</div>
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h5 class="text-success">
<a class="btn btn-link" ng-click="nav.hideDialog()" ng-if="!busy">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary" ng-click="copy()" ng-disabled="busy">
<button class="btn btn-primary" ng-click="copy()" ng-disabled="busy || !target">
<localize key="actions_copy">Copy</localize>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h5 class="text-success">
<a class="btn btn-link" ng-click="nav.hideDialog()" ng-if="!busy">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary" ng-click="move()" ng-disabled="busy">
<button class="btn btn-primary" ng-click="move()" ng-disabled="busy || !target">
<localize key="actions_move">Move</localize>
</button>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,10 @@ angular.module("umbraco").controller("Umbraco.Editors.Media.MoveController",
$scope.dialogTreeEventHandler.bind("treeNodeExpanded", nodeExpandedHandler);

$scope.move = function () {
$scope.busy = true;
mediaResource.move({ parentId: $scope.target.id, id: node.id })
.then(function (path) {
$scope.busy = false;
$scope.error = false;
$scope.success = true;

Expand Down Expand Up @@ -97,4 +99,4 @@ angular.module("umbraco").controller("Umbraco.Editors.Media.MoveController",
$scope.miniListView = node;
}

});
});
4 changes: 2 additions & 2 deletions src/Umbraco.Web.UI.Client/src/views/media/move.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
</div>

<div class="umb-dialog-footer btn-toolbar umb-btn-toolbar" ng-hide="success">
<a class="btn btn-link" ng-click="nav.hideDialog()"><localize key="general_cancel">Cancel</localize></a>
<button class="btn btn-primary" ng-click="move()"><localize key="actions_move">Move</localize></button>
<a class="btn btn-link" ng-click="nav.hideDialog()" ng-if="!busy"><localize key="general_cancel">Cancel</localize></a>
<button class="btn btn-primary" ng-click="move()" ng-disabled="busy || !target"><localize key="actions_move">Move</localize></button>
</div>
</div>
2 changes: 1 addition & 1 deletion src/Umbraco.Web.UI.Client/src/views/mediatypes/copy.html
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ <h5 class="text-success">
<a class="btn btn-link" ng-click="nav.hideDialog()" ng-if="!busy">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary" ng-click="copy()" ng-disabled="busy">
<button class="btn btn-primary" ng-click="copy()" ng-disabled="busy || !target">
<localize key="actions_copy">Copy</localize>
</button>
</div>
Expand Down
2 changes: 1 addition & 1 deletion src/Umbraco.Web.UI.Client/src/views/mediatypes/move.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h5 class="text-success"><strong>{{currentNode.name}}</strong> <localize key="co
<a class="btn btn-link" ng-click="nav.hideDialog()" ng-if="!busy">
<localize key="general_cancel">Cancel</localize>
</a>
<button class="btn btn-primary" ng-click="move()" ng-disabled="busy">
<button class="btn btn-primary" ng-click="move()" ng-disabled="busy || !target">
<localize key="actions_move">Move</localize>
</button>
</div>
Expand Down

0 comments on commit f8bc233

Please sign in to comment.