-
Notifications
You must be signed in to change notification settings - Fork 726
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[RFR] Revamp Filter UX #522
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
21f3e8f
Move maViewBatchActions directive to button directory
fzaninotto a5cbeed
Make filter form update in real time
fzaninotto d5be005
Split list view into listLayout and grid to prevent filter focus loss
fzaninotto 58e422b
Fix selection and batch actions
fzaninotto e8ab4dd
Fix adding the same filter twice keeps the filter value
fzaninotto 608a06f
Introducing "pinned" filters
fzaninotto 19b5008
Fix tests
fzaninotto 5e95219
Make e2e test more ribust by forcing asynchronous testing
fzaninotto 9910554
Use ES6 compliant syntax
fzaninotto File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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
47 changes: 47 additions & 0 deletions
47
src/javascripts/ng-admin/Crud/button/maViewBatchActions.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,47 @@ | ||
function maViewBatchActionsDirective($injector) { | ||
var $compile = $injector.get('$compile'); | ||
|
||
return { | ||
restrict: 'E', | ||
scope: { | ||
'entity': '=', | ||
'selection': '=', | ||
'buttons': '&' | ||
}, | ||
link: function(scope) { | ||
scope.isopen = false; | ||
|
||
scope.toggleDropdown = function($event) { | ||
$event.preventDefault(); | ||
$event.stopPropagation(); | ||
scope.isopen = !scope.isopen; | ||
}; | ||
|
||
scope.buttons = scope.buttons(); | ||
if (typeof scope.buttons === 'string') { | ||
scope.customTemplate = scope.buttons; | ||
scope.buttons = null; | ||
} | ||
}, | ||
template: | ||
`<span ng-if="selection" class="btn-group" dropdown is-open="isopen"> | ||
<button type="button" ng-if="selection.length" class="btn btn-default dropdown-toggle" dropdown-toggle > | ||
{{ selection.length }} Selected <span class="caret"></span> | ||
</button> | ||
<ul class="dropdown-menu" role="menu"> | ||
<li ng-repeat="button in buttons" ng-switch="button"> | ||
<a ng-switch-when="delete"> | ||
<ma-batch-delete-button selection="selection" entity="entity"/> | ||
</a> | ||
<a ng-switch-default> | ||
<span compile="button"></span> | ||
</a> | ||
</li> | ||
</ul> | ||
</span>` | ||
}; | ||
} | ||
|
||
maViewBatchActionsDirective.$inject = ['$injector']; | ||
|
||
module.exports = maViewBatchActionsDirective; |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
function maFilterButtonDirective() { | ||
'use strict'; | ||
|
||
return { | ||
restrict: 'E', | ||
scope: { | ||
filters: '&', | ||
enabledFilters: '=', | ||
enableFilter: '&' | ||
}, | ||
link: function(scope) { | ||
scope.notYetEnabledFilters = () => scope.filters().filter(filter => | ||
scope.enabledFilters.indexOf(filter) === -1 | ||
); | ||
scope.hasFilters = () => scope.notYetEnabledFilters().length > 0; | ||
}, | ||
template: | ||
`<span class="btn-group" dropdown is-open="isopen" ng-if="hasFilters()"> | ||
<button type="button" class="btn btn-default dropdown-toggle" dropdown-toggle > | ||
<span class="glyphicon glyphicon-filter" aria-hidden="true"></span> Add filter <span class="caret"></span> | ||
</button> | ||
<ul class="dropdown-menu" role="menu"> | ||
<li ng-repeat="filter in notYetEnabledFilters()" ng-switch="button"> | ||
<a ng-click="enableFilter()(filter)">{{ filter.label() }}</a> | ||
</li> | ||
</ul> | ||
</span>` | ||
}; | ||
} | ||
|
||
maFilterButtonDirective.$inject = []; | ||
|
||
module.exports = maFilterButtonDirective; |
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 was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
FIXME spotted! :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I know, will do in a future PR. Call me technical debt.