-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* delete-case is actually an archive-case, so add that. Then, lets get deleting in palce * tests now pass properly! * first cut of changinge this up * what the heck does this method do, hey, we have a test, but no one uses it!! * Fix up navigation from a case on a teams page to the case page where we got lots of NaN! * clarify it's the number of the try. Ideally we would list name, but can't get that. * format to be smarter on the name and the number * rubocop * jshint * Fix the messaging for this component! * a issue with param permitting gave a bit of code clean up. https://blog.smartlogic.io/permitting-nested-arrays-using-strong-params-in-rails/ * deal wiht class path reloading issues in dev... * warn the next person * doc issue with this test for the next person! * follow convention that makes it easier to find these api methods * we had a spurious "not permitted" parameters because we were using strong paramters and ratings_params now lets just pluck out the ONE field we need, which will prevent random params goign int.... * errant logging * avoid spurious error by upgrading the reporter! * letter_opener gem that intercepts emails wants to open the email in a browser! disable this. * rubocop * Now you can actually delete a Case! Still have our old archive capability. * having some loading issues of files in the /lib, I think post Rails 5? * doc fix * chase down the issue with try 0 showing up! * typo1 * Update CHANGELOG.md Co-authored-by: epugh@opensourceconnections.com <>
- Loading branch information
Showing
42 changed files
with
361 additions
and
98 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
app/assets/javascripts/components/archive_case/_modal.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
<div class="modal-header"> | ||
<button type="button" class="close" ng-click="ctrl.cancel()" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
<h3 class="modal-title">Archive This Case for Later?</h3> | ||
</div> | ||
<div class="modal-body"> | ||
<p ng-hide="ctrl.onlyCase">You're about to put this case into deep freeze. You'll be able to get to it through "Archived Cases" filter in the Relevancy Cases listing page.</p> | ||
<p ng-show="ctrl.onlyCase">You can't archive the only case you have created! Consider adding a new case, or renaming this one.</p> | ||
</div> | ||
<div class="modal-footer"> | ||
<button class="btn btn-danger" ng-show="!ctrl.onlyCase" ng-click="ctrl.ok()">Archive</button> | ||
<button class="btn btn-default" ng-click="ctrl.cancel()">Cancel</button> | ||
</div> |
8 changes: 8 additions & 0 deletions
8
app/assets/javascripts/components/archive_case/archive_case.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
<a class="action-icon" ng-click="ctrl.openArchiveModal()"> | ||
<i | ||
class="fa fa-archive" | ||
aria-hidden="true" | ||
title="{{ ctrl.retrieveTooltip() }}" | ||
alt="{{ ctrl.retrieveTooltip() }}" | ||
></i> | ||
</a> |
75 changes: 75 additions & 0 deletions
75
app/assets/javascripts/components/archive_case/archive_case_controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
'use strict'; | ||
|
||
/*jshint latedef:false*/ | ||
|
||
angular.module('QuepidApp') | ||
.controller('ArchiveCaseCtrl', [ | ||
'$scope', | ||
'$uibModal', | ||
'flash', | ||
'caseSvc', | ||
function ( | ||
$scope, | ||
$uibModal, | ||
flash, | ||
caseSvc | ||
) { | ||
var ctrl = this; | ||
|
||
ctrl.thisCase = $scope.thisCase; | ||
ctrl.checkIfOnlyCase = checkIfOnlyCase; | ||
ctrl.archiveCase = archiveCase; | ||
ctrl.openArchiveModal = openArchiveModal; | ||
ctrl.retrieveTooltip = retrieveTooltip; | ||
|
||
function archiveCase() { | ||
caseSvc.archiveCase(ctrl.thisCase).then( | ||
function () { | ||
flash.success = 'Case archived successfully.'; | ||
}, function (data) { | ||
var message = 'Oooops! Could not archive the case. '; | ||
message += data.message; | ||
flash.error = message; | ||
} | ||
); | ||
} | ||
|
||
function checkIfOnlyCase() { | ||
var ownedCases = caseSvc.filterCases(caseSvc.allCases, true); | ||
|
||
if( ownedCases.length <= 1 ){ | ||
return true; | ||
} | ||
|
||
return false; | ||
} | ||
|
||
function retrieveTooltip() { | ||
if(ctrl.checkIfOnlyCase()){ | ||
return 'Can\'t archive the only case'; | ||
} else { | ||
return 'Archive'; | ||
} | ||
} | ||
|
||
function openArchiveModal() { | ||
var modalInstance = $uibModal.open({ | ||
templateUrl: 'archive_case/_modal.html', | ||
controller: 'ArchiveCaseModalInstanceCtrl', | ||
controllerAs: 'ctrl', | ||
size: 'sm', | ||
resolve: { | ||
onlyCase: function() { | ||
return ctrl.checkIfOnlyCase(); | ||
} | ||
} | ||
}); | ||
|
||
modalInstance.result.then(function (archiveClicked) { | ||
if( archiveClicked ){ | ||
ctrl.archiveCase(); | ||
} | ||
}); | ||
} | ||
} | ||
]); |
16 changes: 16 additions & 0 deletions
16
app/assets/javascripts/components/archive_case/archive_case_directive.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
'use strict'; | ||
|
||
angular.module('QuepidApp') | ||
.directive('archiveCase', [ | ||
function () { | ||
return { | ||
restrict: 'E', | ||
controller: 'ArchiveCaseCtrl', | ||
controllerAs: 'ctrl', | ||
templateUrl: 'archive_case/archive_case.html', | ||
scope: { | ||
thisCase: '=', | ||
}, | ||
}; | ||
} | ||
]); |
21 changes: 21 additions & 0 deletions
21
app/assets/javascripts/components/archive_case/archive_case_modal_instance_controller.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
'use strict'; | ||
|
||
angular.module('QuepidApp') | ||
.controller('ArchiveCaseModalInstanceCtrl', [ | ||
'$uibModalInstance', | ||
'onlyCase', | ||
function ($uibModalInstance, onlyCase) { | ||
var ctrl = this; | ||
|
||
ctrl.onlyCase = onlyCase; | ||
|
||
ctrl.ok = function () { | ||
$uibModalInstance.close(true); | ||
}; | ||
|
||
ctrl.cancel = function () { | ||
$uibModalInstance.close(false); | ||
}; | ||
|
||
} | ||
]); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,12 @@ | ||
<div class="modal-header"> | ||
<button type="button" class="close" ng-click="ctrl.cancel()" aria-label="Close"><span aria-hidden="true">×</span></button> | ||
<h3 class="modal-title">Archive This Case for Later?</h3> | ||
<h3 class="modal-title">Delete This Case</h3> | ||
</div> | ||
<div class="modal-body"> | ||
<p ng-hide="ctrl.onlyCase">You're about to put this case into deep freeze. You'll be able to get to it through "Archived Cases" filter in the Relevancy Cases listing page.</p> | ||
<p ng-hide="ctrl.onlyCase">You're about to delete this case forever! If you might want it later, use the Archive function instead.</p> | ||
<p ng-show="ctrl.onlyCase">You can't delete the only case you have created! Consider adding a new case, or renaming this one.</p> | ||
</div> | ||
<div class="modal-footer"> | ||
<button class="btn btn-danger" ng-show="!ctrl.onlyCase" ng-click="ctrl.ok()">Archive</button> | ||
<button class="btn btn-danger" ng-show="!ctrl.onlyCase" ng-click="ctrl.ok()">Delete</button> | ||
<button class="btn btn-default" ng-click="ctrl.cancel()">Cancel</button> | ||
</div> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.