Skip to content

Commit

Permalink
Merge pull request #492 from knownasilya/project-cancel
Browse files Browse the repository at this point in the history
Add cancel to project add and remove
  • Loading branch information
Ilya Radchenko committed Jul 30, 2014
2 parents b752ae6 + cec8b2b commit 3ea2201
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 2 deletions.
12 changes: 12 additions & 0 deletions public/javascripts/pages/projects.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,18 @@
$scope.repos = window.repos;
$scope.providers = window.providers;
$scope.projectsPage = true;
$scope.toggleAdd = function (repo) {
repo.adding = 'pick-type';
};
$scope.toggleAddCancel = function (repo) {
repo.adding = false;
};
$scope.toggleRemove = function (repo) {
repo.really_remove = true;
};
$scope.toggleRemoveCancel = function (repo) {
repo.really_remove = false;
};
$scope.removeProject = function (account, repo, group) {
repo.really_remove = 'removing';
$.ajax('/' + repo.name + '/', {
Expand Down
12 changes: 10 additions & 2 deletions views/projects.html
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,17 @@ <h3>Delete <span class="project-name"></span> Configuration?</h3>
Really remove
</button>
<a href="/[[ repo.project.name ]]/config" data-toggle="tooltip" title="Configure"><i class="icon-wrench"></i></a>
<button class="btn btn-danger" ng-click="repo.really_remove = true" ng-disabled="repo.really_remove">Remove</button>

<span ng-switch="repo.really_remove">
<button ng-switch-default class="btn btn-warning" ng-click="toggleRemove(repo)" ng-disabled="repo.really_remove">Remove</button>
<button ng-switch-when="true" ng-disabled="!repo.really_remove" class="btn btn-default" ng-click="toggleRemoveCancel(repo)">Cancel</button>
</span>
</span>
<button ng-disabled="repo.adding" ng-switch-default class="btn add-repo btn-primary" ng-click="repo.adding = 'pick-type'">Add</button>

<div ng-switch-default ng-switch="repo.adding">
<button ng-disabled="repo.adding" ng-switch-default class="btn add-repo btn-primary" ng-click="toggleAdd(repo)">Add</button>
<button ng-disabled="!repo.adding" ng-switch-when="pick-type" class="btn cancel-add-repo btn-default" ng-click="toggleAddCancel(repo)">Cancel</button>
</div>
</div>
<div class="adding-repo pull-right" ng-show="repo.adding" ng-switch="repo.adding">
<div class="pick-type" ng-switch-when="pick-type">
Expand Down

0 comments on commit 3ea2201

Please sign in to comment.